public interface AuthorizationAgent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTH_HEADER |
static java.lang.String |
BACKEND_ID |
static java.lang.String |
CONTENT_TYPE_HEADER |
static java.lang.String |
ENCODING |
static java.lang.String |
TAG |
Modifier and Type | Method and Description |
---|---|
void |
authenticate(Context context,
java.lang.String username,
java.lang.String password,
AuthorizationCallback callback)
Authenticates the current client session against OMCe with the supplied user name and password.
|
void |
authenticateAnonymous(Context context,
AuthorizationCallback callback)
Authenticates the current client session anonymously against OMCe without a username and password.
|
void |
authenticateUsingTokenExchange(Context context,
java.lang.String token,
AuthorizationCallback callback)
Exchange's third party token with OMCe token.
|
void |
authenticateUsingTokenExchange(Context context,
java.lang.String token,
boolean storeToken,
AuthorizationCallback callback)
Exchanges third party token with OMCe token.
|
boolean |
clearSSOTokenExchange(Context context)
Removes token from memory and secure store.
|
void |
fetchCurrentUser(UserRegistrationCallback callback)
Fetches the latest details of the current user from OMCe.
|
java.lang.String |
getAccessToken()
Returns OMCe token.
|
User |
getCurrentUser()
Returns the current logged in user.
|
java.util.Map<java.lang.String,java.lang.String> |
getHTTPHeaders()
Returns the http headers.
|
void |
invokeCustomCodeJSONRequest(GenericCustomCodeClientCallBack genericCustomCodeClientCallBack,
JSONObject data,
java.lang.String functionName,
RestClient.HttpMethod httpMethod)
Calls an OMCe custom API REST endpoint.
|
boolean |
isAuthorized()
Checks if the user is authorized.
|
boolean |
loadSSOTokenExchange(Context context)
Loads OMCe SSO token into memory from secure store.
|
void |
logout(AuthorizationCallback callback)
Deprecated.
use
AuthorizationAgent.logout(Context, AuthorizationCallback) instead.
Logs the current user out of OMCe. |
void |
logout(Context context,
AuthorizationCallback callback)
Logs the current user out of OMCe.
|
void |
refreshToken(RefreshTokenCallback callback)
Validates token, if it is invalid tries to get new token.
|
void |
refreshTokenAsync(RefreshTokenCallback callback)
Refreshes the current token asynchronously.
|
boolean |
validateToken(boolean autoRefresh)
Validates the current token.
|
static final java.lang.String ENCODING
static final java.lang.String TAG
static final java.lang.String AUTH_HEADER
static final java.lang.String BACKEND_ID
static final java.lang.String CONTENT_TYPE_HEADER
void authenticate(Context context, java.lang.String username, java.lang.String password, AuthorizationCallback callback)
context
- Contextusername
- Usernamepassword
- Passwordcallback
- Authorization callbackvoid authenticateAnonymous(Context context, AuthorizationCallback callback)
context
- Contextcallback
- AuthorizationCallback
object to be called after execution of request@Deprecated void logout(AuthorizationCallback callback)
AuthorizationAgent.logout(Context, AuthorizationCallback)
instead.
Logs the current user out of OMCe.callback
- AuthorizationCallback
object to be called after execution of requestvoid logout(Context context, AuthorizationCallback callback)
context
- Contextcallback
- AuthorizationCallback
object to be called after execution of requestboolean validateToken(boolean autoRefresh)
autoRefresh
- Boolean value . if set to true, refreshes expired token.void refreshTokenAsync(RefreshTokenCallback callback)
callback
- RefreshTokenCallback
object to be called after execution of requestjava.util.Map<java.lang.String,java.lang.String> getHTTPHeaders()
User getCurrentUser()
boolean isAuthorized()
void fetchCurrentUser(UserRegistrationCallback callback)
callback
- UserRegistrationCallback
object to be called after execution of requestvoid refreshToken(RefreshTokenCallback callback)
callback
- RefreshTokenCallback
object to be called after execution of requestvoid invokeCustomCodeJSONRequest(GenericCustomCodeClientCallBack genericCustomCodeClientCallBack, JSONObject data, java.lang.String functionName, RestClient.HttpMethod httpMethod)
genericCustomCodeClientCallBack
- GenericCustomCodeClientCallBack
object to be called after execution of rest requestdata
- jsonObject containing the object to be passed with the REST request bodyfunctionName
- REST request endpointhttpMethod
- HTTP verb for the REST requestvoid authenticateUsingTokenExchange(Context context, java.lang.String token, AuthorizationCallback callback)
context
- Contexttoken
- Third party token to be exchanged with OMCe tokencallback
- AuthorizationCallback
object to be called after execution of requestjava.lang.String getAccessToken()
void authenticateUsingTokenExchange(Context context, java.lang.String token, boolean storeToken, AuthorizationCallback callback)
context
- Contexttoken
- Third party token to be exchanged with OMCe tokenstoreToken
- Boolean value. if set to true, stores token in secure storecallback
- AuthorizationCallback
object to be called after execution of requestboolean loadSSOTokenExchange(Context context)
context
- Contextboolean clearSSOTokenExchange(Context context)
context
- Context