gluu
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl クラス
org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl の継承関係図
Inheritance graph
org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl 連携図
Collaboration graph

公開メンバ関数

Response requestUserInfoGet (String accessToken, String authorization, HttpServletRequest request, SecurityContext securityContext)
 
Response requestUserInfoPost (String accessToken, String authorization, HttpServletRequest request, SecurityContext securityContext)
 
Response requestUserInfo (String accessToken, String authorization, HttpServletRequest request, SecurityContext securityContext)
 
String getJwtResponse (SignatureAlgorithm signatureAlgorithm, User user, AuthorizationGrant authorizationGrant, Collection< String > scopes) throws Exception
 
String getJweResponse (KeyEncryptionAlgorithm keyEncryptionAlgorithm, BlockEncryptionAlgorithm blockEncryptionAlgorithm, User user, AuthorizationGrant authorizationGrant, Collection< String > scopes) throws Exception
 
String getJSonResponse (User user, AuthorizationGrant authorizationGrant, Collection< String > scopes) throws Exception
 
boolean validateRequesteClaim (GluuAttribute gluuAttribute, String[] clientAllowedClaims, Collection< String > scopes)
 
Map< String, Object > getClaims (User user, Scope scope) throws InvalidClaimException, ParseException
 
Response requestUserInfoGet ( @QueryParam("access_token") @ApiParam(value="OAuth 2.0 Access Token.", required=true) String accessToken, @HeaderParam("Authorization") String authorization, @Context HttpServletRequest request, @Context SecurityContext securityContext)
 
Response requestUserInfoPost ( @FormParam("access_token") @ApiParam(value="OAuth 2.0 Access Token.", required=true) String accessToken, @HeaderParam("Authorization") String authorization, @Context HttpServletRequest request, @Context SecurityContext securityContext)
 

非公開メンバ関数

Response response (int status, UserInfoErrorResponseType errorResponseType)
 

非公開変数類

Logger log
 
ApplicationAuditLogger applicationAuditLogger
 
ErrorResponseFactory errorResponseFactory
 
AuthorizationGrantList authorizationGrantList
 
ClientService clientService
 
ScopeService scopeService
 
AttributeService attributeService
 
UserService userService
 
ExternalDynamicScopeService externalDynamicScopeService
 
PairwiseIdentifierService pairwiseIdentifierService
 
AppConfiguration appConfiguration
 
WebKeysConfiguration webKeysConfiguration
 

詳解

Provides interface for User Info REST web services

著者
Javier Rojas Blum
バージョン
September 3, 2018

関数詳解

◆ getClaims()

Map<String, Object> org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.getClaims ( User  user,
Scope  scope 
) throws InvalidClaimException, ParseException
inline
695  {
696  Map<String, Object> claims = new HashMap<String, Object>();
697 
698  if (scope != null && scope.getOxAuthClaims() != null) {
699  for (String claimDn : scope.getOxAuthClaims()) {
700  GluuAttribute gluuAttribute = attributeService.getAttributeByDn(claimDn);
701 
702  String claimName = gluuAttribute.getOxAuthClaimName();
703  String ldapName = gluuAttribute.getName();
704  Object attribute = null;
705 
706  if (StringUtils.isNotBlank(claimName) && StringUtils.isNotBlank(ldapName)) {
707  if (ldapName.equals("uid")) {
708  attribute = user.getUserId();
709  } else if (AttributeDataType.BOOLEAN.equals(gluuAttribute.getDataType())) {
710  attribute = Boolean.parseBoolean((String) user.getAttribute(gluuAttribute.getName(), true));
711  } else if (AttributeDataType.DATE.equals(gluuAttribute.getDataType())) {
712  SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss.SSS'Z'");
713  Object attributeValue = user.getAttribute(gluuAttribute.getName(), true);
714  if (attributeValue != null) {
715  attribute = format.parse(attributeValue.toString());
716  }
717  } else {
718  attribute = user.getAttribute(gluuAttribute.getName(), true);
719  }
720 
721  if (attribute != null) {
722  if (attribute instanceof JSONArray) {
723  JSONArray jsonArray = (JSONArray) attribute;
724  List<String> values = new ArrayList<String>();
725  for (int i = 0; i < jsonArray.length(); i++) {
726  String value = jsonArray.optString(i);
727  if (value != null) {
728  values.add(value);
729  }
730  }
731  claims.put(claimName, values);
732  } else {
733  claims.put(claimName, attribute);
734  }
735  }
736  }
737  }
738  }
739 
740  return claims;
741  }
GluuAttribute getAttributeByDn(String dn)
Definition: AttributeService.java:47
AttributeService attributeService
Definition: UserInfoRestWebServiceImpl.java:93
Object getAttribute(String userAttribute, boolean optional)
Definition: SimpleUser.java:23
List< String > getOxAuthClaims()
Definition: Scope.java:96

◆ getJSonResponse()

String org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.getJSonResponse ( User  user,
AuthorizationGrant  authorizationGrant,
Collection< String >  scopes 
) throws Exception
inline

Builds a JSon String with the response parameters.

