Class ClientCredentialsSession.Builder

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

public static class ClientCredentialsSession.Builder extends Object
Builder for ClientCredentialsSession instances. Requires methods to be called in a particular order to establish the session successfully.
  1. setOidcProvider(URI)
  2. setClientIdentifier(String)
  3. setClientSecret(String)
  4. setScope(List)
  5. requestToken()
  6. build()
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setSocialAgent

      public ClientCredentialsSession.Builder setSocialAgent(URI socialAgentId)
      Optional - Sets the social agent associated with the registered client. This is synonymous with the value that the oidc provider will insert into the webid claim of the client's access token.
      Parameters:
      socialAgentId - URI of the social agent responsible for the application
      Returns:
      ClientCredentialsSession.Builder
    • setApplication

      public ClientCredentialsSession.Builder setApplication(URI applicationId)
      Optional - Sets the application identifier associated with the registered client.
      Parameters:
      applicationId - URI of the client application identity
      Returns:
      ClientCredentialsSession.Builder
    • setOidcProvider

      public ClientCredentialsSession.Builder setOidcProvider(URI oidcProviderId) throws SaiAuthenticationException
      Sets the openid connect provider that the client is registered with. Will be checked for validity via .well-known/openid-configuration discovery
      Parameters:
      oidcProviderId - URI of the oidc provider
      Returns:
      ClientCredentialsSession.Builder
      Throws:
      SaiAuthenticationException
    • setClientIdentifier

      public ClientCredentialsSession.Builder setClientIdentifier(String clientIdentifier)
      Sets the client identifier that will be used to authenticate with the oidc provider.
      Parameters:
      clientIdentifier - client identifier that has been registered with the oidc provider
      Returns:
      ClientCredentialsSession.Builder
    • setClientSecret

      public ClientCredentialsSession.Builder setClientSecret(String clientSecret)
      Sets the client secret that will be used to authenticate with the oidc provider.
      Parameters:
      clientSecret - client secret that has been registered with the oidc provider for the clientIdentifier
      Returns:
      ClientCredentialsSession.Builder
    • setScope

      public ClientCredentialsSession.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:
      ClientCredentialsSession.Builder
    • requestToken

      Request tokens from the token endpoint of the openid connect provider
      Returns:
      SolidOidcSession.Builder
      Throws:
      SaiAuthenticationException
    • build

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