Example on how to create the JWT Token for Jitsi with Java code

In relation at this issue:
https://github.com/auth0/auth0-java/issues/228

I’m trying to generate a JWt Token for Jitsimeet, but i have some doubt on how to use the java API
Here the payload i need to encode on jwt:

Headers (using RS256 public key validation)

{
  "kid": "jitsi/custom_key_name",
  "typ": "JWT",
  "alg": "RS256"
}

Payload

{
  "context": {
    "user": {
      "avatar": "https:/gravatar.com/avatar/abc123",
      "name": "John Doe",
      "email": "jdoe@example.com",
      "id": "abcd:a1b2c3-d4e5f6-0abc1-23de-abcdef01fedcba"
    },
    "group": "a123-123-456-789"
  },
  "aud": "jitsi",
  "iss": "my_client",
  "sub": "meet.jit.si",
  "room": "*",
  "exp": 1500006923
}

and here my java code

	public static String generateFrom(String username,String email,String room,String appid,String hostname) {
		try {
			Date expirationDate = Date.from(ZonedDateTime.now().plusHours(24).toInstant());
			Date issuedAt = Date.from(ZonedDateTime.now().toInstant());

			User user = new User();
			user.setAvatar("");
			user.setEmail(email);
			user.setName(username);
			user.setId(username);
			
			Context  context = new Context();
			context.setUser(user);
			
					
			JwtToken jwtToken = new JwtToken();
			jwtToken.setContext(context);
			jwtToken.setAud(appid);
			jwtToken.setIss(appid);
			jwtToken.setSub(hostname);
			jwtToken.setRoom(room);
			jwtToken.setExp(String.valueOf(expirationDate.getTime()));
			
			//Claim claimUser = new com.auth0.jwt.JWTCreator.Builder().
			
			//HEADER
			Map<String, Object> headerClaims = new HashMap<String,Object>();
			headerClaims.put(PublicClaims.KEY_ID, "jitsi/"+appid);//"kid"
			headerClaims.put(PublicClaims.ALGORITHM,"HS256");//"alg
			headerClaims.put(PublicClaims.TYPE,"JWT");//"typ"
			
			//PAYLOAD
			Map<String, Object> claims = new HashMap<String, Object>();
			claims.put("context",jwtToken.getContext());
			claims.put("aud",jwtToken.getAud());
			claims.put("iss",jwtToken.getIss());
			claims.put("sub",jwtToken.getSub());
			claims.put("room",jwtToken.getRoom());
			claims.put("exp",jwtToken.getExp());	
			//https://github.com/auth0/java-jwt
			return JWT.create()
					.withHeader(headerClaims)
					.withIssuer(jwtToken.getIss())
					.withSubject(jwtToken.getSub())
					.withAudience(jwtToken.getAud())
					.withIssuedAt(issuedAt)
					.withExpiresAt(expirationDate)
					//CLAIM					
					.withClaim("aud",jwtToken.getAud())
					.withClaim("iss",jwtToken.getIss())
					.withClaim("sub",jwtToken.getSub())
					.withClaim("room",jwtToken.getRoom())
					.withClaim("exp",jwtToken.getExp())
					.withClaim("context",jwtToken.getContext().toString())									
					.sign(getAlgorithm());
		} catch (UnsupportedEncodingException | JWTCreationException ex) {
			throw new JWTCreationException(ex.getMessage(),ex);
		}
	}

The java code for set the claim “context” is wrong.
How i must use the java api for accomplish this?

Greetings.

your method getContext() must return a Map<String,Object>