private Map<String,Set<String>> gatherRequestedClaims(OAuth2ProviderSettings providerSettings,String claimsJson,String objectName){
  final Map<String,Set<String>> requestedClaims=new HashMap<String,Set<String>>();
  try {
    if (providerSettings.getClaimsParameterSupported() && claimsJson != null) {
      try {
        final JSONObject claimsObject=new JSONObject(claimsJson);
        JSONObject subClaimsRequest=claimsObject.getJSONObject(objectName);
        Iterator<String> it=subClaimsRequest.keys();
        while (it.hasNext()) {
          final String keyName=it.next();
          JSONObject optObj=subClaimsRequest.optJSONObject(keyName);
          final HashSet<String> options=new HashSet<String>();
          if (optObj != null) {
            final JSONArray optArray=optObj.optJSONArray(OAuth2Constants.Params.VALUES);
            if (optArray != null) {
              for (int i=0; i < optArray.length(); i++) {
                options.add(optArray.getString(i));
              }
            }
            final String value=optObj.optString(OAuth2Constants.Params.VALUE);
            if (!StringUtils.isBlank(value)) {
              options.add(value);
            }
          }
          requestedClaims.put(keyName,options);
        }
      }
 catch (      JSONException e) {
      }
    }
  }
 catch (  ServerException e) {
    logger.message("Requested Claims Supported not set.");
  }
  return requestedClaims;
}

private Map < String , Set < String > > gatherRequestedClaims ( OAuth2ProviderSettings providerSettings , String claimsJson , String objectName ) { final Map < String , Set < String > > requestedClaims = new HashMap < String , Set < String > > ( ) ; try { if ( providerSettings . getClaimsParameterSupported ( ) && claimsJson != null ) { try { final JSONObject claimsObject = new JSONObject ( claimsJson ) ; JSONObject subClaimsRequest = claimsObject . getJSONObject ( objectName ) ; Iterator < String > it = subClaimsRequest . keys ( ) ; while ( it . hasNext ( ) ) { final String keyName = it . next ( ) ; JSONObject optObj = subClaimsRequest . optJSONObject ( keyName ) ; final HashSet < String > options = new HashSet < String > ( ) ; if ( optObj != null ) { final JSONArray optArray = optObj . optJSONArray ( OAuth2Constants . Params . VALUES ) ; if ( optArray != null ) { for ( int i = 0 ; i < optArray . length ( ) ; i ++ ) { options . add ( optArray . getString ( i ) ) ; } } final String value = optObj . optString ( OAuth2Constants . Params . VALUE ) ; if ( ! StringUtils . isBlank ( value ) ) { options . add ( value ) ; } } requestedClaims . put ( keyName , options ) ; } } catch ( JSONException e ) { } } } catch ( ServerException e ) { logger . message ( "Requested Claims Supported not set." ) ; } return requestedClaims ; }
generates a map for the claims specifically requested as per section 5 . 5 of the spec . ends up mapping requested claims against a set of their optional values ( empty if claim is requested but no suggested / required values given ) .
