CustomJWTTransformer/src/main/java/org/wso2/caron/test/ExtendedJWTTransformer.java
@Override
    public JWTClaimsSet transform(JWTClaimsSet jwtClaimsSet) {
        JWTClaimsSet tempJWTClaimsSet = super.transform(jwtClaimsSet);
        JWTClaimsSet.Builder jwtBuilder = new JWTClaimsSet.Builder();
        for (String key : tempJWTClaimsSet.getClaims().keySet()) {
            if (key.equals(CLAIM_NAME)) {
                try {
                    if (tempJWTClaimsSet.getStringArrayClaim(CLAIM_NAME) != null
                            && tempJWTClaimsSet.getStringArrayClaim(CLAIM_NAME).length > 0) {
                        jwtBuilder.claim(key, tempJWTClaimsSet.getStringArrayClaim("azp")[0]);
                    } else {
                        jwtBuilder.claim(key, tempJWTClaimsSet.getClaim(CLAIM_NAME));
                    }
                } catch (ParseException e) {
                    log.warn("Claim azp is not an array");
                    jwtBuilder.claim(key, tempJWTClaimsSet.getClaim("azp"));
                }
            } else {
                jwtBuilder.claim(key, tempJWTClaimsSet.getClaim(key));
            }
        }

        return jwtBuilder.build();
    }
/**
     * This method used to transform JWT claimset from given JWT. In this customization what it dose is if the azp
     * claim is mapped as multi values attribute, Convert it to a single line.
     *
     * @param jwtClaimsSet jwtClaimSet from given JWT
     * @return transformed JWT Claims.
     */
This method used to transform JWT claimset from given JWT. In this customization what it dose is if the azp
claim is mapped as multi values attribute, Convert it to a single line.

@param jwtClaimsSet jwtClaimSet from given JWT
@return transformed JWT Claims.
This method used to transform JWT claimset from given JWT . In this customization what it dose is if the azp claim is mapped as multi values attribute Convert it to a single line . @param jwtClaimsSet jwtClaimSet from given JWT @return transformed JWT Claims .
@Override
    public JWTClaimsSet transform(JWTClaimsSet jwtClaimsSet) {
        JWTClaimsSet tempJWTClaimsSet = super.transform(jwtClaimsSet);
        JWTClaimsSet.Builder jwtBuilder = new JWTClaimsSet.Builder();
        for (String key : tempJWTClaimsSet.getClaims().keySet()) {
            if (key.equals(CLAIM_NAME)) {
                try {
                    if (tempJWTClaimsSet.getStringArrayClaim(CLAIM_NAME) != null
                            && tempJWTClaimsSet.getStringArrayClaim(CLAIM_NAME).length > 0) {
                        jwtBuilder.claim(key, tempJWTClaimsSet.getStringArrayClaim("azp")[0]);
                    } else {
                        jwtBuilder.claim(key, tempJWTClaimsSet.getClaim(CLAIM_NAME));
                    }
                } catch (ParseException e) {
                    log.warn("Claim azp is not an array");
                    jwtBuilder.claim(key, tempJWTClaimsSet.getClaim("azp"));
                }
            } else {
                jwtBuilder.claim(key, tempJWTClaimsSet.getClaim(key));
            }
        }
        return jwtBuilder.build();
    }
@ Override public JWTClaimsSet transform ( JWTClaimsSet jwtClaimsSet ) { JWTClaimsSet tempJWTClaimsSet = super . transform ( jwtClaimsSet ) ; JWTClaimsSet . Builder jwtBuilder = new JWTClaimsSet . Builder ( ) ; for ( String key : tempJWTClaimsSet . getClaims ( ) . keySet ( ) ) { if ( key . equals ( CLAIM_NAME ) ) { try { if ( tempJWTClaimsSet . getStringArrayClaim ( CLAIM_NAME ) != null && tempJWTClaimsSet . getStringArrayClaim ( CLAIM_NAME ) . length > 0 ) { jwtBuilder . claim ( key , tempJWTClaimsSet . getStringArrayClaim ( "azp" ) [ 0 ] ) ; } else { jwtBuilder . claim ( key , tempJWTClaimsSet . getClaim ( CLAIM_NAME ) ) ; } } catch ( ParseException e ) { log . warn ( "Claim azp is not an array" ) ; jwtBuilder . claim ( key , tempJWTClaimsSet . getClaim ( "azp" ) ) ; } } else { jwtBuilder . claim ( key , tempJWTClaimsSet . getClaim ( key ) ) ; } } return jwtBuilder . build ( ) ; }
This method used to transform JWT claimset from given JWT.
This method used to transform JWT claimset from given JWT .