Class SolidOidcSession.Builder
java.lang.Object
com.janeirodigital.sai.authentication.SolidOidcSession.Builder
- Enclosing class:
- SolidOidcSession
Builder for
SolidOidcSession
instances. Requires methods to be called
in a particular order to establish the Solid-OIDC session successfully.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRedirect
(URI redirect) Adds a redirect URI to use in the authorization requestbuild()
Constructs aSolidOidcSession
once all of the requisite operations have completed successfully.Returns the prepared authorization code request URIPrepares an Authorization Code Request which should be provided to the Social Agent for review in-browserprocessCodeResponse
(URI redirectResponse) Process the response to the authorization code request.Request tokens from the token endpoint of the openid connect providersetApplication
(URI applicationId) Sets the client Application that will use the Solid-OIDC session.setApplication
(URI applicationId, boolean manual) Sets the client application identifier for the Solid-OIDC session, with the ability to lookup the client document and extract additional criteria (redirect uris and scope) for the session automatically (which can be disabled by settingmanual
to false).setHttpClient
(okhttp3.OkHttpClient httpClient) Sets an http client that can be used for various operations when building a Solid OIDC sessionsetPrompt
(com.nimbusds.openid.connect.sdk.Prompt prompt) Sets the prompt to use in the authorization requestsetRedirects
(List<URI> redirects) Sets the list of redirect URIs to use in the authorization requestSets the authorization scopes to use in the authorization requestsetSocialAgent
(URI socialAgentId) Sets the Social Agent that the Solid-OIDC session will be established on behalf of.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setHttpClient
Sets an http client that can be used for various operations when building a Solid OIDC session- Parameters:
httpClient
- HTTP client to use for requests- Returns:
- SolidOidcSession.Builder
-
setSocialAgent
Sets the Social Agent that the Solid-OIDC session will be established on behalf of. Looks up the providedsocialAgentId
and gets an OIDC Issuer(s) trusted by the social agent, then ensures the issuer has a compatible configuration and stores pertinent information about it.- Parameters:
socialAgentId
- URI of the SocialAgent Identity- Returns:
- SolidOidcSession.Builder
- Throws:
SaiAuthenticationException
-
setApplication
Sets the client Application that will use the Solid-OIDC session. Looks up the providedapplicationId
to ensure it is available and well-formed.- Parameters:
applicationId
- URI of the Client Application Identity- Returns:
- SolidOidcSession.Builder
- Throws:
SaiAuthenticationException
-
setApplication
public SolidOidcSession.Builder setApplication(URI applicationId, boolean manual) throws SaiAuthenticationException Sets the client application identifier for the Solid-OIDC session, with the ability to lookup the client document and extract additional criteria (redirect uris and scope) for the session automatically (which can be disabled by settingmanual
to false).- Parameters:
applicationId
- URI of the Client Application Identitymanual
- When true, do not populate and session criteria automatically from client id document- Returns:
- SolidOidcSession.Builder
- Throws:
SaiAuthenticationException
-
setScope
Sets the authorization scopes to use in the authorization request- Parameters:
scopes
- List of scopes to include in request- Returns:
- SolidOidcSession.Builder
-
setPrompt
Sets the prompt to use in the authorization request- Parameters:
prompt
- prompt to use in the authorization request- Returns:
- SolidOidcSession.Builder
-
addRedirect
Adds a redirect URI to use in the authorization request- Parameters:
redirect
- redirection URI to use in the authorization request- Returns:
- SolidOidcSession.Builder
-
setRedirects
Sets the list of redirect URIs to use in the authorization request- Parameters:
redirects
- redirection URIs to use in the authorization request- Returns:
- SolidOidcSession.Builder
-
prepareCodeRequest
Prepares an Authorization Code Request which should be provided to the Social Agent for review in-browser- Returns:
- SolidOidcSession.Builder
-
getCodeRequestUri
Returns the prepared authorization code request URI- Returns:
- URI of the generated authorization code request
-
processCodeResponse
public SolidOidcSession.Builder processCodeResponse(URI redirectResponse) throws SaiAuthenticationException Process the response to the authorization code request. All of the information needed is fully contained in the URI of the response.- Parameters:
redirectResponse
- URI response to the authorization code request- Returns:
- SolidOidcSession.Builder
- Throws:
SaiAuthenticationException
-
requestTokens
Request tokens from the token endpoint of the openid connect provider- Returns:
- SolidOidcSession.Builder
- Throws:
SaiAuthenticationException
-
build
Constructs aSolidOidcSession
once all of the requisite operations have completed successfully.- Returns:
SolidOidcSession
-