Package org.keycloak.services.util
Class AuthorizationContextUtil
java.lang.Object
org.keycloak.services.util.AuthorizationContextUtil
- Author:
- Daniel Gozalo
Util class to unify a way to obtain the
AuthorizationRequestContext
.As it can be obtained statically from just the OAuth2 scopes parameter, it can be easily referenced from almost anywhere.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthorizationRequestContext
getAuthorizationRequestContextFromScopes
(KeycloakSession session, String scope) Base function to obtain a bare AuthorizationRequestContext with just OAuth2 Scopesstatic AuthorizationRequestContext
getAuthorizationRequestContextFromScopesWithClient
(KeycloakSession session, String scope) An extension ofgetAuthorizationRequestContextFromScopes(org.keycloak.models.KeycloakSession, java.lang.String)
that appends the current context's clientstatic Stream<AuthorizationDetails>
getAuthorizationRequestsStreamFromScopesWithClient
(KeycloakSession session, String scope) An extension of {@link AuthorizationContextUtil#getAuthorizationRequestContextFromScopesWithClient)} that returns the list as a Streamstatic Stream<ClientScopeModel>
getClientScopesStreamFromAuthorizationRequestContextWithClient
(KeycloakSession session, String scope) Helper method to return a Stream of all theClientScopeModel
in the currentAuthorizationRequestContext
-
Constructor Details
-
AuthorizationContextUtil
public AuthorizationContextUtil()
-
-
Method Details
-
getAuthorizationRequestContextFromScopes
public static AuthorizationRequestContext getAuthorizationRequestContextFromScopes(KeycloakSession session, String scope) Base function to obtain a bare AuthorizationRequestContext with just OAuth2 Scopes- Parameters:
session
-scope
-- Returns:
- an
AuthorizationRequestContext
with scope entries
-
getAuthorizationRequestContextFromScopesWithClient
public static AuthorizationRequestContext getAuthorizationRequestContextFromScopesWithClient(KeycloakSession session, String scope) An extension ofgetAuthorizationRequestContextFromScopes(org.keycloak.models.KeycloakSession, java.lang.String)
that appends the current context's client- Parameters:
session
-scope
-- Returns:
- an
AuthorizationRequestContext
with scope entries and a ClientModel
-
getAuthorizationRequestsStreamFromScopesWithClient
public static Stream<AuthorizationDetails> getAuthorizationRequestsStreamFromScopesWithClient(KeycloakSession session, String scope) An extension of {@link AuthorizationContextUtil#getAuthorizationRequestContextFromScopesWithClient)} that returns the list as a Stream- Parameters:
session
-scope
-- Returns:
- a Stream of
AuthorizationDetails
containing a ClientModel
-
getClientScopesStreamFromAuthorizationRequestContextWithClient
public static Stream<ClientScopeModel> getClientScopesStreamFromAuthorizationRequestContextWithClient(KeycloakSession session, String scope) Helper method to return a Stream of all theClientScopeModel
in the currentAuthorizationRequestContext
- Parameters:
session
-scope
-- Returns:
- see description
-