Class SingleSignOn
java.lang.Object
org.brapi.schematools.analyse.authorization.oauth.SingleSignOn
- All Implemented Interfaces:
AuthorizationProvider
Handles OAuth login and logout.
-
Method Summary
Modifier and TypeMethodDescriptionorg.brapi.schematools.core.response.Response<String> Gets a response containing the Authorisation Header isAuthorizationProvider.required()istrue, otherwise an empty responseorg.brapi.schematools.core.response.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.org.brapi.schematools.core.response.Response<OpenIDToken> loginWithClientId(String clientSecret) Login with clientIdorg.brapi.schematools.core.response.Response<OpenIDToken> loginWithPassword(String password) Login the current user and passwordorg.brapi.schematools.core.response.Response<Void> logout()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 isAuthorizationProvider.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
public org.brapi.schematools.core.response.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
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.
-