java.lang.Object
org.brapi.schematools.core.authorization.oauth.SingleSignOn
All Implemented Interfaces:
AuthorizationProvider

public class SingleSignOn extends Object implements AuthorizationProvider
Handles OAuth login and logout.
  • Method Details

    • required

      public boolean required()
      Description copied from interface: AuthorizationProvider
      Determines if authorisation is required no not
      Specified by:
      required in interface AuthorizationProvider
      Returns:
      true if Authorisation is required or false if not.
    • getAuthorization

      public Response<String> getAuthorization()
      Description copied from interface: AuthorizationProvider
      Gets a response containing the Authorisation Header when AuthorizationProvider.required() is true, otherwise an empty response
      Specified by:
      getAuthorization in interface AuthorizationProvider
      Returns:
      a response containing the Authorisation Header.
    • loginWithPassword

      public Response<OpenIDToken> loginWithPassword(String password)
      Login the current user and password
      Parameters:
      password - the current user's password
      Returns:
      A response containing a valid token or failure explaining why login has failed.
    • loginWithClientId

      public Response<OpenIDToken> loginWithClientId(String clientSecret)
      Login with clientId
      Parameters:
      clientSecret - the clientSecret for the provided clientId
      Returns:
      A response containing a valid token or failure explaining why login has failed.
    • logout

      public Response<Void> logout()
      Logout the current user
      Returns:
      An empty response or failure explaining why logout has failed.
    • getToken

      public Response<OpenIDToken> getToken()
      Gets the current token if not expired or fetches a new one, or fails with a message explaining the reason why a valid token can not be obtained.
      Returns:
      A response containing a valid token or failure.