Class SolidOidcSession.Builder

java.lang.Object
com.janeirodigital.sai.authentication.SolidOidcSession.Builder
Enclosing class:
SolidOidcSession

public static class SolidOidcSession.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setHttpClient

      public SolidOidcSession.Builder setHttpClient(okhttp3.OkHttpClient httpClient)
      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

      public SolidOidcSession.Builder setSocialAgent(URI socialAgentId) throws SaiAuthenticationException
      Sets the Social Agent that the Solid-OIDC session will be established on behalf of. Looks up the provided socialAgentId 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

      public SolidOidcSession.Builder setApplication(URI applicationId) throws SaiAuthenticationException
      Sets the client Application that will use the Solid-OIDC session. Looks up the provided applicationId 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 setting manual to false).
      Parameters:
      applicationId - URI of the Client Application Identity
      manual - When true, do not populate and session criteria automatically from client id document
      Returns:
      SolidOidcSession.Builder
      Throws:
      SaiAuthenticationException
    • setScope

      public SolidOidcSession.Builder setScope(List<String> scopes)
      Sets the authorization scopes to use in the authorization request
      Parameters:
      scopes - List of scopes to include in request
      Returns:
      SolidOidcSession.Builder
    • setPrompt

      public SolidOidcSession.Builder setPrompt(com.nimbusds.openid.connect.sdk.Prompt prompt)
      Sets the prompt to use in the authorization request
      Parameters:
      prompt - prompt to use in the authorization request
      Returns:
      SolidOidcSession.Builder
    • addRedirect

      public SolidOidcSession.Builder addRedirect(URI redirect)
      Adds a redirect URI to use in the authorization request
      Parameters:
      redirect - redirection URI to use in the authorization request
      Returns:
      SolidOidcSession.Builder
    • setRedirects

      public SolidOidcSession.Builder setRedirects(List<URI> redirects)
      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

      public SolidOidcSession.Builder prepareCodeRequest()
      Prepares an Authorization Code Request which should be provided to the Social Agent for review in-browser
      Returns:
      SolidOidcSession.Builder
    • getCodeRequestUri

      public URI 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

      public SolidOidcSession build()
      Constructs a SolidOidcSession once all of the requisite operations have completed successfully.
      Returns:
      SolidOidcSession