private ResourceResponse getResourceResponse( Context context, String clientId, Iterable<JsonValue> tokens) throws NotFoundException, InvalidClientException, ServerException, InternalServerErrorException { String realm = getAttributeValue(tokens.iterator().next(), REALM.getOAuthField()); OAuth2ProviderSettings oAuth2ProviderSettings = oAuth2ProviderSettingsFactory.get(context); ClientRegistration clientRegistration = clientRegistrationStore.get(clientId, realm, context); Map<String, String> scopeDescriptions = clientRegistration.getScopeDescriptions(getLocale(context)); Map<String, String> scopes = new HashMap<>(); for (JsonValue token : tokens) { for (String scope : token.get(SCOPE.getOAuthField()).asSet(String.class)) { if (scopeDescriptions.containsKey(scope)) { scopes.put(scope, scopeDescriptions.get(scope)); } else { scopes.put(scope, scope); } } } String displayName = clientRegistration.getDisplayName(getLocale(context)); String expiryDateTime = calculateExpiryDateTime(tokens, oAuth2ProviderSettings); JsonValue content = json( object( field("_id", clientId), field("name", displayName), field("scopes", scopes), field("expiryDateTime", expiryDateTime))); return Responses.newResourceResponse( clientId, String.valueOf(content.getObject().hashCode()), content); }
@Override void processFilter(String name, String value) { if (KIND.equals(name)) { kind = BeanKind.from(value); } else if (BEAN_CLASS.equals(name)) { beanClass = value; } else if (BEAN_TYPE.equals(name)) { beanType = value; } else if (QUALIFIER.equals(name)) { qualifier = value; } else if (SCOPE.equals(name)) { scope = value; } else if (BDA.equals(name)) { bda = value; } else if (IS_ALTERNATIVE.equals(name)) { isAlternative = Boolean.valueOf(value); } else if (STEREOTYPES.equals(name)) { stereotypes = value; } }