Search in sources :

Example 1 with AuthorizationDetailsJSONRepresentation

use of org.keycloak.representations.AuthorizationDetailsJSONRepresentation in project keycloak by keycloak.

the class ClientScopeAuthorizationRequestParser method buildAuthorizationDetailsJSONRepresentation.

/**
 * From a {@link IntermediaryScopeRepresentation}, create an {@link AuthorizationDetails} object that serves as the representation of a
 * ClientScope inside a Rich Authorization Request object
 *
 * @param intermediaryScopeRepresentation the intermediary scope representation to be included into the RAR request object
 * @return see description
 */
private AuthorizationDetails buildAuthorizationDetailsJSONRepresentation(IntermediaryScopeRepresentation intermediaryScopeRepresentation) {
    AuthorizationDetailsJSONRepresentation representation = new AuthorizationDetailsJSONRepresentation();
    representation.setCustomData("access", Collections.singletonList(intermediaryScopeRepresentation.getRequestedScopeString()));
    representation.setType(STATIC_SCOPE_RAR_TYPE);
    if (intermediaryScopeRepresentation.isDynamic() && intermediaryScopeRepresentation.getParameter() != null) {
        representation.setType(DYNAMIC_SCOPE_RAR_TYPE);
        representation.setCustomData("scope_parameter", intermediaryScopeRepresentation.getParameter());
    }
    return new AuthorizationDetails(intermediaryScopeRepresentation.getScope(), AuthorizationRequestSource.SCOPE, representation);
}
Also used : AuthorizationDetailsJSONRepresentation(org.keycloak.representations.AuthorizationDetailsJSONRepresentation) AuthorizationDetails(org.keycloak.rar.AuthorizationDetails)

Aggregations

AuthorizationDetails (org.keycloak.rar.AuthorizationDetails)1 AuthorizationDetailsJSONRepresentation (org.keycloak.representations.AuthorizationDetailsJSONRepresentation)1