public class RealmOAuth2ProviderSettings extends Object implements OAuth2ProviderSettings
Constructor and Description |
---|
RealmOAuth2ProviderSettings(OpenAMSettings settings,
String realm,
ResourceSetStore resourceSetStore,
ServiceConfigManagerFactory serviceConfigManagerFactory)
Constructs a new OpenAMOAuth2ProviderSettings.
|
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
additionalDataToReturnFromAuthorizeEndpoint(Map<String,Token> tokens,
OAuth2Request request)
Provided as an extension point to allow the OAuth2 provider to return additional data from an authorization
request.
|
void |
additionalDataToReturnFromTokenEndpoint(AccessToken accessToken,
OAuth2Request request)
Provided as an extension point to allow the OAuth2 provider to return additional data from an access token
request.
|
boolean |
clientsCanSkipConsent()
Whether clients can opt to skip resource owner consent during authorization flows.
|
Map<String,Object> |
evaluateScope(AccessToken accessToken)
Gets the specified access token's information.
|
boolean |
exists()
Checks whether the config exists.
|
long |
getAccessTokenLifetime()
Gets the lifetime an access token will have before it expires.
|
Map<String,AuthenticationMethod> |
getAcrMapping()
Returns a mapping from Authentication Context Class Reference (ACR) values (typically a Level of Assurance
value) to concrete authentication methods.
|
Map<String,ResponseTypeHandler> |
getAllowedResponseTypes()
Gets the response types allowed by the OAuth2 provider.
|
Map<String,String> |
getAMRAuthModuleMappings()
The mappings between amr values and auth module names.
|
long |
getAuthorizationCodeLifetime()
Gets the lifetime an authorization code will have before it expires.
|
boolean |
getClaimsParameterSupported()
Returns whether this provider supports claims requested via 'claims' parameter.
|
String |
getCompletionUrl()
The URL that the user will be sent to on completion of their OAuth 2 login
and consent when using the device code flow.
|
String |
getCreatedTimestampAttributeName()
Gets the created timestamp attribute name.
|
freemarker.template.Template |
getCustomLoginUrlTemplate()
Gets the custom login url template which will create the url to redirect resource owners to for authentication.
|
String |
getDefaultAcrValues()
The default Authentication Context Class Reference (ACR) values to use for authentication if none is specified
in the request.
|
Set<String> |
getDefaultScopes()
Gets the default set of scopes to give a client registering with this provider.
|
int |
getDeviceCodeLifetime()
The lifetime of the device code.
|
int |
getDeviceCodePollInterval()
The polling interval for devices waiting for tokens when using the device code flow.
|
Set<String> |
getEndpointAuthMethodsSupported()
Returns the token_endpoint_auth_methods available for clients to register (and subsequently auth) using.
|
String |
getHashSalt()
Returns the salt to use for hashing sub values upon pairwise requests.
|
org.forgerock.json.JsonValue |
getJWKSet()
Gets the JWK Set for this OAuth2 Authorization /OpenID Provider.
|
String |
getJWKSUri()
Gets the JSON Web Key Set URI.
|
String |
getModifiedTimestampAttributeName()
Gets the modified timestamp attribute name.
|
String |
getOpenIDConnectVersion()
Gets the supported version of the OpenID Connect specification.
|
long |
getOpenIdTokenLifetime()
Gets the lifetime an OpenID token will have before it expires.
|
long |
getRefreshTokenLifetime()
Gets the lifetime an refresh token will have before it expires.
|
Set<String> |
getResourceOwnerAuthenticatedAttributes()
Gets the attributes of the resource owner that are used for authenticating resource owners.
|
ResourceSetStore |
getResourceSetStore()
Returns the ResourceSetStore instance for the realm.
|
KeyPair |
getSigningKeyPair(org.forgerock.json.jose.jws.JwsAlgorithm algorithm)
Gets the signing key pair of the OAuth2 provider.
|
Set<String> |
getSupportedClaims()
Gets the supported claims for this provider.
|
Set<String> |
getSupportedClaimsWithTranslations()
Gets the supported claims for this provider as strings with pipe-separated translations.
|
Set<String> |
getSupportedIDTokenEncryptionAlgorithms()
Gets the algorithms that the OAuth2 provider supports for encryptin OpenID tokens.
|
Set<String> |
getSupportedIDTokenEncryptionMethods()
Gets the encryption methods that the OAuth2 provider supports for encryptin OpenID tokens.
|
Set<String> |
getSupportedIDTokenSigningAlgorithms()
Gets the algorithms that the OAuth2 provider supports for signing OpenID tokens.
|
Set<String> |
getSupportedScopes()
Gets the supported scopes for this provider without translations.
|
Set<String> |
getSupportedScopesWithTranslations()
Gets the supported scopes for this provider.
|
Set<String> |
getSupportedSubjectTypes()
Gets the subject types supported by the OAuth2 provider.
|
String |
getTokenHmacSharedSecret()
Gets the Base64 encoded shared secret used to sign stateless access and refresh tokens.
|
String |
getTokenSigningAlgorithm()
Gets the signing algorithm used when issuing stateless access and refresh tokens.
|
String |
getUserDisplayNameAttribute()
The attribute that can be used to obtain a UI-displayable name for a user's AMIdentity.
|
UserInfoClaims |
getUserInfo(ClientRegistration clientRegistration,
AccessToken token,
OAuth2Request request)
Gets the resource owners information based on an issued access token or request.
|
String |
getVerificationUrl()
The URL that the user will be instructed to visit to complete their OAuth 2 login and consent when using the
device code flow.
|
boolean |
isAlwaysAddClaimsToToken()
Whether to always add claims to id_tokens - non-spec compliant.
|
boolean |
isCodeVerifierRequired()
Whether or not to enforce the Code Verifier Parameter.
|
boolean |
isConsentSaved(ResourceOwner resourceOwner,
String clientId,
Set<String> scope)
Determines whether a resource owner's consent has been saved from a previous authorize request.
|
boolean |
isIdTokenInfoClientAuthenticationEnabled()
Determines whether idtokeninfo endpoint should require client authentication.
|
boolean |
isOpenDynamicClientRegistrationAllowed()
Indicates whether clients may register without providing an access token.
|
boolean |
isOpenIDConnectSSOProviderEnabled()
Whether OpenID Connect ID Tokens are accepted as SSOTokens in this realm or not.
|
boolean |
isRegistrationAccessTokenGenerationEnabled()
Whether to generate access tokens for clients that register without one.
|
boolean |
isSaveConsentEnabled()
Determines if the consent can be saved or not, due to a lack of configuration.
|
boolean |
isStatelessTokensEnabled()
Determines whether access and refresh tokens should be stateless.
|
boolean |
issueRefreshTokens()
Whether the OAuth2 provider should issue refresh tokens when issuing access tokens.
|
boolean |
issueRefreshTokensOnRefreshingToken()
Whether the OAuth2 provider should issue refresh tokens when refreshing access tokens.
|
boolean |
isTokenCompressionEnabled()
Determines whether token compression is enabled for stateless access and refresh tokens.
|
void |
revokeConsent(String userId,
String clientId)
Revokes the resource owner's consent for the granting authorization for the specified client.
|
void |
saveConsent(ResourceOwner resourceOwner,
String clientId,
Set<String> scope)
Saves the resource owner's consent for the granting authorization for the specified client with the specified
scope.
|
boolean |
shouldStoreOpsTokens()
Whether to generate and store an ops token in CTS for this OIDC provider.
|
Set<String> |
validateAccessTokenScope(ClientRegistration clientRegistration,
Set<String> scope,
OAuth2Request request)
Provided as an extension point to allow the OAuth2 provider to customise the scope requested when an access token
is requested.
|
Set<String> |
validateAuthorizationScope(ClientRegistration clientRegistration,
Set<String> scope,
OAuth2Request request)
Provided as an extension point to allow the OAuth2 provider to customise the scope requested when authorization
is requested.
|
Set<String> |
validateRefreshTokenScope(ClientRegistration clientRegistration,
Set<String> requestedScope,
Set<String> tokenScope,
OAuth2Request request)
Provided as an extension point to allow the OAuth2 provider to customise the scope requested when a refresh token
is requested.
|
String |
validateRequestedClaims(String requestedClaims)
Validates that the requested claims are appropriate to be requested by the given client.
|
public RealmOAuth2ProviderSettings(OpenAMSettings settings, String realm, ResourceSetStore resourceSetStore, ServiceConfigManagerFactory serviceConfigManagerFactory)
settings
- OpenAM settings.realm
- The realm.resourceSetStore
- An instance of the ResourceSetStore for the current realm.serviceConfigManagerFactory
- Factory for creating ServiceConfigManager
instances.public boolean isStatelessTokensEnabled() throws ServerException
OAuth2ProviderSettings
isStatelessTokensEnabled
in interface OAuth2ProviderSettings
true
if access and refresh tokens are stateless.ServerException
- If any internal server error occurs.public boolean isIdTokenInfoClientAuthenticationEnabled() throws ServerException
OAuth2ProviderSettings
isIdTokenInfoClientAuthenticationEnabled
in interface OAuth2ProviderSettings
true
if idtokeninfo endpoint requires client authentication.ServerException
- If any internal server error occurs.public String getTokenSigningAlgorithm() throws ServerException
OAuth2ProviderSettings
getTokenSigningAlgorithm
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public boolean isTokenCompressionEnabled() throws ServerException
OAuth2ProviderSettings
isTokenCompressionEnabled
in interface OAuth2ProviderSettings
ServerException
- if an error occurs reading the settings.public String getTokenHmacSharedSecret() throws ServerException
OAuth2ProviderSettings
getTokenHmacSharedSecret
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public Map<String,ResponseTypeHandler> getAllowedResponseTypes() throws UnsupportedResponseTypeException, ServerException
OAuth2ProviderSettings
getAllowedResponseTypes
in interface OAuth2ProviderSettings
UnsupportedResponseTypeException
- If the requested response type is not supported by either the client
or the OAuth2 provider.ServerException
- If any internal server error occurs.public boolean isSaveConsentEnabled()
OAuth2ProviderSettings
isSaveConsentEnabled
in interface OAuth2ProviderSettings
true
if the consent can be saved, false if it is not configured properly.public boolean isConsentSaved(ResourceOwner resourceOwner, String clientId, Set<String> scope)
OAuth2ProviderSettings
isConsentSaved
in interface OAuth2ProviderSettings
resourceOwner
- The resource owner.clientId
- The if of the client making the request.scope
- The requested scope.true
if the resource owner has previously requested that consent should be saved from the
specified client and the exact scope.public Set<String> validateAuthorizationScope(ClientRegistration clientRegistration, Set<String> scope, OAuth2Request request) throws ServerException, InvalidScopeException
OAuth2ProviderSettings
validateAuthorizationScope
in interface OAuth2ProviderSettings
clientRegistration
- The client registration.scope
- The requested scope.ServerException
- If any internal server error occurs.InvalidScopeException
- If the requested scope is invalid, unknown, or malformed.public Set<String> validateAccessTokenScope(ClientRegistration clientRegistration, Set<String> scope, OAuth2Request request) throws ServerException, InvalidScopeException
OAuth2ProviderSettings
validateAccessTokenScope
in interface OAuth2ProviderSettings
clientRegistration
- The client registration.scope
- The requested scope.request
- The OAuth2 request.ServerException
- If any internal server error occurs.InvalidScopeException
- If the requested scope is invalid, unknown, or malformed.public Set<String> validateRefreshTokenScope(ClientRegistration clientRegistration, Set<String> requestedScope, Set<String> tokenScope, OAuth2Request request) throws ServerException, InvalidScopeException
OAuth2ProviderSettings
validateRefreshTokenScope
in interface OAuth2ProviderSettings
clientRegistration
- The client registration.requestedScope
- The requested scope.tokenScope
- The scope from the access token.request
- The OAuth2 request.ServerException
- If any internal server error occurs.InvalidScopeException
- If the requested scope is invalid, unknown, or malformed.public UserInfoClaims getUserInfo(ClientRegistration clientRegistration, AccessToken token, OAuth2Request request) throws ServerException, UnauthorizedClientException, NotFoundException
OAuth2ProviderSettings
getUserInfo
in interface OAuth2ProviderSettings
clientRegistration
- The client registration.token
- The access token.request
- The OAuth2 request.ServerException
- If any internal server error occurs.UnauthorizedClientException
- If the client's authorization fails.NotFoundException
- If the realm does not have an OAuth 2.0 provider service.public Map<String,Object> evaluateScope(AccessToken accessToken) throws ServerException
OAuth2ProviderSettings
evaluateScope
in interface OAuth2ProviderSettings
accessToken
- The access token.Map<String, Object>
of the access token's information.ServerException
- If any internal server error occurs.public Map<String,String> additionalDataToReturnFromAuthorizeEndpoint(Map<String,Token> tokens, OAuth2Request request) throws ServerException
OAuth2ProviderSettings
additionalDataToReturnFromAuthorizeEndpoint
in interface OAuth2ProviderSettings
tokens
- The tokens that will be returned from the authorization call.request
- The OAuth2 request.Map<String, String>
of the additional data to return.ServerException
- If any internal server error occurs.public void additionalDataToReturnFromTokenEndpoint(AccessToken accessToken, OAuth2Request request) throws ServerException, InvalidClientException, NotFoundException
OAuth2ProviderSettings
additionalDataToReturnFromTokenEndpoint
in interface OAuth2ProviderSettings
accessToken
- The access token.request
- The OAuth2 request.ServerException
- If any internal server error occurs.InvalidClientException
- If either the request does not contain the client's id or the client fails to be
authenticated.NotFoundException
- If the realm does not have an OAuth 2.0 provider service.public void saveConsent(ResourceOwner resourceOwner, String clientId, Set<String> scope)
OAuth2ProviderSettings
saveConsent
in interface OAuth2ProviderSettings
resourceOwner
- The resource owner.clientId
- The client id.scope
- The requested scope.public void revokeConsent(String userId, String clientId)
OAuth2ProviderSettings
revokeConsent
in interface OAuth2ProviderSettings
userId
- The user id.clientId
- The client id.public boolean issueRefreshTokens() throws ServerException
OAuth2ProviderSettings
issueRefreshTokens
in interface OAuth2ProviderSettings
true
if refresh tokens should be issued.ServerException
- If any internal server error occurs.public boolean issueRefreshTokensOnRefreshingToken() throws ServerException
OAuth2ProviderSettings
issueRefreshTokensOnRefreshingToken
in interface OAuth2ProviderSettings
true
if refresh tokens should be issued when access tokens are refreshed.ServerException
- If any internal server error occurs.public long getAuthorizationCodeLifetime() throws ServerException
OAuth2ProviderSettings
getAuthorizationCodeLifetime
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public long getAccessTokenLifetime() throws ServerException
OAuth2ProviderSettings
getAccessTokenLifetime
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public long getOpenIdTokenLifetime() throws ServerException
OAuth2ProviderSettings
getOpenIdTokenLifetime
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public long getRefreshTokenLifetime() throws ServerException
OAuth2ProviderSettings
getRefreshTokenLifetime
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public KeyPair getSigningKeyPair(org.forgerock.json.jose.jws.JwsAlgorithm algorithm) throws ServerException
OAuth2ProviderSettings
getSigningKeyPair
in interface OAuth2ProviderSettings
algorithm
- The signing algorithm.ServerException
- If any internal server error occurs.public Set<String> getResourceOwnerAuthenticatedAttributes() throws ServerException
OAuth2ProviderSettings
getResourceOwnerAuthenticatedAttributes
in interface OAuth2ProviderSettings
Set
of resource owner attributes.ServerException
- If any internal server error occurs.public Set<String> getSupportedClaims() throws ServerException
OAuth2ProviderSettings
getSupportedClaims
in interface OAuth2ProviderSettings
Set
of the supported claims.ServerException
- If any internal server error occurs.public Set<String> getSupportedClaimsWithTranslations() throws ServerException
OAuth2ProviderSettings
getSupportedClaimsWithTranslations
in interface OAuth2ProviderSettings
Set
of the supported claims.ServerException
- If any internal server error occurs.public Set<String> getSupportedScopes() throws ServerException
OAuth2ProviderSettings
getSupportedScopes
in interface OAuth2ProviderSettings
Set
of the supported scopes.ServerException
- If any internal server error occurs.public Set<String> getSupportedScopesWithTranslations() throws ServerException
OAuth2ProviderSettings
getSupportedScopesWithTranslations
in interface OAuth2ProviderSettings
Set
of the supported scopes.ServerException
- If any internal server error occurs.public Set<String> getDefaultScopes() throws ServerException
OAuth2ProviderSettings
getDefaultScopes
in interface OAuth2ProviderSettings
Set
of the default scopes.ServerException
- If any internal server error occurs.public Set<String> getSupportedIDTokenSigningAlgorithms() throws ServerException
OAuth2ProviderSettings
getSupportedIDTokenSigningAlgorithms
in interface OAuth2ProviderSettings
Set
of the supported algorithms.ServerException
- If any internal server error occurs.public Set<String> getSupportedIDTokenEncryptionAlgorithms() throws ServerException
OAuth2ProviderSettings
getSupportedIDTokenEncryptionAlgorithms
in interface OAuth2ProviderSettings
Set
of the supported algorithms.ServerException
- If any internal server error occurs.public Set<String> getSupportedIDTokenEncryptionMethods() throws ServerException
OAuth2ProviderSettings
getSupportedIDTokenEncryptionMethods
in interface OAuth2ProviderSettings
Set
of the supported algorithms.ServerException
- If any internal server error occurs.public String getOpenIDConnectVersion()
OAuth2ProviderSettings
getOpenIDConnectVersion
in interface OAuth2ProviderSettings
public org.forgerock.json.JsonValue getJWKSet() throws ServerException
OAuth2ProviderSettings
getJWKSet
in interface OAuth2ProviderSettings
ServerException
public String getCreatedTimestampAttributeName() throws ServerException
OAuth2ProviderSettings
getCreatedTimestampAttributeName
in interface OAuth2ProviderSettings
ServerException
public String getModifiedTimestampAttributeName() throws ServerException
OAuth2ProviderSettings
getModifiedTimestampAttributeName
in interface OAuth2ProviderSettings
ServerException
public Set<String> getSupportedSubjectTypes() throws ServerException
OAuth2ProviderSettings
getSupportedSubjectTypes
in interface OAuth2ProviderSettings
Set
of supported subject types.ServerException
- If any internal server error occurs.public boolean isOpenDynamicClientRegistrationAllowed() throws ServerException
OAuth2ProviderSettings
isOpenDynamicClientRegistrationAllowed
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public boolean isRegistrationAccessTokenGenerationEnabled() throws ServerException
OAuth2ProviderSettings
OAuth2ProviderSettings.isOpenDynamicClientRegistrationAllowed()
is true.isRegistrationAccessTokenGenerationEnabled
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public Map<String,AuthenticationMethod> getAcrMapping() throws ServerException
OAuth2ProviderSettings
getAcrMapping
in interface OAuth2ProviderSettings
ServerException
public String getDefaultAcrValues() throws ServerException
OAuth2ProviderSettings
getDefaultAcrValues
in interface OAuth2ProviderSettings
ServerException
public Map<String,String> getAMRAuthModuleMappings() throws ServerException
OAuth2ProviderSettings
getAMRAuthModuleMappings
in interface OAuth2ProviderSettings
ServerException
public boolean exists()
OAuth2ProviderSettings
exists
in interface OAuth2ProviderSettings
public ResourceSetStore getResourceSetStore()
OAuth2ProviderSettings
getResourceSetStore
in interface OAuth2ProviderSettings
public boolean getClaimsParameterSupported() throws ServerException
OAuth2ProviderSettings
getClaimsParameterSupported
in interface OAuth2ProviderSettings
ServerException
public String validateRequestedClaims(String requestedClaims) throws InvalidRequestException, ServerException
OAuth2ProviderSettings
validateRequestedClaims
in interface OAuth2ProviderSettings
InvalidRequestException
ServerException
public Set<String> getEndpointAuthMethodsSupported()
OAuth2ProviderSettings
getEndpointAuthMethodsSupported
in interface OAuth2ProviderSettings
public boolean isCodeVerifierRequired() throws ServerException
OAuth2ProviderSettings
isCodeVerifierRequired
in interface OAuth2ProviderSettings
ServerException
public String getHashSalt() throws ServerException
OAuth2ProviderSettings
getHashSalt
in interface OAuth2ProviderSettings
ServerException
public boolean isAlwaysAddClaimsToToken() throws ServerException
OAuth2ProviderSettings
isAlwaysAddClaimsToToken
in interface OAuth2ProviderSettings
ServerException
public String getUserDisplayNameAttribute() throws ServerException
OAuth2ProviderSettings
getUserDisplayNameAttribute
in interface OAuth2ProviderSettings
ServerException
public String getJWKSUri() throws ServerException
OAuth2ProviderSettings
getJWKSUri
in interface OAuth2ProviderSettings
ServerException
- If any internal server error occurs.public freemarker.template.Template getCustomLoginUrlTemplate() throws ServerException
OAuth2ProviderSettings
getCustomLoginUrlTemplate
in interface OAuth2ProviderSettings
ServerException
- If the custom login url template setting could not be retrieved.public String getVerificationUrl() throws ServerException
OAuth2ProviderSettings
getVerificationUrl
in interface OAuth2ProviderSettings
ServerException
- If the setting could not be retrieved.public String getCompletionUrl() throws ServerException
OAuth2ProviderSettings
getCompletionUrl
in interface OAuth2ProviderSettings
ServerException
- If the setting could not be retrieved.public int getDeviceCodeLifetime() throws ServerException
OAuth2ProviderSettings
getDeviceCodeLifetime
in interface OAuth2ProviderSettings
ServerException
- If the setting could not be retrieved.public int getDeviceCodePollInterval() throws ServerException
OAuth2ProviderSettings
getDeviceCodePollInterval
in interface OAuth2ProviderSettings
ServerException
- If the setting could not be retrieved.public boolean shouldStoreOpsTokens() throws ServerException
OAuth2ProviderSettings
shouldStoreOpsTokens
in interface OAuth2ProviderSettings
true
if ops tokens should be generated/stored in CTS.ServerException
- If the setting could not be retrieved.public boolean clientsCanSkipConsent() throws ServerException
OAuth2ProviderSettings
clientsCanSkipConsent
in interface OAuth2ProviderSettings
true
if clients are allowed to opt to skip resource owner consent.ServerException
- If the setting could not be retrieved.public boolean isOpenIDConnectSSOProviderEnabled() throws ServerException
OAuth2ProviderSettings
isOpenIDConnectSSOProviderEnabled
in interface OAuth2ProviderSettings
true
if ID Tokens are accepted as SSOTokens in this realm.ServerException
- If the setting could not be retrieved.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.