Package com.inrupt.client.openid
Class OpenIdSession
java.lang.Object
com.inrupt.client.openid.OpenIdSession
- All Implemented Interfaces:
Session
A session implementation for use with OpenID Connect ID Tokens.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(Authenticator auth, Request request, Set<String> algorithms) Fetch an authentication token from session values.Retrieve an access token for a request from a cache.generateProof
(String jkt, Request request) Generate a proof for a request.getCredential
(URI name, URI uri) Retrieve a credential from this session.getId()
Retrieve the identifier associated with this session.Retrieve the principal associated with this session.static Session
ofClientCredentials
(OpenIdProvider provider, String clientId, String clientSecret, String authMethod, OpenIdConfig config) Create a session using OAuth2 client credentials.static Session
ofClientCredentials
(URI issuer, String clientId, String clientSecret, String authMethod) Create a session using OAuth2 client credentials.static Session
Create a session from an ID token, using the default validation rules.static Session
ofIdToken
(String idToken, OpenIdConfig config) Create a session from an ID token, using a specific validation configuration.void
reset()
Reset the session state, clearing any internal caches.selectThumbprint
(Collection<String> algorithms) Select the thumbprint from a set of candidate algorithms.Retrieve the authentication schemes supported by this session.
-
Field Details
-
ID_TOKEN
-
-
Method Details
-
ofIdToken
Create a session from an ID token, using the default validation rules.- Parameters:
idToken
- the ID Token- Returns:
- the session
-
ofIdToken
Create a session from an ID token, using a specific validation configuration.- Parameters:
idToken
- the ID Tokenconfig
- the validation configuration- Returns:
- the session
-
ofClientCredentials
public static Session ofClientCredentials(URI issuer, String clientId, String clientSecret, String authMethod) Create a session using OAuth2 client credentials.- Parameters:
issuer
- the OpenID Provider URLclientId
- the client id valueclientSecret
- the client secret valueauthMethod
- the authentication mechanism (e.g.client_secret_post
orclient_secret_basic
)- Returns:
- the session
-
ofClientCredentials
public static Session ofClientCredentials(OpenIdProvider provider, String clientId, String clientSecret, String authMethod, OpenIdConfig config) Create a session using OAuth2 client credentials.- Parameters:
provider
- an OpenID Provider instanceclientId
- the client id valueclientSecret
- the client secret valueauthMethod
- the authentication mechanism (e.g.client_secret_post
orclient_secret_basic
)config
- the ID token verification config- Returns:
- the session
-
getId
Description copied from interface:Session
Retrieve the identifier associated with this session. -
getPrincipal
Description copied from interface:Session
Retrieve the principal associated with this session.Typically, this will be a WebID or other globally unique value
- Specified by:
getPrincipal
in interfaceSession
- Returns:
- the principal identifier, if present
-
supportedSchemes
Description copied from interface:Session
Retrieve the authentication schemes supported by this session.- Specified by:
supportedSchemes
in interfaceSession
- Returns:
- the scheme identifiers
-
getCredential
Description copied from interface:Session
Retrieve a credential from this session.- Specified by:
getCredential
in interfaceSession
- Parameters:
name
- the credential nameuri
- the request URI- Returns:
- the credential, if present
-
selectThumbprint
Description copied from interface:Session
Select the thumbprint from a set of candidate algorithms.- Specified by:
selectThumbprint
in interfaceSession
- Parameters:
algorithms
- the supported algorithms- Returns:
- the keypair thumbprint
-
generateProof
Description copied from interface:Session
Generate a proof for a request.- Specified by:
generateProof
in interfaceSession
- Parameters:
jkt
- the JSON Key thumbprint for the proof keyrequest
- the request- Returns:
- a proof token
-
fromCache
Description copied from interface:Session
Retrieve an access token for a request from a cache. -
reset
public void reset()Description copied from interface:Session
Reset the session state, clearing any internal caches. -
authenticate
public CompletionStage<Optional<Credential>> authenticate(Authenticator auth, Request request, Set<String> algorithms) Description copied from interface:Session
Fetch an authentication token from session values.- Specified by:
authenticate
in interfaceSession
- Parameters:
auth
- the authenticator in userequest
- the HTTP requestalgorithms
- the supported DPoP algorithms- Returns:
- the next stage of completion, containing an access token, if present
-