Class ClientRegistration
- java.lang.Object
-
- org.forgerock.openig.filter.oauth2.client.ClientRegistration
-
public final class ClientRegistration extends Object
A configuration for an OpenID Connect Provider. Options:{ "clientId" : expression [REQUIRED] "issuer" : String / Issuer [REQUIRED - the issuer name, or its inlined declaration. ] "scopes" : [ expressions ] [OPTIONAL - specific scopes to use for this client registration. ] "registrationHandler" : handler [OPTIONAL - handler to use during client registration to access endpoints that do not require client authentication. As such, this handler should not be configured with a client authentication filter (1). By default this uses the 'ClientHandler' provided in heap. ] "authenticatedRegistrationHandler": handler [OPTIONAL - handler to use during client registration to access endpoints that do require client authentication for the 'clientId'. This handler should be configured with a client authentication filter (1). By default the 'registrationHandler' is reused as-is, with no authentication filter. ] }
- See
ClientSecretBasicAuthenticationFilterHeaplet
,ClientSecretPostAuthenticationFilterHeaplet
,PrivateKeyJwtClientAuthenticationFilterHeaplet
, andEncryptedPrivateKeyJwtClientAuthenticationFilterHeaplet
{ "name": "MyClientRegistration", "type": "ClientRegistration", "config": { "clientId": "OpenIG", "scopes": [ "openid", "profile" ], "issuer": "OpenAM", "authenticatedRegistrationHandler": "FRClientHandlerWithClientSecretBASICFilter" } }
}{ "name": "MyClientRegistration", "type": "ClientRegistration", "config": { "clientId": "OpenIG", "scopes": [ "openid", "profile" ], "issuer": { "name": "myIssuer", "type": "Issuer", "config": { "wellKnownEndpoint": "http://server.com:8090/openam/oauth2/.well-known/openid-configuration" } }, "authenticatedRegistrationHandler": "FRClientHandlerWithClientSecretPOSTFilter" } }
{ "name": "MyClientRegistration", "type": "ClientRegistration", "config": { "clientId": "OpenIG", "scopes": [ "openid", "profile" ], "issuer": "OpenAM", "authenticatedRegistrationHandler": { "type": "Chain", "config": { "filters": [ { "type": "ClientSecretBasicAuthenticationFilter", "config": { "clientId": "OpenIG", "clientSecretId": "client.secret.id", "secretsProvider" : "SystemAndEnvSecretStore-1" } } ], "handler": "ForgeRockClientHandler" } } } }
- tokenEndpointAuthMethod: previously, the indicator of the type of client authentication to apply - with default of 'client_secret_basic'.
- clientSecretId: previously, a label of a
Purpose
required to read aGenericSecret
required to authenticate the client when using authentication method 'client_secret_basic' or 'client_secret_post'. - privateKeyJwtSecretId: previously the label of a
Purpose
identifying the secret used with 'private_key_jwt' authentication. - tokenEndpointAuthSigningAlg: previously the signing algorithm used with 'private_key_jwt' authentication - with default of RS256.
- claims: previously, claims used in 'private_key_jwt' authentication. The "aud" claim would default to the URL of the Authorization Server's Token endpoint.
- jwtExpirationTimeout: previously, the JWT expiration duration when using 'private_key_jwt' authentication - with a default of 1 minute.
- See
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClientRegistration.Heaplet
Creates and initializes a Client Registration object in a heap environment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<JsonValue,OAuth2ErrorException>
getAccessToken(Context context, String code, String callbackUri)
Exchanges the authorization code for an access token and optional ID token, and then update the session state.String
getClientId()
Returns the client ID of this client registration.Issuer
getIssuer()
Returns theIssuer
for this client registration.String
getName()
Returns the name of this client registration.List<String>
getScopes()
Returns the list of scopes of this client registration.Promise<JsonValue,OAuth2ErrorException>
getUserInfo(Context context, org.forgerock.openig.filter.oauth2.client.OAuth2Session session)
Returns a Promise completed either with the json value of the user info obtained from the authorization server if the response from the authorization server has a status code of 200, or with an exception, meaning the access token may have expired.Promise<JsonValue,OAuth2ErrorException>
refreshAccessToken(Context context, org.forgerock.openig.filter.oauth2.client.OAuth2Session session)
Refreshes the actual access token, making a refresh request to the token end-point.
-
-
-
Constructor Detail
-
ClientRegistration
public ClientRegistration(String clientId, String name, List<String> scopes, Issuer issuer, Handler registrationHandler, Handler authenticatedRegistrationHandler)
Creates a Client Registration.- Parameters:
clientId
- The ID of this client registration.name
- The name of this client registration. Can benull
. If it isnull
, the clientId is used.scopes
- The list of scopes for this client registration, notnull
.issuer
- TheIssuer
of this Client, notnull
.registrationHandler
- The handler used to send request to the AS.authenticatedRegistrationHandler
- The handler used to send request to the AS that require client authentication.
-
-
Method Detail
-
getName
public String getName()
Returns the name of this client registration.- Returns:
- the name of this client registration.
-
getAccessToken
public Promise<JsonValue,OAuth2ErrorException> getAccessToken(Context context, String code, String callbackUri)
Exchanges the authorization code for an access token and optional ID token, and then update the session state.- Parameters:
context
- The current context.code
- The authorization code.callbackUri
- The callback URI.- Returns:
- A promise completed with either the json content of the response if status return code of the response is 200 OK or with an OAuth2ErrorException in case of errors.
-
getClientId
public String getClientId()
Returns the client ID of this client registration.- Returns:
- the client ID.
-
getIssuer
public Issuer getIssuer()
Returns theIssuer
for this client registration.- Returns:
- the
Issuer
for this client registration.
-
refreshAccessToken
public Promise<JsonValue,OAuth2ErrorException> refreshAccessToken(Context context, org.forgerock.openig.filter.oauth2.client.OAuth2Session session)
Refreshes the actual access token, making a refresh request to the token end-point.- Parameters:
context
- The current context.session
- The current session.- Returns:
- A promise completed either with the JSON content of the response if status return code of the response is 200 OK, or with an OAuth2ErrorException if an error occurs when contacting the authorization server or if the returned response status code is different than 200 OK.
-
getScopes
public List<String> getScopes()
Returns the list of scopes of this client registration.- Returns:
- the the list of scopes of this client registration.
-
getUserInfo
public Promise<JsonValue,OAuth2ErrorException> getUserInfo(Context context, org.forgerock.openig.filter.oauth2.client.OAuth2Session session)
Returns a Promise completed either with the json value of the user info obtained from the authorization server if the response from the authorization server has a status code of 200, or with an exception, meaning the access token may have expired.- Parameters:
context
- The current context.session
- The current session to use.- Returns:
- A promise completed either with a JsonValue containing the requested user info, or with an OAuth2ErrorException if an error occurs when contacting the authorization server or if the returned response status code is different than 200 OK (That may signify that the access token has expired).
-
-