516  {
517  JsonWebResponse jsonWebResponse = new JsonWebResponse();
518 
519  // Claims
520  List<Scope> dynamicScopes = new ArrayList<Scope>();
521  for (String scopeName : scopes) {
523  if ((scope != null) && (org.xdi.oxauth.model.common.ScopeType.DYNAMIC == scope.getScopeType())) {
524  dynamicScopes.add(scope);
525  continue;
526  }
527 
528  Map<String, Object> claims = getClaims(user, scope);
529 
530  if (scope.getIsOxAuthGroupClaims()) {
531  JwtSubClaimObject groupClaim = new JwtSubClaimObject();
532  groupClaim.setName(scope.getDisplayName());
533  for (Map.Entry<String, Object> entry : claims.entrySet()) {
534  String key = entry.getKey();
535  Object value = entry.getValue();
536 
537  if (value instanceof List) {
538  groupClaim.setClaim(key, (List<String>) value);
539  } else {
540  groupClaim.setClaim(key, (String) value);
541  }
542  }
543 
544  jsonWebResponse.getClaims().setClaim(scope.getDisplayName(), groupClaim);
545  } else {
546  for (Map.Entry<String, Object> entry : claims.entrySet()) {
547  String key = entry.getKey();
548  Object value = entry.getValue();
549 
550  if (value instanceof List) {
551  jsonWebResponse.getClaims().setClaim(key, (List<String>) value);
552  } else if (value instanceof Boolean) {
553  jsonWebResponse.getClaims().setClaim(key, (Boolean) value);
554  } else if (value instanceof Date) {
555  jsonWebResponse.getClaims().setClaim(key, ((Date) value).getTime());
556  } else {
557  jsonWebResponse.getClaims().setClaim(key, (String) value);
558  }
559  }
560  }
561 
562  jsonWebResponse.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute("inum"));
563  }
564 
565  if (authorizationGrant.getClaims() != null) {
566  JSONObject claimsObj = new JSONObject(authorizationGrant.getClaims());
567  if (claimsObj.has("userinfo")) {
568  JSONObject userInfoObj = claimsObj.getJSONObject("userinfo");
569  for (Iterator<String> it = userInfoObj.keys(); it.hasNext(); ) {
570  String claimName = it.next();
571  boolean optional = true; // ClaimValueType.OPTIONAL.equals(claim.getClaimValue().getClaimValueType());
572  GluuAttribute gluuAttribute = attributeService.getByClaimName(claimName);
573 
574  if (gluuAttribute != null) {
575  String ldapClaimName = gluuAttribute.getName();
576 
577  Object attribute = user.getAttribute(ldapClaimName, optional);
578  if (attribute != null) {
579  if (attribute instanceof JSONArray) {
580  JSONArray jsonArray = (JSONArray) attribute;
581  List<String> values = new ArrayList<String>();
582  for (int i = 0; i < jsonArray.length(); i++) {
583  String value = jsonArray.optString(i);
584  if (value != null) {
585  values.add(value);
586  }
587  }
588  jsonWebResponse.getClaims().setClaim(claimName, values);
589  } else {
590  String value = (String) attribute;
591  jsonWebResponse.getClaims().setClaim(claimName, value);
592  }
593  }
594  }
595  }
596  }
597  }
598 
599  if (authorizationGrant.getJwtAuthorizationRequest() != null
600  && authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember() != null) {
601  for (Claim claim : authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember().getClaims()) {
602  boolean optional = true; // ClaimValueType.OPTIONAL.equals(claim.getClaimValue().getClaimValueType());
603  GluuAttribute gluuAttribute = attributeService.getByClaimName(claim.getName());
604 
605  if (gluuAttribute != null) {
606  Client client = authorizationGrant.getClient();
607 
608  if (validateRequesteClaim(gluuAttribute, client.getClaims(), scopes)) {
609  String ldapClaimName = gluuAttribute.getName();
610  Object attribute = user.getAttribute(ldapClaimName, optional);
611  if (attribute != null) {
612  if (attribute instanceof JSONArray) {
613  JSONArray jsonArray = (JSONArray) attribute;
614  List<String> values = new ArrayList<String>();
615  for (int i = 0; i < jsonArray.length(); i++) {
616  String value = jsonArray.optString(i);
617  if (value != null) {
618  values.add(value);
619  }
620  }
621  jsonWebResponse.getClaims().setClaim(claim.getName(), values);
622  } else {
623  String value = (String) attribute;
624  jsonWebResponse.getClaims().setClaim(claim.getName(), value);
625  }
626  }
627  }
628  }
629  }
630  }
631 
632  // Check for Subject Identifier Type
633  if (authorizationGrant.getClient().getSubjectType() != null &&
634  SubjectType.fromString(authorizationGrant.getClient().getSubjectType()).equals(SubjectType.PAIRWISE)) {
635  String sectorIdentifierUri = null;
636  if (StringUtils.isNotBlank(authorizationGrant.getClient().getSectorIdentifierUri())) {
637  sectorIdentifierUri = authorizationGrant.getClient().getSectorIdentifierUri();
638  } else {
639  sectorIdentifierUri = authorizationGrant.getClient().getRedirectUris()[0];
640  }
641 
642  String userInum = authorizationGrant.getUser().getAttribute("inum");
643  String clientId = authorizationGrant.getClientId();
645  userInum, sectorIdentifierUri, clientId);
646  if (pairwiseIdentifier == null) {
647  pairwiseIdentifier = new PairwiseIdentifier(sectorIdentifierUri, clientId);
648  pairwiseIdentifier.setId(UUID.randomUUID().toString());
649  pairwiseIdentifier.setDn(pairwiseIdentifierService.getDnForPairwiseIdentifier(
650  pairwiseIdentifier.getId(),
651  userInum));
652  pairwiseIdentifierService.addPairwiseIdentifier(userInum, pairwiseIdentifier);
653  }
654  jsonWebResponse.getClaims().setSubjectIdentifier(pairwiseIdentifier.getId());
655  } else {
656  String openidSubAttribute = appConfiguration.getOpenidSubAttribute();
657  jsonWebResponse.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute(openidSubAttribute));
658  }
659 
660  if ((dynamicScopes.size() > 0) && externalDynamicScopeService.isEnabled()) {
661  final UnmodifiableAuthorizationGrant unmodifiableAuthorizationGrant = new UnmodifiableAuthorizationGrant(authorizationGrant);
662  DynamicScopeExternalContext dynamicScopeContext = new DynamicScopeExternalContext(dynamicScopes, jsonWebResponse, unmodifiableAuthorizationGrant);
664  }
665 
666  return jsonWebResponse.toString();
667  }
List< Claim > getClaims()
Definition: UserInfoMember.java:61
String getDnForPairwiseIdentifier(String oxId, String userInum)
Definition: PairwiseIdentifierService.java:107
UserInfoMember getUserInfoMember()
Definition: JwtAuthorizationRequest.java:420
String [] getRedirectUris()
Definition: Client.java:387
PAIRWISE
Definition: SubjectType.java:14
boolean validateRequesteClaim(GluuAttribute gluuAttribute, String[] clientAllowedClaims, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:669
AttributeService attributeService
Definition: UserInfoRestWebServiceImpl.java:93
void setId(String id)
Definition: PairwiseIdentifier.java:39
User getUser()
Definition: AbstractAuthorizationGrant.java:233
JwtClaims getClaims()
Definition: JsonWebResponse.java:41
JwtAuthorizationRequest getJwtAuthorizationRequest()
Definition: AbstractAuthorizationGrant.java:382
String getId()
Definition: PairwiseIdentifier.java:35
String getClaims()
Definition: AbstractAuthorizationGrant.java:153
Definition: UnmodifiableAuthorizationGrant.java:33
GluuAttribute getByClaimName(String name)
Definition: AttributeService.java:73
org.xdi.oxauth.model.common.Scope getScopeByDisplayName(String displayName)
Definition: ScopeService.java:119
Definition: SubjectType.java:12
void setSubjectIdentifier(String subjectIdentifier)
Definition: JwtClaims.java:127
String toString()
Definition: JsonWebResponse.java:60
String getSectorIdentifierUri()
Definition: Client.java:680
static SubjectType fromString(String param)
Definition: SubjectType.java:30
Definition: PairwiseIdentifier.java:16
DYNAMIC
Definition: ScopeType.java:56
String [] getClaims()
Definition: Client.java:1042
void setName(String name)
Definition: JwtSubClaimObject.java:17
Object getAttribute(String userAttribute, boolean optional)
Definition: SimpleUser.java:23
ExternalDynamicScopeService externalDynamicScopeService
Definition: UserInfoRestWebServiceImpl.java:99
Map< String, Object > getClaims(User user, Scope scope)
Definition: UserInfoRestWebServiceImpl.java:695
Definition: Scope.java:23
void setClaim(String key, String value)
Definition: JwtClaimSet.java:210
AppConfiguration appConfiguration
Definition: UserInfoRestWebServiceImpl.java:105
Client getClient()
Definition: AbstractAuthorizationGrant.java:340
Definition: ScopeType.java:21
void addPairwiseIdentifier(String userInum, PairwiseIdentifier pairwiseIdentifier)
Definition: PairwiseIdentifierService.java:100
ScopeService scopeService
Definition: UserInfoRestWebServiceImpl.java:90
String getClientId()
Definition: AbstractAuthorizationGrant.java:345
String getSubjectType()
Definition: Client.java:699
PairwiseIdentifierService pairwiseIdentifierService
Definition: UserInfoRestWebServiceImpl.java:102
Definition: JwtSubClaimObject.java:9
Definition: AuthenticationMethod.java:7
String getOpenidSubAttribute()
Definition: AppConfiguration.java:509
Definition: JsonWebResponse.java:21
PairwiseIdentifier findPairWiseIdentifier(String userInum, String sectorIdentifierUri, String clientId)
Definition: PairwiseIdentifierService.java:59
boolean executeExternalUpdateMethods(DynamicScopeExternalContext dynamicScopeContext)
Definition: ExternalDynamicScopeService.java:95

◆ getJweResponse()

String org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.getJweResponse ( KeyEncryptionAlgorithm  keyEncryptionAlgorithm,
BlockEncryptionAlgorithm  blockEncryptionAlgorithm,
User  user,
AuthorizationGrant  authorizationGrant,
Collection< String >  scopes 
) throws Exception
inline
361  {
362  Jwe jwe = new Jwe();
363 
364  // Header
365  jwe.getHeader().setType(JwtType.JWT);
366  jwe.getHeader().setAlgorithm(keyEncryptionAlgorithm);
367  jwe.getHeader().setEncryptionMethod(blockEncryptionAlgorithm);
368 
369  // Claims
370  List<Scope> dynamicScopes = new ArrayList<Scope>();
371  for (String scopeName : scopes) {
372  Scope scope = scopeService.getScopeByDisplayName(scopeName);
374  dynamicScopes.add(scope);
375  continue;
376  }
377 
378  if (scope.getOxAuthClaims() != null) {
379  for (String claimDn : scope.getOxAuthClaims()) {
380  GluuAttribute gluuAttribute = attributeService.getAttributeByDn(claimDn);
381 
382  String claimName = gluuAttribute.getOxAuthClaimName();
383  String ldapName = gluuAttribute.getName();
384  Object attributeValue = null;
385 
386  if (StringUtils.isNotBlank(claimName) && StringUtils.isNotBlank(ldapName)) {
387  if (ldapName.equals("uid")) {
388  attributeValue = user.getUserId();
389  } else {
390  attributeValue = user.getAttribute(gluuAttribute.getName(), true);
391  }
392 
393  if (attributeValue != null) {
394  if (attributeValue instanceof JSONArray) {
395  JSONArray jsonArray = (JSONArray) attributeValue;
396  List<String> values = new ArrayList<String>();
397  for (int i = 0; i < jsonArray.length(); i++) {
398  String value = jsonArray.optString(i);
399  if (value != null) {
400  values.add(value);
401  }
402  }
403  jwe.getClaims().setClaim(claimName, values);
404  } else {
405  String value = attributeValue.toString();
406  jwe.getClaims().setClaim(claimName, value);
407  }
408  }
409  }
410  }
411  }
412  }
413  if (authorizationGrant.getJwtAuthorizationRequest() != null
414  && authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember() != null) {
415  for (Claim claim : authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember().getClaims()) {
416  boolean optional = true; // ClaimValueType.OPTIONAL.equals(claim.getClaimValue().getClaimValueType());
417  GluuAttribute gluuAttribute = attributeService.getByClaimName(claim.getName());
418 
419  if (gluuAttribute != null) {
420  Client client = authorizationGrant.getClient();
421 
422  if (validateRequesteClaim(gluuAttribute, client.getClaims(), scopes)) {
423  String ldapClaimName = gluuAttribute.getName();
424  Object attribute = user.getAttribute(ldapClaimName, optional);
425  if (attribute != null) {
426  if (attribute instanceof JSONArray) {
427  JSONArray jsonArray = (JSONArray) attribute;
428  List<String> values = new ArrayList<String>();
429  for (int i = 0; i < jsonArray.length(); i++) {
430  String value = jsonArray.optString(i);
431  if (value != null) {
432  values.add(value);
433  }
434  }
435  jwe.getClaims().setClaim(claim.getName(), values);
436  } else {
437  String value = attribute.toString();
438  jwe.getClaims().setClaim(claim.getName(), value);
439  }
440  }
441  }
442  }
443  }
444  }
445 
446  // Check for Subject Identifier Type
447  if (authorizationGrant.getClient().getSubjectType() != null &&
448  SubjectType.fromString(authorizationGrant.getClient().getSubjectType()).equals(SubjectType.PAIRWISE)) {
449  String sectorIdentifierUri = null;
450  if (StringUtils.isNotBlank(authorizationGrant.getClient().getSectorIdentifierUri())) {
451  sectorIdentifierUri = authorizationGrant.getClient().getSectorIdentifierUri();
452  } else {
453  sectorIdentifierUri = authorizationGrant.getClient().getRedirectUris()[0];
454  }
455 
456  String userInum = authorizationGrant.getUser().getAttribute("inum");
457  String clientId = authorizationGrant.getClientId();
459  userInum, sectorIdentifierUri, clientId);
460  if (pairwiseIdentifier == null) {
461  pairwiseIdentifier = new PairwiseIdentifier(sectorIdentifierUri, clientId);
462  pairwiseIdentifier.setId(UUID.randomUUID().toString());
463  pairwiseIdentifier.setDn(pairwiseIdentifierService.getDnForPairwiseIdentifier(
464  pairwiseIdentifier.getId(),
465  userInum));
466  pairwiseIdentifierService.addPairwiseIdentifier(userInum, pairwiseIdentifier);
467  }
468  jwe.getClaims().setSubjectIdentifier(pairwiseIdentifier.getId());
469  } else {
470  String openidSubAttribute = appConfiguration.getOpenidSubAttribute();
471  jwe.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute(openidSubAttribute));
472  }
473 
474  if ((dynamicScopes.size() > 0) && externalDynamicScopeService.isEnabled()) {
475  final UnmodifiableAuthorizationGrant unmodifiableAuthorizationGrant = new UnmodifiableAuthorizationGrant(authorizationGrant);
476  DynamicScopeExternalContext dynamicScopeContext = new DynamicScopeExternalContext(dynamicScopes, jwe, unmodifiableAuthorizationGrant);
478  }
479 
480  // Encryption
481  if (keyEncryptionAlgorithm == KeyEncryptionAlgorithm.RSA_OAEP
482  || keyEncryptionAlgorithm == KeyEncryptionAlgorithm.RSA1_5) {
483  JSONObject jsonWebKeys = JwtUtil.getJSONWebKeys(authorizationGrant.getClient().getJwksUri());
485  String keyId = cryptoProvider.getKeyId(JSONWebKeySet.fromJSONObject(jsonWebKeys), SignatureAlgorithm.RS256, Use.ENCRYPTION);
486  PublicKey publicKey = cryptoProvider.getPublicKey(keyId, jsonWebKeys);
487 
488  if (publicKey != null) {
489  JweEncrypter jweEncrypter = new JweEncrypterImpl(keyEncryptionAlgorithm, blockEncryptionAlgorithm, publicKey);
490  jwe = jweEncrypter.encrypt(jwe);
491  } else {
492  throw new InvalidJweException("The public key is not valid");
493  }
494  } else if (keyEncryptionAlgorithm == KeyEncryptionAlgorithm.A128KW
495  || keyEncryptionAlgorithm == KeyEncryptionAlgorithm.A256KW) {
496  try {
497  byte[] sharedSymmetricKey = clientService.decryptSecret(authorizationGrant.getClient().getClientSecret()).getBytes(Util.UTF8_STRING_ENCODING);
498  JweEncrypter jweEncrypter = new JweEncrypterImpl(keyEncryptionAlgorithm, blockEncryptionAlgorithm, sharedSymmetricKey);
499  jwe = jweEncrypter.encrypt(jwe);
500  } catch (UnsupportedEncodingException e) {
501  throw new InvalidJweException(e);
502  } catch (StringEncrypter.EncryptionException e) {
503  throw new InvalidJweException(e);
504  } catch (Exception e) {
505  throw new InvalidJweException(e);
506  }
507  }
508 
509  return jwe.toString();
510  }
List< Claim > getClaims()
Definition: UserInfoMember.java:61
String getDnForPairwiseIdentifier(String oxId, String userInum)
Definition: PairwiseIdentifierService.java:107
Definition: AbstractCryptoProvider.java:44
UserInfoMember getUserInfoMember()
Definition: JwtAuthorizationRequest.java:420
String [] getRedirectUris()
Definition: Client.java:387
PAIRWISE
Definition: SubjectType.java:14
GluuAttribute getAttributeByDn(String dn)
Definition: AttributeService.java:47
boolean validateRequesteClaim(GluuAttribute gluuAttribute, String[] clientAllowedClaims, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:669
AttributeService attributeService
Definition: UserInfoRestWebServiceImpl.java:93
void setId(String id)
Definition: PairwiseIdentifier.java:39
User getUser()
Definition: AbstractAuthorizationGrant.java:233
ClientService clientService
Definition: UserInfoRestWebServiceImpl.java:87
Definition: SignatureAlgorithm.java:20
Definition: JwtUtil.java:38
JwtAuthorizationRequest getJwtAuthorizationRequest()
Definition: AbstractAuthorizationGrant.java:382
String getId()
Definition: PairwiseIdentifier.java:35
Definition: UnmodifiableAuthorizationGrant.java:33
GluuAttribute getByClaimName(String name)
Definition: AttributeService.java:73
String getJwksUri()
Definition: Client.java:629
org.xdi.oxauth.model.common.Scope getScopeByDisplayName(String displayName)
Definition: ScopeService.java:119
ScopeType getScopeType()
Definition: Scope.java:88
Definition: SubjectType.java:12
PublicKey getPublicKey(String alias, JSONObject jwks)
Definition: AbstractCryptoProvider.java:133
String getSectorIdentifierUri()
Definition: Client.java:680
static SubjectType fromString(String param)
Definition: SubjectType.java:30
Definition: PairwiseIdentifier.java:16
DYNAMIC
Definition: ScopeType.java:56
String [] getClaims()
Definition: Client.java:1042
Object getAttribute(String userAttribute, boolean optional)
Definition: SimpleUser.java:23
ExternalDynamicScopeService externalDynamicScopeService
Definition: UserInfoRestWebServiceImpl.java:99
RS256
Definition: SignatureAlgorithm.java:26
String getClientSecret()
Definition: Client.java:311
static final String UTF8_STRING_ENCODING
Definition: Util.java:44
Definition: Scope.java:23
AppConfiguration appConfiguration
Definition: UserInfoRestWebServiceImpl.java:105
Client getClient()
Definition: AbstractAuthorizationGrant.java:340
Definition: ScopeType.java:21
void addPairwiseIdentifier(String userInum, PairwiseIdentifier pairwiseIdentifier)
Definition: PairwiseIdentifierService.java:100
ScopeService scopeService
Definition: UserInfoRestWebServiceImpl.java:90
String getClientId()
Definition: AbstractAuthorizationGrant.java:345
String getSubjectType()
Definition: Client.java:699
String decryptSecret(String encryptedClientSecret)
Definition: ClientService.java:390
PairwiseIdentifierService pairwiseIdentifierService
Definition: UserInfoRestWebServiceImpl.java:102
static JSONObject getJSONWebKeys(String jwksUri)
Definition: JwtUtil.java:203
Definition: InvalidJweException.java:12
List< String > getOxAuthClaims()
Definition: Scope.java:96
Definition: CryptoProviderFactory.java:16
Definition: Util.java:40
Definition: AuthenticationMethod.java:7
String getOpenidSubAttribute()
Definition: AppConfiguration.java:509
static AbstractCryptoProvider getCryptoProvider(AppConfiguration configuration)
Definition: CryptoProviderFactory.java:18
PairwiseIdentifier findPairWiseIdentifier(String userInum, String sectorIdentifierUri, String clientId)
Definition: PairwiseIdentifierService.java:59
String getKeyId(JSONWebKeySet jsonWebKeySet, SignatureAlgorithm signatureAlgorithm, Use use)
Definition: AbstractCryptoProvider.java:56
boolean executeExternalUpdateMethods(DynamicScopeExternalContext dynamicScopeContext)
Definition: ExternalDynamicScopeService.java:95

◆ getJwtResponse()

String org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.getJwtResponse ( SignatureAlgorithm  signatureAlgorithm,
User  user,
AuthorizationGrant  authorizationGrant,
Collection< String >  scopes 
) throws Exception
inline
222  {
223  Jwt jwt = new Jwt();
225 
226  // Header
227  jwt.getHeader().setType(JwtType.JWT);
228  jwt.getHeader().setAlgorithm(signatureAlgorithm);
229 
230  String keyId = cryptoProvider.getKeyId(webKeysConfiguration, signatureAlgorithm, Use.SIGNATURE);
231  if (keyId != null) {
232  jwt.getHeader().setKeyId(keyId);
233  }
234 
235  // Claims
236  List<Scope> dynamicScopes = new ArrayList<Scope>();
237  for (String scopeName : scopes) {
238  Scope scope = scopeService.getScopeByDisplayName(scopeName);
240  dynamicScopes.add(scope);
241  continue;
242  }
243 
244  if (scope.getOxAuthClaims() != null) {
245  for (String claimDn : scope.getOxAuthClaims()) {
246  GluuAttribute gluuAttribute = attributeService.getAttributeByDn(claimDn);
247 
248  String claimName = gluuAttribute.getOxAuthClaimName();
249  String ldapName = gluuAttribute.getName();
250  Object attributeValue = null;
251 
252  if (StringUtils.isNotBlank(claimName) && StringUtils.isNotBlank(ldapName)) {
253  if (ldapName.equals("uid")) {
254  attributeValue = user.getUserId();
255  } else {
256  attributeValue = user.getAttribute(gluuAttribute.getName(), true);
257  }
258 
259  if (attributeValue != null) {
260  if (attributeValue instanceof JSONArray) {
261  JSONArray jsonArray = (JSONArray) attributeValue;
262  List<String> values = new ArrayList<String>();
263  for (int i = 0; i < jsonArray.length(); i++) {
264  String value = jsonArray.optString(i);
265  if (value != null) {
266  values.add(value);
267  }
268  }
269  jwt.getClaims().setClaim(claimName, values);
270  } else {
271  String value = attributeValue.toString();
272  jwt.getClaims().setClaim(claimName, value);
273  }
274  }
275  }
276  }
277  }
278  }
279 
280  if (authorizationGrant.getJwtAuthorizationRequest() != null
281  && authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember() != null) {
282  for (Claim claim : authorizationGrant.getJwtAuthorizationRequest().getUserInfoMember().getClaims()) {
283  boolean optional = true; // ClaimValueType.OPTIONAL.equals(claim.getClaimValue().getClaimValueType());
284  GluuAttribute gluuAttribute = attributeService.getByClaimName(claim.getName());
285 
286  if (gluuAttribute != null) {
287  Client client = authorizationGrant.getClient();
288 
289  if (validateRequesteClaim(gluuAttribute, client.getClaims(), scopes)) {
290  String ldapClaimName = gluuAttribute.getName();
291  Object attribute = user.getAttribute(ldapClaimName, optional);
292  if (attribute != null) {
293  if (attribute instanceof JSONArray) {
294  JSONArray jsonArray = (JSONArray) attribute;
295  List<String> values = new ArrayList<String>();
296  for (int i = 0; i < jsonArray.length(); i++) {
297  String value = jsonArray.optString(i);
298  if (value != null) {
299  values.add(value);
300  }
301  }
302  jwt.getClaims().setClaim(claim.getName(), values);
303  } else {
304  String value = attribute.toString();
305  jwt.getClaims().setClaim(claim.getName(), value);
306  }
307  }
308  }
309  }
310  }
311  }
312 
313  // Check for Subject Identifier Type
314  if (authorizationGrant.getClient().getSubjectType() != null &&
315  SubjectType.fromString(authorizationGrant.getClient().getSubjectType()).equals(SubjectType.PAIRWISE)) {
316  String sectorIdentifierUri = null;
317  if (StringUtils.isNotBlank(authorizationGrant.getClient().getSectorIdentifierUri())) {
318  sectorIdentifierUri = authorizationGrant.getClient().getSectorIdentifierUri();
319  } else {
320  sectorIdentifierUri = authorizationGrant.getClient().getRedirectUris()[0];
321  }
322 
323  String userInum = authorizationGrant.getUser().getAttribute("inum");
324  String clientId = authorizationGrant.getClientId();
326  userInum, sectorIdentifierUri, clientId);
327  if (pairwiseIdentifier == null) {
328  pairwiseIdentifier = new PairwiseIdentifier(sectorIdentifierUri, clientId);
329  pairwiseIdentifier.setId(UUID.randomUUID().toString());
330  pairwiseIdentifier.setDn(pairwiseIdentifierService.getDnForPairwiseIdentifier(
331  pairwiseIdentifier.getId(),
332  userInum));
333  pairwiseIdentifierService.addPairwiseIdentifier(userInum, pairwiseIdentifier);
334  }
335  jwt.getClaims().setSubjectIdentifier(pairwiseIdentifier.getId());
336  } else {
337  String openidSubAttribute = appConfiguration.getOpenidSubAttribute();
338  jwt.getClaims().setSubjectIdentifier(authorizationGrant.getUser().getAttribute(openidSubAttribute));
339  }
340 
341  // If signed, the UserInfo Response SHOULD contain the Claims iss (issuer) and aud (audience) as members. The iss value should be the OP's Issuer Identifier URL. The aud value should be or include the RP's Client ID value.
343  jwt.getClaims().setAudience(authorizationGrant.getClientId());
344 
345  if ((dynamicScopes.size() > 0) && externalDynamicScopeService.isEnabled()) {
346  final UnmodifiableAuthorizationGrant unmodifiableAuthorizationGrant = new UnmodifiableAuthorizationGrant(authorizationGrant);
347  DynamicScopeExternalContext dynamicScopeContext = new DynamicScopeExternalContext(dynamicScopes, jwt, unmodifiableAuthorizationGrant);
349  }
350 
351  // Signature
352  String sharedSecret = clientService.decryptSecret(authorizationGrant.getClient().getClientSecret());
353  String signature = cryptoProvider.sign(jwt.getSigningInput(), jwt.getHeader().getKeyId(), sharedSecret, signatureAlgorithm);
354  jwt.setEncodedSignature(signature);
355 
356  return jwt.toString();
357  }
abstract String sign(String signingInput, String keyId, String sharedSecret, SignatureAlgorithm signatureAlgorithm)
List< Claim > getClaims()
Definition: UserInfoMember.java:61
String getDnForPairwiseIdentifier(String oxId, String userInum)
Definition: PairwiseIdentifierService.java:107
Definition: AbstractCryptoProvider.java:44
String getSigningInput()
Definition: Jwt.java:46
UserInfoMember getUserInfoMember()
Definition: JwtAuthorizationRequest.java:420
String [] getRedirectUris()
Definition: Client.java:387
PAIRWISE
Definition: SubjectType.java:14
GluuAttribute getAttributeByDn(String dn)
Definition: AttributeService.java:47
boolean validateRequesteClaim(GluuAttribute gluuAttribute, String[] clientAllowedClaims, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:669
AttributeService attributeService
Definition: UserInfoRestWebServiceImpl.java:93
void setId(String id)
Definition: PairwiseIdentifier.java:39
User getUser()
Definition: AbstractAuthorizationGrant.java:233
ClientService clientService
Definition: UserInfoRestWebServiceImpl.java:87
JwtClaims getClaims()
Definition: JsonWebResponse.java:41
JwtAuthorizationRequest getJwtAuthorizationRequest()
Definition: AbstractAuthorizationGrant.java:382
String getId()
Definition: PairwiseIdentifier.java:35
String toString()
Definition: Jwt.java:88
Definition: UnmodifiableAuthorizationGrant.java:33
GluuAttribute getByClaimName(String name)
Definition: AttributeService.java:73
org.xdi.oxauth.model.common.Scope getScopeByDisplayName(String displayName)
Definition: ScopeService.java:119
ScopeType getScopeType()
Definition: Scope.java:88
Definition: SubjectType.java:12
void setSubjectIdentifier(String subjectIdentifier)
Definition: JwtClaims.java:127
String getSectorIdentifierUri()
Definition: Client.java:680
static SubjectType fromString(String param)
Definition: SubjectType.java:30
JwtHeader setKeyId(String keyId)
Definition: JwtHeader.java:96
Definition: PairwiseIdentifier.java:16
DYNAMIC
Definition: ScopeType.java:56
String [] getClaims()
Definition: Client.java:1042
JwtHeader setAlgorithm(SignatureAlgorithm algorithm)
Definition: JwtHeader.java:63
Object getAttribute(String userAttribute, boolean optional)
Definition: SimpleUser.java:23
ExternalDynamicScopeService externalDynamicScopeService
Definition: UserInfoRestWebServiceImpl.java:99
String getClientSecret()
Definition: Client.java:311
JwtHeader setType(JwtType type)
Definition: JwtHeader.java:44
Definition: Scope.java:23
Definition: Jwt.java:24
void setClaim(String key, String value)
Definition: JwtClaimSet.java:210
void setEncodedSignature(String encodedSignature)
Definition: Jwt.java:42
String getKeyId()
Definition: JwtHeader.java:86
AppConfiguration appConfiguration
Definition: UserInfoRestWebServiceImpl.java:105
Client getClient()
Definition: AbstractAuthorizationGrant.java:340
Definition: ScopeType.java:21
void setIssuer(String issuer)
Definition: JwtClaims.java:77
void addPairwiseIdentifier(String userInum, PairwiseIdentifier pairwiseIdentifier)
Definition: PairwiseIdentifierService.java:100
ScopeService scopeService
Definition: UserInfoRestWebServiceImpl.java:90
String getIssuer()
Definition: AppConfiguration.java:274
JwtHeader getHeader()
Definition: JsonWebResponse.java:33
void setAudience(String audience)
Definition: JwtClaims.java:102
String getClientId()
Definition: AbstractAuthorizationGrant.java:345
String getSubjectType()
Definition: Client.java:699
WebKeysConfiguration webKeysConfiguration
Definition: UserInfoRestWebServiceImpl.java:108
String decryptSecret(String encryptedClientSecret)
Definition: ClientService.java:390
PairwiseIdentifierService pairwiseIdentifierService
Definition: UserInfoRestWebServiceImpl.java:102
List< String > getOxAuthClaims()
Definition: Scope.java:96
Definition: CryptoProviderFactory.java:16
Definition: AuthenticationMethod.java:7
String getOpenidSubAttribute()
Definition: AppConfiguration.java:509
static AbstractCryptoProvider getCryptoProvider(AppConfiguration configuration)
Definition: CryptoProviderFactory.java:18
PairwiseIdentifier findPairWiseIdentifier(String userInum, String sectorIdentifierUri, String clientId)
Definition: PairwiseIdentifierService.java:59
String getKeyId(JSONWebKeySet jsonWebKeySet, SignatureAlgorithm signatureAlgorithm, Use use)
Definition: AbstractCryptoProvider.java:56
boolean executeExternalUpdateMethods(DynamicScopeExternalContext dynamicScopeContext)
Definition: ExternalDynamicScopeService.java:95

◆ requestUserInfo()

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.requestUserInfo ( String  accessToken,
String  authorization,
HttpServletRequest  request,
SecurityContext  securityContext 
)
inline
120  {
121  if (authorization != null && !authorization.isEmpty() && authorization.startsWith("Bearer ")) {
122  accessToken = authorization.substring(7);
123  }
124  log.debug("Attempting to request User Info, Access token = {}, Is Secure = {}",
125  accessToken, securityContext.isSecure());
126  Response.ResponseBuilder builder = Response.ok();
127 
128  OAuth2AuditLog oAuth2AuditLog = new OAuth2AuditLog(ServerUtil.getIpAddress(request), Action.USER_INFO);
129 
130  try {
131  if (!UserInfoParamsValidator.validateParams(accessToken)) {
132  builder = Response.status(400);
133  builder.entity(errorResponseFactory.getErrorAsJson(UserInfoErrorResponseType.INVALID_REQUEST));
134  } else {
136 
137  if (authorizationGrant == null) {
138  log.trace("Failed to find authorization grant by access_token: " + accessToken);
139  return response(400, UserInfoErrorResponseType.INVALID_TOKEN);
140  }
141 
142  final AbstractToken accessTokenObject = authorizationGrant.getAccessToken(accessToken);
143  if (accessTokenObject == null || !accessTokenObject.isValid()) {
144  log.trace("Invalid access token object, access_token: {}, isNull: {}, isValid: {}", accessToken, accessTokenObject == null, accessTokenObject.isValid());
145  return response(400, UserInfoErrorResponseType.INVALID_TOKEN);
146  }
147 
149  builder = Response.status(403);
150  builder.entity(errorResponseFactory.getErrorAsJson(UserInfoErrorResponseType.INSUFFICIENT_SCOPE));
152  && !authorizationGrant.getScopes().contains(DefaultScope.OPEN_ID.toString())
153  && !authorizationGrant.getScopes().contains(DefaultScope.PROFILE.toString())) {
154  builder = Response.status(403);
155  builder.entity(errorResponseFactory.getErrorAsJson(UserInfoErrorResponseType.INSUFFICIENT_SCOPE));
156  oAuth2AuditLog.updateOAuth2AuditLog(authorizationGrant, false);
158  && !authorizationGrant.getScopes().contains(DefaultScope.OPEN_ID.toString())) {
159  builder = Response.status(403);
160  builder.entity(errorResponseFactory.getErrorAsJson(UserInfoErrorResponseType.INSUFFICIENT_SCOPE));
161  oAuth2AuditLog.updateOAuth2AuditLog(authorizationGrant, false);
162  }
163  else {
164  oAuth2AuditLog.updateOAuth2AuditLog(authorizationGrant, true);
165  CacheControl cacheControl = new CacheControl();
166  cacheControl.setPrivate(true);
167  cacheControl.setNoTransform(false);
168  cacheControl.setNoStore(true);
169  builder.cacheControl(cacheControl);
170  builder.header("Pragma", "no-cache");
171 
172  User currentUser = authorizationGrant.getUser();
173  try {
174  currentUser = userService.getUserByDn(authorizationGrant.getUserDn());
175  } catch (EntryPersistenceException ex) {
176  log.warn("Failed to reload user entry: '{}'", authorizationGrant.getUserDn());
177  }
178 
179  if (authorizationGrant.getClient() != null
180  && authorizationGrant.getClient().getUserInfoEncryptedResponseAlg() != null
181  && authorizationGrant.getClient().getUserInfoEncryptedResponseEnc() != null) {
182  KeyEncryptionAlgorithm keyEncryptionAlgorithm = KeyEncryptionAlgorithm.fromName(authorizationGrant.getClient().getUserInfoEncryptedResponseAlg());
183  BlockEncryptionAlgorithm blockEncryptionAlgorithm = BlockEncryptionAlgorithm.fromName(authorizationGrant.getClient().getUserInfoEncryptedResponseEnc());
184  builder.type("application/jwt");
185  builder.entity(getJweResponse(
186  keyEncryptionAlgorithm,
187  blockEncryptionAlgorithm,
188  currentUser,
189  authorizationGrant,
190  authorizationGrant.getScopes()));
191  } else if (authorizationGrant.getClient() != null
192  && authorizationGrant.getClient().getUserInfoSignedResponseAlg() != null) {
194  builder.type("application/jwt");
195  builder.entity(getJwtResponse(algorithm,
196  currentUser,
197  authorizationGrant,
198  authorizationGrant.getScopes()));
199  } else {
200  builder.type((MediaType.APPLICATION_JSON + ";charset=UTF-8"));
201  builder.entity(getJSonResponse(currentUser,
202  authorizationGrant,
203  authorizationGrant.getScopes()));
204  }
205  }
206  }
207  } catch (Exception e) {
208  log.error(e.getMessage(), e);
209  builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); // 500
210  } finally {
211  applicationAuditLogger.sendMessage(oAuth2AuditLog);
212  }
213 
214  return builder.build();
215  }
Definition: DefaultScope.java:12
String getErrorAsJson(IErrorType p_type)
Definition: ErrorResponseFactory.java:86
void sendMessage(OAuth2AuditLog oAuth2AuditLog)
Definition: ApplicationAuditLogger.java:78
Boolean getOpenidScopeBackwardCompatibility()
Definition: AppConfiguration.java:1393
Response response(int status, UserInfoErrorResponseType errorResponseType)
Definition: UserInfoRestWebServiceImpl.java:217
User getUser()
Definition: AbstractAuthorizationGrant.java:233
String getJweResponse(KeyEncryptionAlgorithm keyEncryptionAlgorithm, BlockEncryptionAlgorithm blockEncryptionAlgorithm, User user, AuthorizationGrant authorizationGrant, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:359
String getUserInfoEncryptedResponseEnc()
Definition: Client.java:807
AuthorizationGrantList authorizationGrantList
Definition: UserInfoRestWebServiceImpl.java:84
String getUserInfoSignedResponseAlg()
Definition: Client.java:771
Definition: SignatureAlgorithm.java:20
static String getIpAddress(HttpServletRequest httpRequest)
Definition: ServerUtil.java:188
UserService userService
Definition: UserInfoRestWebServiceImpl.java:96
Logger log
Definition: UserInfoRestWebServiceImpl.java:75
Definition: AuthorizationGrant.java:49
Definition: OAuth2AuditLog.java:10
CLIENT_CREDENTIALS
Definition: AuthorizationGrantType.java:50
USER_INFO
Definition: Action.java:9
OPEN_ID
Definition: DefaultScope.java:13
String getJSonResponse(User user, AuthorizationGrant authorizationGrant, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:515
Definition: ServerUtil.java:50
PROFILE
Definition: DefaultScope.java:14
AppConfiguration appConfiguration
Definition: UserInfoRestWebServiceImpl.java:105
Client getClient()
Definition: AbstractAuthorizationGrant.java:340
Set< String > getScopes()
Definition: AbstractAuthorizationGrant.java:377
Definition: AuthorizationGrantType.java:19
AbstractToken getAccessToken(String tokenCode)
Definition: AbstractAuthorizationGrant.java:445
void updateOAuth2AuditLog(AuthorizationGrant authorizationGrant, boolean success)
Definition: OAuth2AuditLog.java:32
boolean isValid()
Definition: AbstractToken.java:103
Definition: User.java:23
Definition: AbstractToken.java:37
ApplicationAuditLogger applicationAuditLogger
Definition: UserInfoRestWebServiceImpl.java:78
String getJwtResponse(SignatureAlgorithm signatureAlgorithm, User user, AuthorizationGrant authorizationGrant, Collection< String > scopes)
Definition: UserInfoRestWebServiceImpl.java:221
String getUserDn()
Definition: AbstractAuthorizationGrant.java:314
String getUserInfoEncryptedResponseAlg()
Definition: Client.java:789
AuthorizationGrant getAuthorizationGrantByAccessToken(String accessToken)
Definition: AuthorizationGrantList.java:166
Definition: Action.java:3
User getUserByDn(String dn, String... returnAttributes)
Definition: UserService.java:66
static List< SignatureAlgorithm > fromString(String[] params)
Definition: SignatureAlgorithm.java:83
AuthorizationGrantType getAuthorizationGrantType()
Definition: AbstractAuthorizationGrant.java:328
ErrorResponseFactory errorResponseFactory
Definition: UserInfoRestWebServiceImpl.java:81

◆ requestUserInfoGet() [1/2]

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebService.requestUserInfoGet ( @QueryParam("access_token") @ApiParam(value="OAuth 2.0 Access Token.", required=true) String  accessToken,
@HeaderParam("Authorization") String  authorization,
@Context HttpServletRequest  request,
@Context SecurityContext  securityContext 
)
inherited

◆ requestUserInfoGet() [2/2]

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.requestUserInfoGet ( String  accessToken,
String  authorization,
HttpServletRequest  request,
SecurityContext  securityContext 
)
inline
111  {
112  return requestUserInfo(accessToken, authorization, request, securityContext);
113  }
Response requestUserInfo(String accessToken, String authorization, HttpServletRequest request, SecurityContext securityContext)
Definition: UserInfoRestWebServiceImpl.java:120

◆ requestUserInfoPost() [1/2]

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebService.requestUserInfoPost ( @FormParam("access_token") @ApiParam(value="OAuth 2.0 Access Token.", required=true) String  accessToken,
@HeaderParam("Authorization") String  authorization,
@Context HttpServletRequest  request,
@Context SecurityContext  securityContext 
)
inherited

◆ requestUserInfoPost() [2/2]

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.requestUserInfoPost ( String  accessToken,
String  authorization,
HttpServletRequest  request,
SecurityContext  securityContext 
)
inline
116  {
117  return requestUserInfo(accessToken, authorization, request, securityContext);
118  }
Response requestUserInfo(String accessToken, String authorization, HttpServletRequest request, SecurityContext securityContext)
Definition: UserInfoRestWebServiceImpl.java:120

◆ response()

Response org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.response ( int  status,
UserInfoErrorResponseType  errorResponseType 
)
inlineprivate
217  {
218  return Response.status(status).entity(errorResponseFactory.getErrorAsJson(errorResponseType)).build();
219  }
String getErrorAsJson(IErrorType p_type)
Definition: ErrorResponseFactory.java:86
ErrorResponseFactory errorResponseFactory
Definition: UserInfoRestWebServiceImpl.java:81

◆ validateRequesteClaim()

boolean org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.validateRequesteClaim ( GluuAttribute  gluuAttribute,
String []  clientAllowedClaims,
Collection< String >  scopes 
)
inline
669  {
670  if (gluuAttribute != null) {
671  if (clientAllowedClaims != null) {
672  for (int i = 0; i < clientAllowedClaims.length; i++) {
673  if (gluuAttribute.getDn().equals(clientAllowedClaims[i])) {
674  return true;
675  }
676  }
677  }
678 
679  for (String scopeName : scopes) {
681 
682  if (scope != null && scope.getOxAuthClaims() != null) {
683  for (String claimDn : scope.getOxAuthClaims()) {
684  if (gluuAttribute.getDisplayName().equals(attributeService.getAttributeByDn(claimDn).getDisplayName())) {
685  return true;
686  }
687  }
688  }
689  }
690  }
691 
692  return false;
693  }
GluuAttribute getAttributeByDn(String dn)
Definition: AttributeService.java:47
AttributeService attributeService
Definition: UserInfoRestWebServiceImpl.java:93
org.xdi.oxauth.model.common.Scope getScopeByDisplayName(String displayName)
Definition: ScopeService.java:119
Definition: Scope.java:23
ScopeService scopeService
Definition: UserInfoRestWebServiceImpl.java:90
Definition: AuthenticationMethod.java:7

メンバ詳解

◆ appConfiguration

AppConfiguration org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.appConfiguration
private

◆ applicationAuditLogger

ApplicationAuditLogger org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.applicationAuditLogger
private

◆ attributeService

AttributeService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.attributeService
private

◆ authorizationGrantList

AuthorizationGrantList org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.authorizationGrantList
private

◆ clientService

ClientService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.clientService
private

◆ errorResponseFactory

ErrorResponseFactory org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.errorResponseFactory
private

◆ externalDynamicScopeService

ExternalDynamicScopeService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.externalDynamicScopeService
private

◆ log

Logger org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.log
private

◆ pairwiseIdentifierService

PairwiseIdentifierService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.pairwiseIdentifierService
private

◆ scopeService

ScopeService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.scopeService
private

◆ userService

UserService org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.userService
private

◆ webKeysConfiguration

WebKeysConfiguration org.xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl.webKeysConfiguration
private

このクラス詳解は次のファイルから抽出されました: