Class SingleSignOn
java.lang.Object
org.brapi.schematools.core.authorization.oauth.SingleSignOn
- All Implemented Interfaces:
AuthorizationProvider
Handles OAuth login and logout.
-
Method Summary
Modifier and TypeMethodDescriptionGets a response containing the Authorisation Header whenAuthorizationProvider.required()istrue, otherwise an empty responsegetToken()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.loginWithClientId(String clientSecret) Login with clientIdloginWithPassword(String password) Login the current user and passwordlogout()Logout the current userbooleanrequired()Determines if authorisation is required no not
-
Method Details
-
required
public boolean required()Description copied from interface:AuthorizationProviderDetermines if authorisation is required no not- Specified by:
requiredin interfaceAuthorizationProvider- Returns:
trueif Authorisation is required orfalseif not.
-
getAuthorization
Description copied from interface:AuthorizationProviderGets a response containing the Authorisation Header whenAuthorizationProvider.required()istrue, otherwise an empty response- Specified by:
getAuthorizationin interfaceAuthorizationProvider- Returns:
- a response containing the Authorisation Header.
-
loginWithPassword
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
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
Logout the current user- Returns:
- An empty response or failure explaining why logout has failed.
-
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.
-