public class EventDispatcher
+extends java.util.Observable
+Modifier and Type | +Field and Description | +
---|---|
static EventDispatcher |
+AFTER_DEREGISTER |
+
static EventDispatcher |
+AFTER_GATEWAY_SWITCH |
+
static EventDispatcher |
+BEFORE_DEREGISTER |
+
static EventDispatcher |
+BEFORE_GATEWAY_SWITCH |
+
static EventDispatcher |
+LOGOUT |
+
static EventDispatcher |
+RESET_LOCALLY |
+
static EventDispatcher |
+STARTED |
+
static EventDispatcher |
+STOP |
+
Constructor and Description | +
---|
EventDispatcher() |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+hasChanged() |
+
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, notifyObservers, notifyObservers, setChanged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final EventDispatcher STARTED+
public static final EventDispatcher STOP+
public static final EventDispatcher LOGOUT+
public static final EventDispatcher BEFORE_DEREGISTER+
public static final EventDispatcher AFTER_DEREGISTER+
public static final EventDispatcher RESET_LOCALLY+
public static final EventDispatcher BEFORE_GATEWAY_SWITCH+
public static final EventDispatcher AFTER_GATEWAY_SWITCH+
T
- To provide the data type of the expected response object. The SDK converts the
+ response stream data to the provided data type. By define this generic type, it only provides
+ tighter type checks at compile time, developer has to define the expected response body in
+ MASRequest.MASRequestBuilder.responseBody(MASResponseBody)
)}public abstract class MAGResultReceiver<T>
+extends android.os.ResultReceiver
+MobileSso.processRequest(MASRequest, ResultReceiver)
+ Use this by creating a subclass and implement onSuccess(MASResponse)
)}, onError(MAGError)
,
+ onRequestCancelled(Bundle)
)}android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
CREATOR
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description | +
---|
MAGResultReceiver() |
+
MAGResultReceiver(android.os.Handler handler) |
+
Modifier and Type | +Method and Description | +
---|---|
abstract void |
+onError(MAGError error)
+Callback when failed to invoke the MAG API and Target API.
+ |
+
protected void |
+onReceiveResult(int resultCode,
+ android.os.Bundle resultData) |
+
void |
+onRequestCancelled(android.os.Bundle data)
+Callback when the request is cancelled.
+ |
+
abstract void |
+onSuccess(MASResponse<T> response)
+Callback when successfully invoked the target API and the target API return http status code
+ within the range 200 - 299.
+ |
+
describeContents, send, writeToParcel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public MAGResultReceiver(android.os.Handler handler)+
public MAGResultReceiver()+
protected void onReceiveResult(int resultCode, + android.os.Bundle resultData)+
onReceiveResult
in class android.os.ResultReceiver
public abstract void onSuccess(MASResponse<T> response)+
response
- The HttpResponse of the endpoint.public abstract void onError(MAGError error)+
public void onRequestCancelled(android.os.Bundle data)+
public interface MobileSso
+Top-level interface for the Mobile SSO SDK.
+ UseMobileSsoFactory
to obtain an implementation of this.Modifier and Type | +Method and Description | +
---|---|
void |
+authenticate(MASAuthCredentials credentials,
+ MAGResultReceiver<org.json.JSONObject> resultReceiver)
+Authenticates a user with a MASAuthCredentials object.
+ |
+
void |
+authorize(java.lang.String url,
+ android.os.ResultReceiver resultReceiver)
+Performs a remote authorization with the provider URL.
+ |
+
void |
+cancelAllRequests(android.os.Bundle data)
+Cancels all requests.
+ |
+
void |
+cancelRequest(long requestId,
+ android.os.Bundle data)
+Cancels the specified request ID.
+ |
+
void |
+destroyAllPersistentTokens()
+Clear all tokens in the shared token store.
+ |
+
AuthenticationProvider |
+getAuthenticationProvider()
+Retrieves the Authentication Providers from the server.
+ |
+
boolean |
+isDeviceRegistered()
+Checks if the device has already been registered.
+ |
+
boolean |
+isLogin()
+Check if the user has already been logged in.
+ |
+
void |
+logout(boolean contactServer)
+Log out the current user and all SSO apps on this device, leaving the device registered, and
+ optionally informing the token server of the logout.
+ |
+
void |
+processPendingRequests()
+Requests that any pending queued requests be processed.
+ |
+
long |
+processRequest(MASRequest request,
+ android.os.ResultReceiver resultReceiver)
+Submit a API request to be processed asynchronously.
+ |
+
void |
+removeDeviceRegistration()
+Remove this device registration from the server.
+ |
+
long processRequest(MASRequest request, + android.os.ResultReceiver resultReceiver)+
request
- the request to send. Required.resultReceiver
- the resultReceiver to notify when a response is available, or if there is an error. Required.
+ The result code is defined under MssoIntents
RESULT_CODE_*,
+ To retrieve the error message from the returned Bundle with key
+ MssoIntents.RESULT_ERROR_MESSAGE
.
+
+ A helper class MAGResultReceiver
defined a standard interface to capture the result
+ of the API request.
+
cancelRequest(long, Bundle)
}void authenticate(MASAuthCredentials credentials, + MAGResultReceiver<org.json.JSONObject> resultReceiver)+
Authenticates a user with a MASAuthCredentials object.
+ +The response to the request will eventually be delivered to the specified result receiver.
+This method returns immediately to the calling thread
credentials
- the credentials to authenticate withresultReceiver
- the resultReceiver to notify when a response is available, or if there is an error. Required.void processPendingRequests()+
Requests that any pending queued requests be processed.
+This can be called from an activity's onResume() method to ensure that + any pending requests waiting for an initial unlock code on the device get a chance to continue.
+This method returns immediately to the calling thread.
+An activity may be started if a device lock code (still) needs to be configured + or if the user must be prompted for a username and password.
void cancelRequest(long requestId, + android.os.Bundle data)+
requestId
- the request ID to cancel.data
- the data to the cancelled request MAGResultReceiver.onRequestCancelled(Bundle)
void cancelAllRequests(android.os.Bundle data)+
data
- the data to the all the cancelled request MAGResultReceiver.onRequestCancelled(Bundle)
void logout(boolean contactServer)+
Log out the current user and all SSO apps on this device, leaving the device registered, and + optionally informing the token server of the logout.
+This method takes no action if the use is already logged out.
+This method destroys the access token and cached password (if any). If SSO is enabled, this method also + removes the ID token from the shared token store.
+If contactServer is true, this method additionally makes a best-effort attempt to notify the server that the + access token (and possibly ID token) should be invalidated.
+If the server needs to be contact, this will be done on the current thread. As this may take some time, + callers running on the UI thread and passing true for contactServer should consider running this method + within an AsyncTask.
+ NOTE: It is extremely important to make at least one attempt to inform the server + of the logout before destroying the tokens client side to try and prevent the server + from getting out of sync with the client. Pass contactServer=false only if + absolutely necessary (such as to avoid blocking the GUI if you have already made + at least one attempt to contact the server).contactServer
- true to make a single best-effort attempt to notify the server of the logout so that
+ it can revoke the tokens. This may fail if we lack network connectivity.
+ MssoException
- if contactServer is true, and SSO is enabled, and there is an error while attempting
+ to notify the server of the logout.void destroyAllPersistentTokens()+
Clear all tokens in the shared token store.
+ NOTE: You should not normally use this method. + This method destroys the client private key, effectively un-registering the device, and should only be used + for testing or recovery purposes. +If you just wish to log out the current SSO user see the logout(boolean)
method instead.
void removeDeviceRegistration()+
Remove this device registration from the server. The token server will identify the device making the request + by its TLS client certificate.
+This does not affect the local cached access token, + cached username and password, or the shared token storage in any way. The client will continue to attempt + to present its TLS client certificate on future calls to the token server or a web API endpoint.
+ To destroy the client-side record of the device registration, calldestroyAllPersistentTokens()
.
+ The communication with the token server will occur on the current thread. As this may take some time, + callers running on the UI thread should consider running this method within an AsyncTask.
MssoException
- if there is an error while attempting to tell the token server to unregister this device.boolean isLogin()+
boolean isDeviceRegistered()+
void authorize(java.lang.String url, + android.os.ResultReceiver resultReceiver)+
url
- The temporary URL to enable the remote session.resultReceiver
- the resultReceiver to notify when a response is available, or if there is an error. Required.AuthenticationProvider getAuthenticationProvider() + throws java.lang.Exception+
java.lang.Exception
public interface MobileSsoConfig
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+AUTHENTICATE_OTP_PATH
+String.
+ |
+
static java.lang.String |
+PROP_AUTHORIZE_REDIRECT_URI
+String.
+ |
+
static java.lang.String |
+PROP_BLE_CHARACTERISTIC_UUID
+String.
+ |
+
static java.lang.String |
+PROP_BLE_RSSI
+Integer.
+ |
+
static java.lang.String |
+PROP_BLE_SERVICE_UUID
+String.
+ |
+
static java.lang.String |
+PROP_CLIENT_CERT_RSA_KEYBITS
+Integer.
+ |
+
static java.lang.String |
+PROP_CLIENT_ID
+String.
+ |
+
static java.lang.String |
+PROP_CLIENT_SECRET
+String.
+ |
+
static java.lang.String |
+PROP_LOCATION_ENABLED
+Boolean.
+ |
+
static java.lang.String |
+PROP_LOCATION_PROVIDER_NAME
+String.
+ |
+
static java.lang.String |
+PROP_MSISDN_ENABLED
+Boolean.
+ |
+
static java.lang.String |
+PROP_OAUTH_SCOPE
+String.
+ |
+
static java.lang.String |
+PROP_ORGANIZATION
+String.
+ |
+
static java.lang.String |
+PROP_RESPONSE_BUFFERING_ENABLED
+Boolean, default=true.
+ |
+
static java.lang.String |
+PROP_RESPONSE_BUFFERING_MAX_SIZE
+Integer, default=10485760.
+ |
+
static java.lang.String |
+PROP_SSO_ENABLED
+Boolean.
+ |
+
static java.lang.String |
+PROP_STORAGE
+JSON String.
+ |
+
static java.lang.String |
+PROP_TOKEN_HOSTNAME
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_PORT_HTTP
+Integer.
+ |
+
static java.lang.String |
+PROP_TOKEN_PORT_HTTPS
+Integer.
+ |
+
static java.lang.String |
+PROP_TOKEN_URI_PREFIX
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_AUTHORIZE
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_CLIENT_CREDENTIALS
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_ENTERPRISE_APPS
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE_CLIENT
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_REMOVE_DEVICE_X509
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_RENEW_DEVICE
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN_SSO
+String.
+ |
+
static java.lang.String |
+PROP_TOKEN_URL_SUFFIX_RESOURCE_OWNER_LOGOUT
+String.
+ |
+
static java.lang.String |
+PROP_TRUSTED_CERT_PINNED_PUBLIC_KEY_HASHES
+ArrayList of String.
+ |
+
static java.lang.String |
+PROP_TRUSTED_CERTS_PEM
+ArrayList of String.
+ |
+
static java.lang.String |
+PROP_TRUSTED_PUBLIC_PKI
+Boolean.
+ |
+
static final java.lang.String PROP_TOKEN_HOSTNAME+
static final java.lang.String PROP_TOKEN_URI_PREFIX+
static final java.lang.String PROP_TOKEN_PORT_HTTP+
static final java.lang.String PROP_TOKEN_PORT_HTTPS+
static final java.lang.String PROP_ORGANIZATION+
static final java.lang.String PROP_CLIENT_CERT_RSA_KEYBITS+
static final java.lang.String PROP_OAUTH_SCOPE+
static final java.lang.String PROP_CLIENT_ID+
static final java.lang.String PROP_CLIENT_SECRET+
static final java.lang.String PROP_SSO_ENABLED+
static final java.lang.String PROP_RESPONSE_BUFFERING_ENABLED+
static final java.lang.String PROP_RESPONSE_BUFFERING_MAX_SIZE+
static final java.lang.String PROP_LOCATION_ENABLED+
static final java.lang.String PROP_LOCATION_PROVIDER_NAME+
static final java.lang.String PROP_TRUSTED_PUBLIC_PKI+
PROP_TRUSTED_CERTS_PEM
.
+
+ true if public CAs known to the OS should be trusted for outbound TLS.
+ false if only the certs returned by PROP_TRUSTED_CERTS_PEM
should be trusted.static final java.lang.String PROP_TRUSTED_CERTS_PEM+
PROP_TRUSTED_PUBLIC_PKI
is false then only TLS server certs on this list
+ (or directly or indirectly signed by certs on this list) will be trusted for outbound TLS.
+
+ The value is an ArrayList of String where each entry is a certificate trust anchor in PEM format
+ (eg, starting with "-----BEGIN CERTIFICATE-----\n").static final java.lang.String PROP_TRUSTED_CERT_PINNED_PUBLIC_KEY_HASHES+
PROP_TRUSTED_PUBLIC_PKI
is true. If you don't trust public
+ PKI certs and are relying on internal PKI or self-signed certificates built into the app then you probably
+ do not need to worry about certificate pinning.
+
+ If this list is nonempty then a TLS server cert will be accepted only if one of the pinned public keys
+ appears somewhere in its certificate chain.
+
+ This prevents CAs -- any public CA, not necessarily the CA that signed the server cert originally -- from being
+ able to create a forged server certificate for an arbitrary target domain.
+
+ The value is an ArrayList of pinned server certificate public keys, expressed as hexadecimal Strings.
+ Each value is the lowercase hex dump of an SHA-256 hash of a SubjectPublicKeyInfo structure.
+ This value should be null if public key pinning should not be used.static final java.lang.String PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN+
PROP_TOKEN_URI_PREFIX
to build the URL to request an access_token/id_token (JWT)
+ using username/password credentials.
+
+ If not specified, will default to "/auth/oauth/v2/token".static final java.lang.String PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN_SSO+
PROP_TOKEN_URI_PREFIX
to build the URL to request an access_token usin gan ID token (JWT).
+
+ If not specified, will default to "/auth/oauth/v2/token" (the same as
+ the regular request_token endpoint).static final java.lang.String PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE+
PROP_TOKEN_URI_PREFIX
to build the URL to register the device the first time it is used.
+
+ If not specified, will default to "/connect/device/register".static final java.lang.String PROP_TOKEN_URL_SUFFIX_RENEW_DEVICE+
PROP_TOKEN_URI_PREFIX
to build the URL to renew the device if client certificate has expired.
+
+ If not specified, will default to "/connect/device/renew".static final java.lang.String PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE_CLIENT+
PROP_TOKEN_URI_PREFIX
to build the URL to register the device the first time it is used.
+
+ If not specified, will default to "/connect/device/register/client".static final java.lang.String PROP_TOKEN_URL_SUFFIX_RESOURCE_OWNER_LOGOUT+
PROP_TOKEN_URI_PREFIX
to build the URL to log out the current device
+ by invalidating the ID token (JWT).
+
+ If not specified, will default to "/connect/session/logout".static final java.lang.String PROP_TOKEN_URL_SUFFIX_REMOVE_DEVICE_X509+
PROP_TOKEN_URI_PREFIX
to build the URL to remove the current
+ device registration, identifying the device by its TLS client certificate.
+
+ If not specified, will default to "/connect/device/remove".static final java.lang.String PROP_TOKEN_URL_SUFFIX_AUTHORIZE+
PROP_TOKEN_URI_PREFIX
to build the URL to request for Social login
+ using authorization_code credentials.
+
+ If not specified, will default to "/auth/oauth/v2/authorize".static final java.lang.String PROP_TOKEN_URL_SUFFIX_ENTERPRISE_APPS+
PROP_TOKEN_URI_PREFIX
to build the URL to request for
+ enterprise apps.
+
+ If not specified, will default to "/connect/enterprise/browser".static final java.lang.String PROP_AUTHORIZE_REDIRECT_URI+
static final java.lang.String PROP_MSISDN_ENABLED+
static final java.lang.String PROP_TOKEN_URL_SUFFIX_CLIENT_CREDENTIALS+
PROP_TOKEN_URI_PREFIX
to build the URL to request for
+ client credentials.
+
+ If not specified, will default to "/connect/client/initialize".static final java.lang.String AUTHENTICATE_OTP_PATH+
PROP_TOKEN_URI_PREFIX
to build the URL to request for
+ otp generation and delivery.static final java.lang.String PROP_BLE_SERVICE_UUID+
static final java.lang.String PROP_BLE_CHARACTERISTIC_UUID+
static final java.lang.String PROP_BLE_RSSI+
static final java.lang.String PROP_STORAGE+
"storage": {
+ "class": "<Canonical name of the Storage class>",
+ "share" "true/false"
+ }
+
public final class MobileSsoFactory
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private static java.util.concurrent.atomic.AtomicReference<MobileSso> |
+mobileSso |
+
Modifier | +Constructor and Description | +
---|---|
private |
+MobileSsoFactory() |
+
Modifier and Type | +Method and Description | +
---|---|
private static MobileSso |
+createMobileSso(android.content.Context context) |
+
static MobileSso |
+getInstance()
+Obtains the cached
+MobileSso instance. |
+
static MobileSso |
+getInstance(android.content.Context context)
+Obtains and initializes the
+MobileSso instance using the specified Context. |
+
static MobileSso |
+getInstance(android.content.Context context,
+ boolean forceDefault)
+Obtains and initializes the
+MobileSso instance using the specified Context. |
+
static MobileSso |
+getInstance(android.content.Context context,
+ org.json.JSONObject config)
+Obtains and initializes the
+MobileSso instance using the specified Context and configuration JSONObject. |
+
static MobileSso |
+getInstance(android.content.Context context,
+ java.net.URL url)
+Obtains and initializes the
+MobileSso instance using the specified Context and file. |
+
private static boolean |
+isSwitchGateway(org.json.JSONObject newConfig) |
+
static void |
+reset()
+Resets the initialized MobileSso.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.util.concurrent.atomic.AtomicReference<MobileSso> mobileSso+
public static MobileSso getInstance()+
Obtains the cached MobileSso
instance.
getInstance(Context, JSONObject)
or
+ getInstance(Context)
, throw IllegalStateException
.public static MobileSso getInstance(@NonNull + android.content.Context context, + boolean forceDefault)+
Obtains and initializes the MobileSso
instance using the specified Context.
context
- Context to provide access to services such as the device ID and current location. Required.forceDefault
- True - force to load the JSON Configuration under /assets/msso_config.jsonpublic static MobileSso getInstance(@NonNull + android.content.Context context)+
Obtains and initializes the MobileSso
instance using the specified Context.
context
- Context to provide access to services such as the device ID and current location. Required.public static MobileSso getInstance(@NonNull + android.content.Context context, + @NonNull + java.net.URL url)+
Obtains and initializes the MobileSso
instance using the specified Context and file.
If a MobileSso instance has already been created with the same host, port and prefix for this process, + it will be returned, otherwise, a new MobileSso instance will be created using the specified + context and JSONObject. Multiple MobileSso with different configuration is not currently supported, + Application should not use more than one instance of MobileSso with different setting. +
+You should use this method cautiously at runtime as an exception may be thrown due to an invalid + JSON Object, missing mandatory value, invalid types, etc. You may use a try and catch block + to avoid applications from being unexpectedly killed. +
context
- Context to provide access to services such as the device ID and current location. Required.url
- URL of JSON configuration to use, if a MobileSso has not yet been created for this process. Required.public static MobileSso getInstance(@NonNull + android.content.Context context, + @NonNull + org.json.JSONObject config)+
Obtains and initializes the MobileSso
instance using the specified Context and configuration JSONObject.
If a MobileSso instance has already been created with the same host, port and prefix for this process, + it will be returned, otherwise, a new MobileSso instance will be created using the specified + context and JSONObject. Multiple MobileSso with different configuration is not currently supported, + Application should not use more than one instance of MobileSso with different setting. +
+You should use this method cautiously at runtime as an exception may be thrown due to an invalid + JSON Object, missing mandatory value, invalid types, etc. You may use a try and catch block + to avoid applications from being unexpectedly killed. +
context
- Context to provide access to services such as the device ID and current location. Required.config
- JSON configuration to use, if a MobileSso has not yet been created for this process. Required.private static boolean isSwitchGateway(org.json.JSONObject newConfig)+
public static void reset()+
getInstance()
or getInstance(Context, JSONObject)
private static MobileSso createMobileSso(android.content.Context context)+
public interface MobileSsoListener
+Modifier and Type | +Method and Description | +
---|---|
void |
+onAuthenticateRequest(long requestId,
+ AuthenticationProvider authenticationProvider)
+Notifies the host application that a request to authenticate is triggered by the MAG authentication process.
+ |
+
void |
+onOtpAuthenticationRequest(MASOtpAuthenticationHandler otpAuthenticationHandler)
+Deprecated.
+ |
+
void onAuthenticateRequest(long requestId, + AuthenticationProvider authenticationProvider)+
requestId
- authenticationProvider
- void onOtpAuthenticationRequest(MASOtpAuthenticationHandler otpAuthenticationHandler)+
public abstract class AuthRenderer
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static int |
+AUTH_CODE_ERR |
+
protected android.content.Context |
+context |
+
protected Provider |
+provider |
+
protected long |
+requestId |
+
Constructor and Description | +
---|
AuthRenderer() |
+
Modifier and Type | +Method and Description | +
---|---|
abstract void |
+close()
+Perform clean up for the renderer.
+ |
+
java.lang.String |
+getId()
+Retrieve the ID of the Auth Provider, the auth provider should be one of the provider returned from the authorize
+ endpoint
+MobileSsoConfig.PROP_TOKEN_URL_SUFFIX_AUTHORIZE . |
+
boolean |
+init(android.content.Context context,
+ Provider provider)
+Initialize the Renderer,
+ |
+
(package private) abstract void |
+onAuthCodeReceived(java.lang.String code,
+ java.lang.String state)
+Notify the Authenticate Renderer that Authorization code has been retrieved.
+ |
+
protected abstract void |
+onError(int code,
+ java.lang.String message,
+ java.lang.Exception e)
+Notify when any error occur.
+ |
+
abstract void |
+onRenderCompleted()
+Perform action after rendering is completed.
+ |
+
protected void |
+proceed()
+Proceed the authorization process and retrieve the authorized Authorization Code.
+ |
+
abstract android.view.View |
+render()
+Render the view for the login, the view can be a image, button or null for no view.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int AUTH_CODE_ERR+
protected android.content.Context context+
protected Provider provider+
protected long requestId+
public boolean init(android.content.Context context, + Provider provider)+
context
- The application contextprovider
- The Authorize Provider returned from gatewaypublic java.lang.String getId()+
MobileSsoConfig.PROP_TOKEN_URL_SUFFIX_AUTHORIZE
.public abstract android.view.View render()+
public abstract void onRenderCompleted()+
protected abstract void onError(int code, + java.lang.String message, + java.lang.Exception e)+
code
- Error codemessage
- Error messagee
- Exceptionpublic abstract void close()+
protected void proceed()+
abstract void onAuthCodeReceived(java.lang.String code, + java.lang.String state)+
code
- Authorization Codestate
- State from the responsepublic interface AuthResultReceiver
+MobileSso.authorize(java.lang.String, android.os.ResultReceiver)
Modifier and Type | +Method and Description | +
---|---|
void |
+setData(org.json.JSONObject data) |
+
public class AuthenticationException +extends MAGServerException+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+INVALID_RESOURCE_OWNER_SUFFIX |
+
Constructor and Description | +
---|
AuthenticationException(MAGServerException e) |
+
AuthenticationException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage) |
+
AuthenticationException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
getContentType, getErrorCode, getResponse, getStatus
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final java.lang.String INVALID_RESOURCE_OWNER_SUFFIX+
public AuthenticationException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage)+
public AuthenticationException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public AuthenticationException(MAGServerException e)+
public class NFCRenderer +extends PollingRenderer+
Modifier and Type | +Class and Description | +
---|---|
private class |
+NFCRenderer.ListenerThread |
+
Modifier and Type | +Field and Description | +
---|---|
private android.nfc.NfcAdapter |
+adapter |
+
static java.lang.String |
+ADDRESS |
+
static int |
+BLUETOOTH_CONN_ERR
+Error when failed to start Bluetooth server
+ |
+
static int |
+BLUETOOTH_ERR
+Error when unable to start Bluetooth Service
+ |
+
private NFCRenderer.ListenerThread |
+listener |
+
static int |
+NFC_ERR
+Error when NFC is not available
+ |
+
static java.lang.String |
+PROVIDER_URL |
+
private java.lang.String |
+serverAddress |
+
private java.util.UUID |
+serverUuid |
+
static java.lang.String |
+UUID |
+
DELAY, INVALID_SESSION_ID_OR_POLL_URL, MAX_POLL_COUNT, POLL_INTERVAL, SESSION_EXPIRED
AUTH_CODE_ERR, context, provider, requestId
Constructor and Description | +
---|
NFCRenderer() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Perform clean up for the renderer.
+ |
+
protected void |
+onError(int code,
+ java.lang.String message,
+ java.lang.Exception e)
+Notify when any error occur.
+ |
+
void |
+onRenderCompleted()
+Perform action after rendering is completed.
+ |
+
android.view.View |
+render()
+Render the view for the login, the view can be a image, button or null for no view.
+ |
+
protected boolean |
+startPollingOnStartup()
+Start polling MAG on startup
+ |
+
getDelay, getMaxPollCount, getPollInterval, init, onAuthCodeReceived, poll
getId, proceed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int NFC_ERR+
public static final int BLUETOOTH_ERR+
public static final int BLUETOOTH_CONN_ERR+
public static final java.lang.String UUID+
public static final java.lang.String PROVIDER_URL+
public static final java.lang.String ADDRESS+
private NFCRenderer.ListenerThread listener+
private java.util.UUID serverUuid+
private android.nfc.NfcAdapter adapter+
private java.lang.String serverAddress+
public android.view.View render()+
AuthRenderer
render
in class AuthRenderer
public void onRenderCompleted()+
AuthRenderer
onRenderCompleted
in class PollingRenderer
protected void onError(int code, + java.lang.String message, + java.lang.Exception e)+
AuthRenderer
onError
in class AuthRenderer
code
- Error codemessage
- Error messagee
- Exceptionpublic void close()+
AuthRenderer
close
in class PollingRenderer
protected boolean startPollingOnStartup()+
PollingRenderer
startPollingOnStartup
in class PollingRenderer
AuthRenderer.onRenderCompleted()
public abstract class NfcResultReceiver +extends MAGResultReceiver +implements AuthResultReceiver+
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
private org.json.JSONObject |
+data |
+
CREATOR
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description | +
---|
NfcResultReceiver() |
+
Modifier and Type | +Method and Description | +
---|---|
org.json.JSONObject |
+getData() |
+
void |
+setData(org.json.JSONObject data) |
+
onError, onReceiveResult, onRequestCancelled, onSuccess
describeContents, send, writeToParcel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public org.json.JSONObject getData()+
public void setData(org.json.JSONObject data)+
setData
in interface AuthResultReceiver
public abstract class PollingRenderer +extends AuthRenderer+
Modifier and Type | +Field and Description | +
---|---|
static int |
+DELAY
+Default delay for the first execution
+ |
+
static int |
+INVALID_SESSION_ID_OR_POLL_URL |
+
static int |
+MAX_POLL_COUNT
+Default Maximum number of polls
+ |
+
static int |
+POLL_INTERVAL
+Default Poll Interval
+ |
+
static int |
+SESSION_EXPIRED
+Error due to errors occurred during request for auth code.
+ |
+
private java.util.TimerTask |
+task |
+
private java.util.concurrent.ScheduledExecutorService |
+timer |
+
AUTH_CODE_ERR, context, provider, requestId
Constructor and Description | +
---|
PollingRenderer() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Perform clean up for the renderer.
+ |
+
protected long |
+getDelay()
+The time to delay first execution.
+ |
+
protected long |
+getMaxPollCount()
+The maximum number of polls
+ |
+
protected long |
+getPollInterval()
+The interval between the termination of one
+ execution and the commencement of the next
+ |
+
boolean |
+init(android.content.Context context,
+ Provider provider)
+Initialize the Renderer,
+ |
+
protected void |
+onAuthCodeReceived(java.lang.String code,
+ java.lang.String state)
+Notify the Authenticate Renderer that Authorization code has been retrieved.
+ |
+
void |
+onRenderCompleted()
+Perform action after rendering is completed.
+ |
+
protected void |
+poll()
+Start the polling
+ |
+
protected abstract boolean |
+startPollingOnStartup()
+Start polling MAG on startup
+ |
+
getId, onError, proceed, render
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int INVALID_SESSION_ID_OR_POLL_URL+
public static final int SESSION_EXPIRED+
public static final int POLL_INTERVAL+
public static final int MAX_POLL_COUNT+
public static final int DELAY+
private java.util.TimerTask task+
private java.util.concurrent.ScheduledExecutorService timer+
public boolean init(android.content.Context context, + Provider provider)+
AuthRenderer
init
in class AuthRenderer
context
- The application contextprovider
- The Authorize Provider returned from gatewaypublic void onRenderCompleted()+
AuthRenderer
onRenderCompleted
in class AuthRenderer
public void close()+
AuthRenderer
close
in class AuthRenderer
protected void poll()+
protected long getPollInterval()+
protected long getMaxPollCount()+
protected long getDelay()+
protected void onAuthCodeReceived(java.lang.String code, + java.lang.String state)+
AuthRenderer
onAuthCodeReceived
in class AuthRenderer
code
- Authorization Codestate
- State from the responseprotected abstract boolean startPollingOnStartup()+
AuthRenderer.onRenderCompleted()
public class QRCode
+extends android.widget.ImageView
+android.widget.ImageView.ScaleType
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnCapturedPointerListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLE, FOCUSABLE_AUTO, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, NOT_FOCUSABLE, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
Constructor and Description | +
---|
QRCode(android.content.Context context) |
+
clearColorFilter, drawableHotspotChanged, drawableStateChanged, getAccessibilityClassName, getAdjustViewBounds, getBaseline, getBaselineAlignBottom, getColorFilter, getCropToPadding, getDrawable, getImageAlpha, getImageMatrix, getImageTintList, getImageTintMode, getMaxHeight, getMaxWidth, getScaleType, hasOverlappingRendering, invalidateDrawable, isOpaque, jumpDrawablesToCurrentState, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onDraw, onMeasure, onRtlPropertiesChanged, onVisibilityAggregated, setAdjustViewBounds, setAlpha, setBaseline, setBaselineAlignBottom, setColorFilter, setColorFilter, setColorFilter, setCropToPadding, setFrame, setImageAlpha, setImageBitmap, setImageDrawable, setImageIcon, setImageLevel, setImageMatrix, setImageResource, setImageState, setImageTintList, setImageTintMode, setImageURI, setMaxHeight, setMaxWidth, setScaleType, setSelected, setVisibility, verifyDrawable
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewsWithText, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getImportantForAutofill, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasPointerCapture, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, keyboardNavigationClusterSearch, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideStructure, onProvideVirtualStructure, onResolvePointerIcon, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreDefaultFocus, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setAutofillHints, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public class QRCodeRenderer +extends PollingRenderer+
Modifier and Type | +Field and Description | +
---|---|
private static int |
+HEIGHT
+Default height of QRCode image
+ |
+
static int |
+QRCODE_ERROR
+Failed to generate QRCode error code
+ |
+
private static int |
+WIDTH
+Default width of QRCode image
+ |
+
DELAY, INVALID_SESSION_ID_OR_POLL_URL, MAX_POLL_COUNT, POLL_INTERVAL, SESSION_EXPIRED
AUTH_CODE_ERR, context, provider, requestId
Constructor and Description | +
---|
QRCodeRenderer() |
+
Modifier and Type | +Method and Description | +
---|---|
protected int |
+getQRCodeHeight()
+Retrieve the QRCode image height
+ |
+
protected int |
+getQRCodeWidth()
+Retrieve the QRCode image width
+ |
+
protected void |
+onError(int code,
+ java.lang.String m,
+ java.lang.Exception e)
+Notify when any error occur.
+ |
+
android.view.View |
+render()
+Render the view for the login, the view can be a image, button or null for no view.
+ |
+
protected boolean |
+startPollingOnStartup()
+Start polling MAG on startup
+ |
+
private android.graphics.Bitmap |
+toBitmap(com.google.zxing.common.BitMatrix matrix)
+Writes the given Matrix on a new Bitmap object.
+ |
+
close, getDelay, getMaxPollCount, getPollInterval, init, onAuthCodeReceived, onRenderCompleted, poll
getId, proceed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int QRCODE_ERROR+
private static final int HEIGHT+
private static final int WIDTH+
private android.graphics.Bitmap toBitmap(com.google.zxing.common.BitMatrix matrix)+
matrix
- the matrix to write.Bitmap
-object.public android.view.View render()+
AuthRenderer
render
in class AuthRenderer
protected void onError(int code, + java.lang.String m, + java.lang.Exception e)+
AuthRenderer
onError
in class AuthRenderer
code
- Error codem
- Error messagee
- Exceptionprotected int getQRCodeWidth()+
protected int getQRCodeHeight()+
protected boolean startPollingOnStartup()+
PollingRenderer
startPollingOnStartup
in class PollingRenderer
AuthRenderer.onRenderCompleted()
public interface BluetoothLe
+Modifier and Type | +Field and Description | +
---|---|
static int |
+BLE_ERROR_DISABLED
+The Bluetooth on the device is disabled
+ |
+
static int |
+BLE_ERROR_INVALID_UUID
+The provided UUID is empty or invalid
+ |
+
static int |
+BLE_ERROR_NOT_SUPPORTED
+The Bluetooth is not supported on the device
+ |
+
static int |
+BLE_ERROR_SESSION_SHARING_NOT_SUPPORTED
+Bluetooth LE session sharing is not supported
+ |
+
static java.lang.String |
+DEVICE_NAME |
+
static java.lang.String |
+EOM |
+
static java.lang.String |
+PROVIDER_URL |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onStatusUpdate(int state)
+Notify the host application for status update.
+ |
+
static final java.lang.String EOM+
static final java.lang.String PROVIDER_URL+
static final java.lang.String DEVICE_NAME+
static final int BLE_ERROR_DISABLED+
static final int BLE_ERROR_NOT_SUPPORTED+
static final int BLE_ERROR_INVALID_UUID+
static final int BLE_ERROR_SESSION_SHARING_NOT_SUPPORTED+
void onStatusUpdate(int state)+
state
- The status code corresponding to an BLE_STATE* value defined under
+ BluetoothLeCentralCallback
or
+ BluetoothLePeripheralCallback
public interface BluetoothLeCentralCallback +extends BluetoothLe+
Modifier and Type | +Field and Description | +
---|---|
static int |
+BLE_STATE_AUTH_FAILED
+The remote peripheral device has rejected or failed to authorize the session sharing request.
+ |
+
static int |
+BLE_STATE_AUTH_SUCCEEDED
+The remote peripheral device has authorize the session sharing request
+ |
+
static int |
+BLE_STATE_CHARACTERISTIC_FOUND
+Bluetooth LE GATT Characteristic found
+ |
+
static int |
+BLE_STATE_CHARACTERISTIC_WRITTEN
+Data has been written to Bluetooth GATT Characteristic
+ |
+
static int |
+BLE_STATE_CONNECTED
+Connected to remote peripheral device
+ |
+
static int |
+BLE_STATE_DEVICE_DETECTED
+Remote peripheral device has detected
+ |
+
static int |
+BLE_STATE_DISCONNECTED
+Disconnected from remote peripheral device
+ |
+
static int |
+BLE_STATE_SCAN_STARTED
+Bluetooth LE Scan has started
+ |
+
static int |
+BLE_STATE_SCAN_STOPPED
+Bluetooth LE scan has stopped
+ |
+
static int |
+BLE_STATE_SERVICE_DISCOVERED
+Bluetooth LE GATT Service has been discovered
+ |
+
BLE_ERROR_DISABLED, BLE_ERROR_INVALID_UUID, BLE_ERROR_NOT_SUPPORTED, BLE_ERROR_SESSION_SHARING_NOT_SUPPORTED, DEVICE_NAME, EOM, PROVIDER_URL
onStatusUpdate
static final int BLE_STATE_SCAN_STARTED+
static final int BLE_STATE_SCAN_STOPPED+
static final int BLE_STATE_DEVICE_DETECTED+
static final int BLE_STATE_CONNECTED+
static final int BLE_STATE_DISCONNECTED+
static final int BLE_STATE_SERVICE_DISCOVERED+
static final int BLE_STATE_CHARACTERISTIC_FOUND+
static final int BLE_STATE_CHARACTERISTIC_WRITTEN+
static final int BLE_STATE_AUTH_SUCCEEDED+
static final int BLE_STATE_AUTH_FAILED+
public class BluetoothLeCentralRenderer +extends PollingRenderer+
Modifier and Type | +Field and Description | +
---|---|
private android.bluetooth.BluetoothGatt |
+bluetoothGatt |
+
private BluetoothLeCentralCallback |
+callback |
+
private java.util.UUID |
+characteristicUUID |
+
static int |
+MAX
+Maximum bytes that can send with bluetooth characteristic
+ |
+
private static java.util.UUID |
+NOTIFY_UUID |
+
private int |
+rssi |
+
private android.bluetooth.le.ScanCallback |
+scanCallback |
+
private android.bluetooth.le.BluetoothLeScanner |
+scanner |
+
private java.util.UUID |
+serviceUUID |
+
DELAY, INVALID_SESSION_ID_OR_POLL_URL, MAX_POLL_COUNT, POLL_INTERVAL, SESSION_EXPIRED
AUTH_CODE_ERR, context, provider, requestId
Constructor and Description | +
---|
BluetoothLeCentralRenderer(BluetoothLeCentralCallback callback) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Perform clean up for the renderer.
+ |
+
private BluetoothLeCentralCallback |
+getCallback(BluetoothLeCentralCallback callback) |
+
private byte[] |
+getSessionRequest() |
+
protected void |
+onAuthCodeReceived(java.lang.String code,
+ java.lang.String state)
+Notify the Authenticate Renderer that Authorization code has been retrieved.
+ |
+
protected void |
+onError(int code,
+ java.lang.String message,
+ java.lang.Exception e)
+Notify the host application when any error occur.
+ |
+
void |
+onRenderCompleted()
+Perform action after rendering is completed.
+ |
+
android.view.View |
+render()
+Render the view for the login, the view can be a image, button or null for no view.
+ |
+
private java.util.List<byte[]> |
+splitArray(byte[] items,
+ int max) |
+
protected boolean |
+startPollingOnStartup()
+Start polling MAG on startup
+ |
+
private void |
+startProcess(android.bluetooth.BluetoothDevice bluetoothDevice) |
+
private void |
+startScan() |
+
private void |
+stopScan() |
+
getDelay, getMaxPollCount, getPollInterval, init, poll
getId, proceed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int MAX+
private static final java.util.UUID NOTIFY_UUID+
private android.bluetooth.BluetoothGatt bluetoothGatt+
private android.bluetooth.le.BluetoothLeScanner scanner+
private android.bluetooth.le.ScanCallback scanCallback+
private java.util.UUID serviceUUID+
private java.util.UUID characteristicUUID+
private BluetoothLeCentralCallback callback+
private int rssi+
public BluetoothLeCentralRenderer(BluetoothLeCentralCallback callback)+
public android.view.View render()+
AuthRenderer
render
in class AuthRenderer
public void onRenderCompleted()+
AuthRenderer
onRenderCompleted
in class PollingRenderer
protected void onError(int code, + java.lang.String message, + java.lang.Exception e)+
onError
in class AuthRenderer
code
- The status code corresponding to an BLE_ERROR* value defined under
+ BluetoothLeCentralCallback
message
- Error message The error messagee
- Exception The exception for the error.public void close()+
AuthRenderer
close
in class PollingRenderer
private void startScan()+
private void stopScan()+
private void startProcess(android.bluetooth.BluetoothDevice bluetoothDevice)+
protected void onAuthCodeReceived(java.lang.String code, + java.lang.String state)+
AuthRenderer
onAuthCodeReceived
in class PollingRenderer
code
- Authorization Codestate
- State from the responseprivate java.util.List<byte[]> splitArray(byte[] items, + int max)+
private BluetoothLeCentralCallback getCallback(BluetoothLeCentralCallback callback)+
private byte[] getSessionRequest()+
protected boolean startPollingOnStartup()+
PollingRenderer
startPollingOnStartup
in class PollingRenderer
AuthRenderer.onRenderCompleted()
public interface BluetoothLeConsentHandler
+
+Modifier and Type | +Method and Description | +
---|---|
void |
+cancel()
+Cancels the Session Sharing authorization request.
+ |
+
void |
+proceed()
+Starts the Session Sharing authorization request.
+ |
+
public class BluetoothLePeripheral
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private android.bluetooth.le.BluetoothLeAdvertiser |
+advertiser |
+
private android.content.Context |
+appContext |
+
private BluetoothLePeripheralCallback |
+callback |
+
private static java.lang.String |
+CANCEL |
+
private android.bluetooth.BluetoothDevice |
+connectedDevice |
+
private static BluetoothLePeripheral |
+instance |
+
private boolean |
+isAuthenticating |
+
private android.bluetooth.BluetoothGattServer |
+server |
+
private static java.lang.String |
+SUCCESS |
+
Modifier | +Constructor and Description | +
---|---|
private |
+BluetoothLePeripheral() |
+
Modifier and Type | +Method and Description | +
---|---|
private BluetoothLePeripheralCallback |
+getCallback(BluetoothLePeripheralCallback callback) |
+
static BluetoothLePeripheral |
+getInstance() |
+
void |
+init(android.content.Context context) |
+
boolean |
+isAuthenticating() |
+
private void |
+notifyWithError(int errorCode) |
+
void |
+start(BluetoothLePeripheralCallback callback) |
+
void |
+stop() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String SUCCESS+
private static final java.lang.String CANCEL+
private static BluetoothLePeripheral instance+
private android.content.Context appContext+
private BluetoothLePeripheralCallback callback+
private android.bluetooth.le.BluetoothLeAdvertiser advertiser+
private android.bluetooth.BluetoothGattServer server+
private android.bluetooth.BluetoothDevice connectedDevice+
private boolean isAuthenticating+
public static BluetoothLePeripheral getInstance()+
public void init(android.content.Context context)+
public boolean isAuthenticating()+
public void start(BluetoothLePeripheralCallback callback)+
public void stop()+
private void notifyWithError(int errorCode)+
private BluetoothLePeripheralCallback getCallback(BluetoothLePeripheralCallback callback)+
public interface BluetoothLePeripheralCallback +extends BluetoothLe+
Modifier and Type | +Field and Description | +
---|---|
static int |
+BLE_ERROR_ADVERTISE_FAILED
+Failed to advertise Bluetooth LE
+ |
+
static int |
+BLE_ERROR_AUTH_FAILED
+Failed to authenticate the session
+ |
+
static int |
+BLE_ERROR_CENTRAL_UNSUBSCRIBED
+Central device is not subscribed to receive the characteristic update.
+ |
+
static int |
+BLE_ERROR_PERIPHERAL_MODE_NOT_SUPPORTED
+Peripheral mode is not supported on the device
+ |
+
static int |
+BLE_STATE_CONNECTED
+Bluetooth LE Central device has been connected.
+ |
+
static int |
+BLE_STATE_DISCONNECTED
+Bluetooth Central device has been disconnected.
+ |
+
static int |
+BLE_STATE_SESSION_AUTHORIZED
+Session sharing authorization success
+ |
+
static int |
+BLE_STATE_SESSION_NOTIFIED
+Session sharing has been notified to the central device
+ |
+
static int |
+BLE_STATE_STARTED
+The Bluetooth Peripheral Device is started and ready to accept session sharing request.
+ |
+
static int |
+BLE_STATE_STOPPED
+The Bluetooth Peripheral Device is stopped
+ |
+
BLE_ERROR_DISABLED, BLE_ERROR_INVALID_UUID, BLE_ERROR_NOT_SUPPORTED, BLE_ERROR_SESSION_SHARING_NOT_SUPPORTED, DEVICE_NAME, EOM, PROVIDER_URL
Modifier and Type | +Method and Description | +
---|---|
void |
+onConsentRequested(java.lang.String deviceName,
+ BluetoothLeConsentHandler handler)
+Notify the host application that an consent request occurred while session
+ sharing.
+ |
+
void |
+onError(int errorCode)
+Notify the host application that any error occur.
+ |
+
onStatusUpdate
static final int BLE_ERROR_ADVERTISE_FAILED+
static final int BLE_ERROR_AUTH_FAILED+
static final int BLE_ERROR_PERIPHERAL_MODE_NOT_SUPPORTED+
static final int BLE_ERROR_CENTRAL_UNSUBSCRIBED+
static final int BLE_STATE_CONNECTED+
static final int BLE_STATE_DISCONNECTED+
static final int BLE_STATE_STARTED+
static final int BLE_STATE_STOPPED+
static final int BLE_STATE_SESSION_AUTHORIZED+
static final int BLE_STATE_SESSION_NOTIFIED+
void onError(int errorCode)+
void onConsentRequested(java.lang.String deviceName, + BluetoothLeConsentHandler handler)+
deviceName
- The remote Bluetooth Device Name.handler
- An BluetoothLeConsentHandler object that will handle the user's
+ response.Interface | +Description | +
---|---|
BluetoothLe | ++ |
BluetoothLeCentralCallback | ++ |
BluetoothLeConsentHandler | +
+ Represents a consent request for handling Session Sharing.
+ |
+
BluetoothLePeripheralCallback | ++ |
Class | +Description | +
---|---|
BluetoothLeCentralRenderer | +
+ BluetoothLe for cross device session sharing
+ |
+
BluetoothLePeripheral | ++ |
public class OtpAuthenticationHandler
+extends java.lang.Object
+implements android.os.Parcelable
+android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
static android.os.Parcelable.Creator<OtpAuthenticationHandler> |
+CREATOR |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
|
+OtpAuthenticationHandler(long requestId,
+ java.util.List<java.lang.String> channels,
+ boolean isInvalidOtp,
+ java.lang.String selectedChannels) |
+
protected |
+OtpAuthenticationHandler(android.os.Parcel in) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+cancel()
+Cancel the fetch otp protected data request.
+ |
+
void |
+deliver(java.lang.String channels,
+ MAGResultReceiver<java.lang.Void> callback)
+Proceed to invoke server to deliver the OTP to the given delivery channel.
+ |
+
int |
+describeContents() |
+
java.util.List<java.lang.String> |
+getChannels() |
+
boolean |
+isInvalidOtp() |
+
void |
+proceed(android.content.Context context,
+ java.lang.String otp)
+Proceed to invoke server to validate the OTP.
+ |
+
void |
+writeToParcel(android.os.Parcel dest,
+ int flags) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final android.os.Parcelable.Creator<OtpAuthenticationHandler> CREATOR+
public OtpAuthenticationHandler(long requestId, + java.util.List<java.lang.String> channels, + boolean isInvalidOtp, + java.lang.String selectedChannels)+
protected OtpAuthenticationHandler(android.os.Parcel in)+
public void proceed(android.content.Context context, + java.lang.String otp)+
context
- Application contextotp
- the OTP to be validatedpublic void deliver(java.lang.String channels, + MAGResultReceiver<java.lang.Void> callback)+
channels
- the name of the delivery channelcallback
- the callback for delivering a success or errorpublic java.util.List<java.lang.String> getChannels()+
public boolean isInvalidOtp()+
public void cancel()+
public int describeContents()+
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, + int flags)+
writeToParcel
in interface android.os.Parcelable
public class OtpConstants
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+ACTION_DISPLAY_OTP_PROTECTED_DATA
+An Intent with this action is used to start a OTP dialog activity when OTP is needed.
+ |
+
static java.lang.String |
+IS_INVALID_OTP |
+
static java.lang.String |
+X_CA_ERR |
+
static java.lang.String |
+X_OTP |
+
static java.lang.String |
+X_OTP_CHANNEL |
+
static java.lang.String |
+X_OTP_RETRY |
+
static java.lang.String |
+X_OTP_RETRY_INTERVAL |
+
Constructor and Description | +
---|
OtpConstants() |
+
public static final java.lang.String ACTION_DISPLAY_OTP_PROTECTED_DATA+
public static final java.lang.String X_OTP+
public static final java.lang.String X_OTP_CHANNEL+
public static final java.lang.String X_OTP_RETRY+
public static final java.lang.String X_OTP_RETRY_INTERVAL+
public static final java.lang.String X_CA_ERR+
public static final java.lang.String IS_INVALID_OTP+
public class OtpUtil
+extends java.lang.Object
+Modifier | +Constructor and Description | +
---|---|
private |
+OtpUtil() |
+
Modifier and Type | +Method and Description | +
---|---|
static OtpResponseHeaders.X_CA_ERROR |
+convertOtpErrorCodeToEnum(java.lang.String errorCode) |
+
private static OtpResponseHeaders.X_OTP_VALUE |
+convertOtpStatusToEnum(java.lang.String otpStatus) |
+
static OtpResponseHeaders |
+getXotpValueFromHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers) |
+
static OtpResponseBody |
+parseOtpResponseBody(java.lang.String body) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static OtpResponseHeaders getXotpValueFromHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)+
private static OtpResponseHeaders.X_OTP_VALUE convertOtpStatusToEnum(java.lang.String otpStatus)+
public static OtpResponseHeaders.X_CA_ERROR convertOtpErrorCodeToEnum(java.lang.String errorCode)+
public static OtpResponseBody parseOtpResponseBody(java.lang.String body)+
public static enum OtpResponseHeaders.X_CA_ERROR +extends java.lang.Enum<OtpResponseHeaders.X_CA_ERROR>+
Enum Constant and Description | +
---|
EXPIRED |
+
GENERATED |
+
INTERNAL_SERVER_ERROR |
+
INVALID_USER_INPUT |
+
OTP_INVALID |
+
OTP_MAX_RETRY_EXCEEDED |
+
REQUIRED |
+
SUSPENDED |
+
UNKNOWN |
+
Modifier and Type | +Method and Description | +
---|---|
static OtpResponseHeaders.X_CA_ERROR |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OtpResponseHeaders.X_CA_ERROR[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OtpResponseHeaders.X_CA_ERROR REQUIRED+
public static final OtpResponseHeaders.X_CA_ERROR GENERATED+
public static final OtpResponseHeaders.X_CA_ERROR OTP_INVALID+
public static final OtpResponseHeaders.X_CA_ERROR OTP_MAX_RETRY_EXCEEDED+
public static final OtpResponseHeaders.X_CA_ERROR EXPIRED+
public static final OtpResponseHeaders.X_CA_ERROR SUSPENDED+
public static final OtpResponseHeaders.X_CA_ERROR UNKNOWN+
public static final OtpResponseHeaders.X_CA_ERROR INVALID_USER_INPUT+
public static final OtpResponseHeaders.X_CA_ERROR INTERNAL_SERVER_ERROR+
public static OtpResponseHeaders.X_CA_ERROR[] values()+
+for (OtpResponseHeaders.X_CA_ERROR c : OtpResponseHeaders.X_CA_ERROR.values()) + System.out.println(c); +
public static OtpResponseHeaders.X_CA_ERROR valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum OtpResponseHeaders.X_OTP_VALUE +extends java.lang.Enum<OtpResponseHeaders.X_OTP_VALUE>+
Enum Constant and Description | +
---|
EXPIRED |
+
GENERATED |
+
INVALID |
+
REQUIRED |
+
SUSPENDED |
+
UNKNOWN |
+
xOtpValue |
+
Modifier and Type | +Method and Description | +
---|---|
static OtpResponseHeaders.X_OTP_VALUE |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static OtpResponseHeaders.X_OTP_VALUE[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final OtpResponseHeaders.X_OTP_VALUE REQUIRED+
public static final OtpResponseHeaders.X_OTP_VALUE GENERATED+
public static final OtpResponseHeaders.X_OTP_VALUE INVALID+
public static final OtpResponseHeaders.X_OTP_VALUE EXPIRED+
public static final OtpResponseHeaders.X_OTP_VALUE SUSPENDED+
public static final OtpResponseHeaders.X_OTP_VALUE UNKNOWN+
public static final OtpResponseHeaders.X_OTP_VALUE xOtpValue+
public static OtpResponseHeaders.X_OTP_VALUE[] values()+
+for (OtpResponseHeaders.X_OTP_VALUE c : OtpResponseHeaders.X_OTP_VALUE.values()) + System.out.println(c); +
public static OtpResponseHeaders.X_OTP_VALUE valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class OtpResponseHeaders
+extends java.lang.Object
+implements android.os.Parcelable
+Modifier and Type | +Class and Description | +
---|---|
static class |
+OtpResponseHeaders.X_CA_ERROR |
+
static class |
+OtpResponseHeaders.X_OTP_VALUE |
+
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
private java.util.List<java.lang.String> |
+channels |
+
static android.os.Parcelable.Creator<OtpResponseHeaders> |
+CREATOR |
+
private OtpResponseHeaders.X_CA_ERROR |
+errorCode |
+
private int |
+httpStatusCode |
+
private int |
+retry |
+
private int |
+retryInterval |
+
private OtpResponseHeaders.X_OTP_VALUE |
+xOtpValue |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
|
+OtpResponseHeaders() |
+
protected |
+OtpResponseHeaders(android.os.Parcel in) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+describeContents() |
+
java.util.List<java.lang.String> |
+getChannels() |
+
OtpResponseHeaders.X_CA_ERROR |
+getErrorCode() |
+
int |
+getHttpStatusCode() |
+
int |
+getRetry() |
+
int |
+getRetryInterval() |
+
OtpResponseHeaders.X_OTP_VALUE |
+getxOtpValue() |
+
void |
+setChannels(java.util.List<java.lang.String> channels) |
+
void |
+setErrorCode(OtpResponseHeaders.X_CA_ERROR errorCode) |
+
void |
+setHttpStatusCode(int httpStatusCode) |
+
void |
+setRetry(int retry) |
+
void |
+setRetryInterval(int retryInterval) |
+
void |
+setxOtpValue(OtpResponseHeaders.X_OTP_VALUE xOtpValue) |
+
void |
+writeToParcel(android.os.Parcel dest,
+ int flags) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private OtpResponseHeaders.X_OTP_VALUE xOtpValue+
private java.util.List<java.lang.String> channels+
private int retry+
private int retryInterval+
private OtpResponseHeaders.X_CA_ERROR errorCode+
private int httpStatusCode+
public static final android.os.Parcelable.Creator<OtpResponseHeaders> CREATOR+
public OtpResponseHeaders()+
protected OtpResponseHeaders(android.os.Parcel in)+
public OtpResponseHeaders.X_OTP_VALUE getxOtpValue()+
public void setxOtpValue(OtpResponseHeaders.X_OTP_VALUE xOtpValue)+
public int getRetry()+
public void setRetry(int retry)+
public OtpResponseHeaders.X_CA_ERROR getErrorCode()+
public void setErrorCode(OtpResponseHeaders.X_CA_ERROR errorCode)+
public int getRetryInterval()+
public void setRetryInterval(int retryInterval)+
public void setChannels(java.util.List<java.lang.String> channels)+
public java.util.List<java.lang.String> getChannels()+
public void writeToParcel(android.os.Parcel dest, + int flags)+
writeToParcel
in interface android.os.Parcelable
public int describeContents()+
describeContents
in interface android.os.Parcelable
public int getHttpStatusCode()+
public void setHttpStatusCode(int httpStatusCode)+
Class | +Description | +
---|---|
OtpResponseBody | +
+ A model object to store the parsed OTP MAG Gateway response data
+ |
+
OtpResponseHeaders | +
+ A model object to store the parsed OTP MAG Gateway response headers data
+ |
+
Enum | +Description | +
---|---|
OtpResponseHeaders.X_CA_ERROR | ++ |
OtpResponseHeaders.X_OTP_VALUE | ++ |
Class | +Description | +
---|---|
OtpConstants | ++ |
OtpUtil | ++ |
Interface | +Description | +
---|---|
AuthResultReceiver | +
+ Abstract interface for cross device result receiver.
+ |
+
Class | +Description | +
---|---|
AuthRenderer | ++ |
NFCRenderer | +
+ NFC for cross device session sharing
+ |
+
NfcResultReceiver | +
+ The default NFC result receiver.
+ |
+
PollingRenderer | +
+ Poll MAG periodically for the Authorization Code
+ |
+
QRCode | +
+ A QRCode ImageView
+ |
+
QRCodeRenderer | +
+ Render the QRCode for cross device session sharing
+ |
+
Exception | +Description | +
---|---|
AuthenticationException | +
+ This exception is thrown when an authentication error occurs while accessing the MAG Server register or token endpoint.
+ |
+
public class CertUtils
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private static java.lang.String |
+PEM_CERT_BEGIN_MARKER |
+
private static java.lang.String |
+PEM_CERT_END_MARKER |
+
Modifier | +Constructor and Description | +
---|---|
private |
+CertUtils() |
+
Modifier and Type | +Method and Description | +
---|---|
static java.security.cert.X509Certificate |
+decodeCertFromPem(java.lang.String certificateText)
+Decode an X.509 certificate that is encoded as Base-64, with or without PEM "BEGIN CERTIFICATE" markers.
+ |
+
static java.security.cert.X509Certificate[] |
+decodeCertificateChain(byte[] chainBytes)
+Decode a certificate chain into a an array of X509Certificate instances.
+ |
+
static byte[] |
+encodeCertificateChain(java.security.cert.X509Certificate[] chain)
+Encode a certificate chain to a byte array.
+ |
+
static byte[] |
+generateCertificateSigningRequest(java.lang.String commonName,
+ java.lang.String deviceId,
+ java.lang.String deviceName,
+ java.lang.String organization,
+ java.security.PublicKey publicKey,
+ java.security.PrivateKey privateKey)
+Generate a PKCS#10 certificate signing request from the specified parameters.
+ |
+
private static java.security.cert.X509Certificate[] |
+toX509CertArray(java.util.Collection<? extends java.security.cert.Certificate> certs)
+Convert the specified Certificate array into an X509Certificate array.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String PEM_CERT_BEGIN_MARKER+
private static final java.lang.String PEM_CERT_END_MARKER+
public static java.security.cert.X509Certificate decodeCertFromPem(java.lang.String certificateText) + throws java.io.IOException+
certificateText
- the certificate in PEM format, optionally with begin and end markers.java.io.IOException
- if PEM or Base-64 decoding fails.public static byte[] generateCertificateSigningRequest(java.lang.String commonName, + java.lang.String deviceId, + java.lang.String deviceName, + java.lang.String organization, + java.security.PublicKey publicKey, + java.security.PrivateKey privateKey) + throws java.security.cert.CertificateException+
commonName
- the username. Required.deviceId
- the device ID. Required.deviceName
- the device name. Required.organization
- the organization. Required.publicKey
- the client's public key. Required.privateKey
- the client's private key. Required.java.security.cert.CertificateException
- if a CSR cannot be createdprivate static java.security.cert.X509Certificate[] toX509CertArray(java.util.Collection<? extends java.security.cert.Certificate> certs)+
certs
- certificate array to convert. Required.java.lang.ClassCastException
- if at least one certificate is not an X509Certificate.public static java.security.cert.X509Certificate[] decodeCertificateChain(byte[] chainBytes)+
chainBytes
- the certificate chain bytes. Required.java.lang.IllegalArgumentException
- if the chain cannot be decodedpublic static byte[] encodeCertificateChain(java.security.cert.X509Certificate[] chain)+
chain
- the chain to encode. Required.java.lang.IllegalArgumentException
- if the chain cannot be encoded.public class PublicKeyHash
+extends java.lang.Object
+implements java.io.Serializable
+fromPublicKey(java.security.PublicKey)
or fromHashString(String, int)
method.Modifier and Type | +Field and Description | +
---|---|
private byte[] |
+hash |
+
private static java.util.regex.Pattern |
+SHA256_HEX_PATTERN |
+
Modifier | +Constructor and Description | +
---|---|
private |
+PublicKeyHash(byte[] hash) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(java.lang.Object o) |
+
static PublicKeyHash |
+fromCertificate(java.security.cert.Certificate certificate)
+Create a new key hash from the specified public key.
+ |
+
static PublicKeyHash |
+fromHashString(java.lang.String hashString,
+ int flags)
+Create a new key hash from the specified hash string.
+ |
+
static PublicKeyHash |
+fromPublicKey(java.security.PublicKey publicKey)
+Create a new key hash from the specified public key.
+ |
+
java.lang.String |
+getHashString() |
+
int |
+hashCode() |
+
boolean |
+matches(byte[] otherHash)
+Check if this key hash matches the specified key hash.
+ |
+
boolean |
+matches(java.security.PublicKey publicKey)
+Check if this key hash matches that of the specified public key.
+ |
+
boolean |
+matches(java.security.cert.X509Certificate certificate)
+Check if this key hash matches that of the public key in the specified certificate.
+ |
+
private static byte[] |
+toHash(java.security.PublicKey publicKey)
+Get the key hash for the specified public key.
+ |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
private static final java.util.regex.Pattern SHA256_HEX_PATTERN+
private final byte[] hash+
public static PublicKeyHash fromPublicKey(java.security.PublicKey publicKey)+
publicKey
- the public key to examine. Required.java.lang.IllegalArgumentException
- if the public key's encoding format is not "X.509".public static PublicKeyHash fromCertificate(java.security.cert.Certificate certificate)+
certificate
- the certificate whose key hash to compute. Required.java.lang.IllegalArgumentException
- if the public key's encoding format is not "X.509".public static PublicKeyHash fromHashString(java.lang.String hashString, + int flags)+
hashString
- the base64 hash string.flags
- controls certain features of the decoded output.
+ Pass Base64.DEFAULT
to decode standard Base64.java.lang.IllegalArgumentException
- if the hash string is not in the expected format.public boolean matches(byte[] otherHash)+
otherHash
- the other key hash, as a lowercase hex dump of an SHA-256 hash of the SubjectPublicKeyInfo structure.public boolean matches(java.security.PublicKey publicKey)+
publicKey
- the public key to compare against. Required.public boolean matches(java.security.cert.X509Certificate certificate)+
certificate
- the certificate whose public key to compare against. Required.public java.lang.String getHashString()+
private static byte[] toHash(java.security.PublicKey publicKey)+
publicKey
- a public key. Required.java.lang.IllegalArgumentException
- if the public key's encoding format is not "X.509".public boolean equals(java.lang.Object o)+
equals
in class java.lang.Object
public int hashCode()+
hashCode
in class java.lang.Object
public interface TrustedCertificateConfiguration
+Modifier and Type | +Method and Description | +
---|---|
java.util.Collection<java.security.cert.X509Certificate> |
+getTrustedCertificateAnchors()
+Get the server certificate trust anchors that should be trusted for outbound TLS.
+ |
+
java.util.Collection<PublicKeyHash> |
+getTrustedCertificatePinnedPublicKeyHashes()
+Get server certificate pinned public keys.
+ |
+
boolean |
+isAlsoTrustPublicPki()
+Check whether public CAs recognized by the OS should be accepted as TLS server certs in addition
+ to the list returned by
+getTrustedCertificateAnchors() . |
+
java.util.Collection<java.security.cert.X509Certificate> getTrustedCertificateAnchors()+
isAlsoTrustPublicPki()
returns false, then only TLS server certs on this list
+ (or directly or indirectly signed by certs on this list) will be trusted for outbound TLS.boolean isAlsoTrustPublicPki()+
getTrustedCertificateAnchors()
.getTrustedCertificateAnchors()
should be trusted.java.util.Collection<PublicKeyHash> getTrustedCertificatePinnedPublicKeyHashes()+
isAlsoTrustPublicPki()
returns true. If you don't trust public
+ PKI certs and are relying on internal PKI or self-signed certificates built into the app then you probably
+ do not need to worry about certificate pinning.
+
+ If this list is nonempty then a TLS server cert will be accepted only if one of the pinned public keys
+ appears somewhere in its certificate chain.
+
+ This prevents CAs -- any public CA, not necessarily the CA that signed the server cert originally -- from being
+ able to create a forged server certificate for an arbitrary target domain.Interface | +Description | +
---|---|
TrustedCertificateConfiguration | +
+ Interface that describes trusted TLS server certs (including self-signed certs and public PKI, with or without
+ public key pinning).
+ |
+
Class | +Description | +
---|---|
CertUtils | +
+ Utility methods for working with certificate and CSRs.
+ |
+
PublicKeyHash | +
+ Represents an SHA-256 fingerprint of a public key from a trusted CA cert.
+ |
+
public abstract class ServerClient
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+ACTIVATED |
+
static java.lang.String |
+APPLICATION_X_WWW_FORM_URLENCODED |
+
static java.lang.String |
+ASSERTION |
+
static java.lang.String |
+CERT_FORMAT |
+
static java.lang.String |
+CLIENT_AUTHORIZATION |
+
static java.lang.String |
+CLIENT_EXPIRATION |
+
static java.lang.String |
+CLIENT_ID |
+
static java.lang.String |
+CLIENT_SECRET |
+
protected ConfigurationProvider |
+conf |
+
static java.lang.String |
+CONTENT_TYPE |
+
static java.lang.String |
+CREATE_SESSION |
+
static java.lang.String |
+DEFAULT_CONTENT_TYPE |
+
static java.lang.String |
+DEVICE_ID |
+
static java.lang.String |
+DEVICE_NAME |
+
static java.lang.String |
+DEVICE_STATUS |
+
static java.lang.String |
+GRANT_TYPE |
+
static java.lang.String |
+ID_TOKEN |
+
static java.lang.String |
+ID_TOKEN_TYPE |
+
static java.lang.String |
+MAG_IDENTIFIER |
+
static java.lang.String |
+MSSO |
+
static java.lang.String |
+MSSO_CLIENT_REGISTER |
+
static java.lang.String |
+MSSO_REGISTER |
+
protected MssoContext |
+mssoContext |
+
static java.lang.String |
+NONCE |
+
static java.lang.String |
+OPENID |
+
static java.lang.String |
+OPENID_PHONE_EMAIL |
+
static java.lang.String |
+PEM |
+
static java.lang.String |
+REFRESH_TOKEN |
+
static java.lang.String |
+REGISTERED |
+
static java.lang.String |
+SCOPE |
+
static java.lang.String |
+TEXT_PLAIN |
+
static java.lang.String |
+UTF_8 |
+
static java.lang.String |
+X_CA_ERR |
+
Constructor and Description | +
---|
ServerClient(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
static <T extends MAGServerException> |
+createServerException(MASResponse response,
+ java.lang.Class<T> c) |
+
static int |
+findErrorCode(MASResponse response) |
+
private ServerResponse |
+obtainServerResponse(MASRequest request) |
+
protected ServerResponse |
+obtainServerResponseToPostedForm(MASRequest request) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String X_CA_ERR+
public static final java.lang.String DEFAULT_CONTENT_TYPE+
public static final java.lang.String UTF_8+
public static final java.lang.String APPLICATION_X_WWW_FORM_URLENCODED+
public static final java.lang.String OPENID+
public static final java.lang.String MSSO+
public static final java.lang.String MSSO_REGISTER+
public static final java.lang.String MSSO_CLIENT_REGISTER+
public static final java.lang.String MAG_IDENTIFIER+
public static final java.lang.String REFRESH_TOKEN+
public static final java.lang.String CLIENT_ID+
public static final java.lang.String CLIENT_SECRET+
public static final java.lang.String GRANT_TYPE+
public static final java.lang.String ASSERTION+
public static final java.lang.String SCOPE+
public static final java.lang.String OPENID_PHONE_EMAIL+
public static final java.lang.String DEVICE_ID+
public static final java.lang.String CONTENT_TYPE+
public static final java.lang.String NONCE+
public static final java.lang.String CLIENT_EXPIRATION+
public static final java.lang.String CLIENT_AUTHORIZATION+
public static final java.lang.String DEVICE_NAME+
public static final java.lang.String CREATE_SESSION+
public static final java.lang.String CERT_FORMAT+
public static final java.lang.String PEM+
public static final java.lang.String TEXT_PLAIN+
public static final java.lang.String DEVICE_STATUS+
public static final java.lang.String ACTIVATED+
public static final java.lang.String REGISTERED+
public static final java.lang.String ID_TOKEN+
public static final java.lang.String ID_TOKEN_TYPE+
protected final MssoContext mssoContext+
protected final ConfigurationProvider conf+
public ServerClient(MssoContext mssoContext)+
public static <T extends MAGServerException> T createServerException(MASResponse response, + java.lang.Class<T> c)+
public static int findErrorCode(MASResponse response)+
protected ServerResponse obtainServerResponseToPostedForm(MASRequest request) + throws OAuthException, + OAuthServerException+
OAuthException
OAuthServerException
private ServerResponse obtainServerResponse(MASRequest request) + throws OAuthException, + OAuthServerException+
OAuthException
OAuthServerException
public class ServerResponse
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected int |
+errorCode |
+
protected java.lang.String |
+json |
+
protected org.json.JSONObject |
+parsed |
+
protected int |
+status |
+
Constructor and Description | +
---|
ServerResponse(int status,
+ int errorCode,
+ java.lang.String json)
+Create a JSON response from the specified HTTP status code and JSON string.
+ |
+
ServerResponse(int status,
+ java.lang.String json) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getErrorCode() |
+
java.lang.String |
+getJson() |
+
int |
+getStatus() |
+
boolean |
+isError()
+Check for an error field in the JSON response.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected int status+
protected int errorCode+
protected final java.lang.String json+
protected final org.json.JSONObject parsed+
public ServerResponse(int status, + java.lang.String json) + throws org.json.JSONException+
org.json.JSONException
public ServerResponse(int status, + int errorCode, + java.lang.String json) + throws org.json.JSONException+
status
- HTTP status code, eg 401.errorCode
- Header x-ca-err codejson
- string respresenting a single JSON object, eg { "error":"invalid_request", "error_description":"Validation error" }
org.json.JSONException
- if the JSON string cannot be parsed as a JSON objectpublic int getStatus()+
public java.lang.String getJson()+
public boolean isError()+
getStatus()
value.public int getErrorCode()+
Class | +Description | +
---|---|
ServerClient | +
+ Utility class that encapsulates talking to the token server into Java method calls.
+ |
+
ServerResponse | +
+ Represents a JSON response from the token server.
+ |
+
public class ClientCredentialsClient +extends ServerClient+
ACTIVATED, APPLICATION_X_WWW_FORM_URLENCODED, ASSERTION, CERT_FORMAT, CLIENT_AUTHORIZATION, CLIENT_EXPIRATION, CLIENT_ID, CLIENT_SECRET, conf, CONTENT_TYPE, CREATE_SESSION, DEFAULT_CONTENT_TYPE, DEVICE_ID, DEVICE_NAME, DEVICE_STATUS, GRANT_TYPE, ID_TOKEN, ID_TOKEN_TYPE, MAG_IDENTIFIER, MSSO, MSSO_CLIENT_REGISTER, MSSO_REGISTER, mssoContext, NONCE, OPENID, OPENID_PHONE_EMAIL, PEM, REFRESH_TOKEN, REGISTERED, SCOPE, TEXT_PLAIN, UTF_8, X_CA_ERR
Constructor and Description | +
---|
ClientCredentialsClient(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
ClientCredentials |
+getClientCredentials(java.lang.String masterClientId,
+ java.lang.String nonce,
+ java.lang.String deviceId) |
+
createServerException, findErrorCode, obtainServerResponseToPostedForm
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ClientCredentialsClient(MssoContext mssoContext)+
public ClientCredentials getClientCredentials(@NonNull + java.lang.String masterClientId, + java.lang.String nonce, + @NonNull + java.lang.String deviceId) + throws ClientCredentialsException, + ClientCredentialsServerException+ +
public class ClientCredentialsException +extends MAGException+
Constructor and Description | +
---|
ClientCredentialsException(int errorCode) |
+
ClientCredentialsException(int errorCode,
+ java.lang.String detailMessage) |
+
ClientCredentialsException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
ClientCredentialsException(int errorCode,
+ java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ClientCredentialsException(int errorCode)+
public ClientCredentialsException(int errorCode, + java.lang.String detailMessage)+
public ClientCredentialsException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public ClientCredentialsException(int errorCode, + java.lang.Throwable throwable)+
public class ClientCredentialsServerException +extends MAGServerException+
Constructor and Description | +
---|
ClientCredentialsServerException(MAGServerException e) |
+
ClientCredentialsServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage) |
+
ClientCredentialsServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
getContentType, getErrorCode, getResponse, getStatus
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ClientCredentialsServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage)+
public ClientCredentialsServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public ClientCredentialsServerException(MAGServerException e)+
Class | +Description | +
---|---|
ClientCredentialsClient | +
+ Utility class that encapsulates talking to the token server into Java method calls.
+ |
+
Exception | +Description | +
---|---|
ClientCredentialsException | +
+ This exception is thrown when an error occurs while initializing the dynamic client id and client credentials.
+ |
+
ClientCredentialsServerException | +
+ This exception is thrown when an error occurs while accessing the MAG Server initialize endpoint
+ |
+
public class Config
+extends java.lang.Object
+public static final Config HOSTNAME+
public static final Config PORT+
public static final Config PREFIX+
public static final Config SERVER_CERTS+
public static final Config ORGANIZATION+
public static final Config CLIENT_KEY+
public static final Config CLIENT_SECRET+
public static final Config SCOPE+
public static final Config REDIRECT_URI+
public static final Config AUTHORIZE_PATH+
public static final Config REGISTER_TOKEN_PATH+
public static final Config REGISTER_TOKEN_PATH_SSO+
public static final Config LOGOUT_DEVICE_PATH+
public static final Config REMOVE_DEVICE_PATH+
public static final Config REGISTER_DEVICE_PATH+
public static final Config RENEW_DEVICE_PATH+
public static final Config REGISTER_DEVICE_PATH_CLIENT+
public static final Config CLIENT_CREDENTIAL_INIT_PATH+
public static final Config AUTHENTICATE_OTP_PATH+
public static final Config ENTERPRISE_APP_PATH+
public static final Config SSO_ENABLED+
public static final Config LOCATION_ENABLED+
public static final Config LOCATION_PROVIDER+
public static final Config MSISDN_ENABLED+
public static final Config TRUSTED_PUBLIC_PKI+
public static final Config TRUSTED_CERT_PINNED_PUBLIC_KEY_HASHES+
public static final Config CLIENT_CERT_RSA_KEYBITS+
public static final Config CLIENT_STORAGE+
public static final Config BLE_SERVICE_UUID+
public static final Config BLE_USER_SESSION_CHARACTERISTIC_UUID+
public static final Config BLE_RSSI+
public static Config[] values+
public boolean mandatory+
public java.lang.String key+
public java.lang.String path+
public java.lang.Class type+
public Config(boolean mandatory, + java.lang.String key, + java.lang.String path, + java.lang.Class type)+
mandatory
- key
- The Bundle Keypath
- The path which may to the JSON Configuration.type
- Type of the attribute.public class ConfigurationManager
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
private static class |
+ConfigurationManager.ClientChangeListener
+For any client id change, we consider there is an update of the client,
+ clean up the stored client id, client secret, and tokens.
+ |
+
private static interface |
+ConfigurationManager.ConfigurationListener
+Listener to listen for configuration update
+ |
+
Modifier and Type | +Field and Description | +
---|---|
private java.util.List<Config> |
+appConfigs |
+
private android.content.Context |
+appContext |
+
private int |
+certificateAdvancedRenewTimeframe |
+
private java.lang.String |
+configurationFileName |
+
private java.util.List<ConfigurationManager.ConfigurationListener> |
+configurationListeners |
+
private static java.lang.String |
+CONNECTED_GATEWAY_CONFIG |
+
private ConfigurationProvider |
+connectedGatewayConfigurationProvider |
+
private MASConnectionListener |
+connectionListener |
+
private MASGrantProvider |
+defaultGrantProvider |
+
private boolean |
+enablePKCE |
+
private static ConfigurationManager |
+instance |
+
private MobileSsoListener |
+mobileSsoListener |
+
private java.util.LinkedHashMap<java.lang.Class,ResponseInterceptor> |
+responseInterceptors |
+
Modifier | +Constructor and Description | +
---|---|
private |
+ConfigurationManager() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+activate(org.json.JSONObject jsonObject) |
+
void |
+activateDefault() |
+
ConfigurationProvider |
+create(org.json.JSONObject jsonObject) |
+
void |
+enablePKCE(boolean enablePKCE) |
+
int |
+getCertificateAdvancedRenewTimeframe() |
+
org.json.JSONObject |
+getConfig(java.io.InputStream is) |
+
private org.json.JSONObject |
+getConfig(java.lang.String filename) |
+
java.lang.String |
+getConfigurationFileName() |
+
Server |
+getConnectedGateway() |
+
org.json.JSONObject |
+getConnectedGatewayConfig() |
+
ConfigurationProvider |
+getConnectedGatewayConfigurationProvider() |
+
MASConnectionListener |
+getConnectionListener() |
+
android.content.Context |
+getContext() |
+
MASGrantProvider |
+getDefaultGrantProvider() |
+
static ConfigurationManager |
+getInstance() |
+
MobileSsoListener |
+getMobileSsoListener() |
+
java.util.Collection<ResponseInterceptor> |
+getResponseInterceptors() |
+
private <T> T |
+getValue(Config attr,
+ org.json.JSONObject jsonObject) |
+
private <T> T |
+getValue(Config attr,
+ org.json.JSONObject jsonObject,
+ java.lang.Object def)
+Perform configure attribute validation and populate the Configure Bundle
+ for the SDK from the provided JSON Configuration.
+ |
+
private static java.lang.Object |
+getValue(java.lang.String path,
+ boolean mandatory,
+ java.lang.Object parent)
+Retrieve the value from the JSON Configuration by the JSON path.
+ |
+
void |
+init(android.content.Context context) |
+
boolean |
+isPKCEEnabled() |
+
private void |
+load() |
+
void |
+registerResponseInterceptor(ResponseInterceptor responseInterceptor)
+Register a
+ResponseInterceptor for any API response. |
+
void |
+reset() |
+
void |
+setAppConfigs(java.util.List<Config> appConfigs) |
+
void |
+setCertificateAdvancedRenewTimeframe(int certificateAdvancedRenewTimeframe) |
+
void |
+setConfigurationFileName(java.lang.String configurationFileName) |
+
void |
+setConnectionListener(MASConnectionListener connectionListener) |
+
void |
+setDefaultGrantProvider(MASGrantProvider defaultGrantProvider) |
+
void |
+setMobileSsoListener(MobileSsoListener mobileSsoListener) |
+
private void |
+store(org.json.JSONObject config) |
+
void |
+unregisterResponseInterceptor(ResponseInterceptor responseInterceptor)
+Unregister a previously registered
+ResponseInterceptor . |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String CONNECTED_GATEWAY_CONFIG+
private ConfigurationProvider connectedGatewayConfigurationProvider+
private android.content.Context appContext+
private java.util.List<Config> appConfigs+
private java.lang.String configurationFileName+
private boolean enablePKCE+
private MASConnectionListener connectionListener+
private MobileSsoListener mobileSsoListener+
private java.util.LinkedHashMap<java.lang.Class,ResponseInterceptor> responseInterceptors+
private MASGrantProvider defaultGrantProvider+
private static ConfigurationManager instance+
private java.util.List<ConfigurationManager.ConfigurationListener> configurationListeners+
private int certificateAdvancedRenewTimeframe+
public static ConfigurationManager getInstance()+
public android.content.Context getContext()+
public void enablePKCE(boolean enablePKCE)+
public boolean isPKCEEnabled()+
public void reset()+
public void init(android.content.Context context)+
public void setAppConfigs(java.util.List<Config> appConfigs)+
public Server getConnectedGateway()+
public org.json.JSONObject getConnectedGatewayConfig()+
public ConfigurationProvider getConnectedGatewayConfigurationProvider()+
private void store(org.json.JSONObject config)+
private void load()+
public void activateDefault()+
public void activate(org.json.JSONObject jsonObject)+
private org.json.JSONObject getConfig(java.lang.String filename)+
public org.json.JSONObject getConfig(java.io.InputStream is)+
public ConfigurationProvider create(org.json.JSONObject jsonObject) + throws org.json.JSONException+
org.json.JSONException
private <T> T getValue(Config attr, + org.json.JSONObject jsonObject) + throws org.json.JSONException+
org.json.JSONException
private <T> T getValue(Config attr, + org.json.JSONObject jsonObject, + java.lang.Object def) + throws org.json.JSONException+
attr
- The Configuration attributejsonObject
- The JSON Configuration object.org.json.JSONException
- When the JSON Configuration is invalid.private static java.lang.Object getValue(java.lang.String path, + boolean mandatory, + java.lang.Object parent) + throws org.json.JSONException+
path
- The JSON path.mandatory
- True for mandatory and False for not mandatory.parent
- The parent JSON Object, it can be a JSON Object or JSON Array.org.json.JSONException
- When the JSON message is invalid.public java.lang.String getConfigurationFileName()+
public void setConfigurationFileName(java.lang.String configurationFileName)+
public MASConnectionListener getConnectionListener()+
public void setConnectionListener(MASConnectionListener connectionListener)+
public MobileSsoListener getMobileSsoListener()+
public void setMobileSsoListener(MobileSsoListener mobileSsoListener)+
public MASGrantProvider getDefaultGrantProvider()+
public void setDefaultGrantProvider(MASGrantProvider defaultGrantProvider)+
public int getCertificateAdvancedRenewTimeframe()+
public void setCertificateAdvancedRenewTimeframe(int certificateAdvancedRenewTimeframe)+
public void registerResponseInterceptor(ResponseInterceptor responseInterceptor)+
ResponseInterceptor
for any API response.responseInterceptor
- The ResponseInterceptor
to handle the response.public void unregisterResponseInterceptor(ResponseInterceptor responseInterceptor)+
ResponseInterceptor
.responseInterceptor
- The ResponseInterceptor
to unregister.public java.util.Collection<ResponseInterceptor> getResponseInterceptors()+
public interface ConfigurationProvider +extends TrustedCertificateConfiguration, MobileSsoConfig+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+PROP_LOCATION_MIN_DISTANCE
+Float, meters.
+ |
+
static java.lang.String |
+PROP_LOCATION_MIN_TIME
+Long, milliseconds.
+ |
+
AUTHENTICATE_OTP_PATH, PROP_AUTHORIZE_REDIRECT_URI, PROP_BLE_CHARACTERISTIC_UUID, PROP_BLE_RSSI, PROP_BLE_SERVICE_UUID, PROP_CLIENT_CERT_RSA_KEYBITS, PROP_CLIENT_ID, PROP_CLIENT_SECRET, PROP_LOCATION_ENABLED, PROP_LOCATION_PROVIDER_NAME, PROP_MSISDN_ENABLED, PROP_OAUTH_SCOPE, PROP_ORGANIZATION, PROP_RESPONSE_BUFFERING_ENABLED, PROP_RESPONSE_BUFFERING_MAX_SIZE, PROP_SSO_ENABLED, PROP_STORAGE, PROP_TOKEN_HOSTNAME, PROP_TOKEN_PORT_HTTP, PROP_TOKEN_PORT_HTTPS, PROP_TOKEN_URI_PREFIX, PROP_TOKEN_URL_SUFFIX_AUTHORIZE, PROP_TOKEN_URL_SUFFIX_CLIENT_CREDENTIALS, PROP_TOKEN_URL_SUFFIX_ENTERPRISE_APPS, PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE, PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE_CLIENT, PROP_TOKEN_URL_SUFFIX_REMOVE_DEVICE_X509, PROP_TOKEN_URL_SUFFIX_RENEW_DEVICE, PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN, PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN_SSO, PROP_TOKEN_URL_SUFFIX_RESOURCE_OWNER_LOGOUT, PROP_TRUSTED_CERT_PINNED_PUBLIC_KEY_HASHES, PROP_TRUSTED_CERTS_PEM, PROP_TRUSTED_PUBLIC_PKI
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getClientId() |
+
java.lang.String |
+getClientScope() |
+
java.lang.String |
+getClientSecret() |
+
java.lang.String |
+getPrefix()
+Based on the provided configuration the the SDK, retrieve the prefix attribute.
+ |
+
<T> T |
+getProperty(java.lang.String propertyName)
+Get an arbitrary configuration property.
+ |
+
org.json.JSONObject |
+getRaw() |
+
Server |
+getServer() |
+
java.lang.String |
+getTokenHost() |
+
int |
+getTokenPort() |
+
java.net.URI |
+getTokenUri(java.lang.String operation)
+Get the complete URI for the given operation.
+ |
+
java.net.URI |
+getUri(java.lang.String relativePath)
+Retrieves the absolute URI for the given relative path based on the provided SDK configuration.
+ |
+
java.net.URI |
+getUserInfoUri()
+Get the complete URI for the given operation.
+ |
+
getTrustedCertificateAnchors, getTrustedCertificatePinnedPublicKeyHashes, isAlsoTrustPublicPki
static final java.lang.String PROP_LOCATION_MIN_TIME+
static final java.lang.String PROP_LOCATION_MIN_DISTANCE+
org.json.JSONObject getRaw()+
Server getServer()+
java.lang.String getTokenHost()+
int getTokenPort()+
java.lang.String getClientId()+
java.lang.String getClientSecret()+
java.lang.String getClientScope()+
<T> T getProperty(java.lang.String propertyName)+
T
- the expected return type of the property value.propertyName
- the name of the property to get. Required.java.net.URI getTokenUri(java.lang.String operation)+
operation
- the operation name, eg MobileSsoConfig.PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN
.java.net.URI getUserInfoUri()+
java.net.URI getUri(java.lang.String relativePath)+
relativePath
- the relative path to the resource.java.lang.String getPrefix()+
public class DefaultConfiguration +extends java.lang.Object +implements ConfigurationProvider+
Modifier and Type | +Field and Description | +
---|---|
private boolean |
+alsoTrustPublicPki |
+
private java.lang.String |
+clientId |
+
private java.lang.String |
+clientSecret |
+
private java.util.Map<java.lang.String,java.lang.String> |
+operationUriSuffixes |
+
private java.util.Map<java.lang.String,java.lang.Object> |
+properties |
+
private org.json.JSONObject |
+raw |
+
private java.lang.String |
+redirectUri |
+
private java.lang.String |
+scope |
+
private Server |
+server |
+
private java.lang.String |
+tokenHost |
+
private java.util.List<java.security.cert.X509Certificate> |
+trustedCertificateAnchors |
+
private java.util.Set<PublicKeyHash> |
+trustedCertificatePinnedPublicKeyHashes |
+
PROP_LOCATION_MIN_DISTANCE, PROP_LOCATION_MIN_TIME
AUTHENTICATE_OTP_PATH, PROP_AUTHORIZE_REDIRECT_URI, PROP_BLE_CHARACTERISTIC_UUID, PROP_BLE_RSSI, PROP_BLE_SERVICE_UUID, PROP_CLIENT_CERT_RSA_KEYBITS, PROP_CLIENT_ID, PROP_CLIENT_SECRET, PROP_LOCATION_ENABLED, PROP_LOCATION_PROVIDER_NAME, PROP_MSISDN_ENABLED, PROP_OAUTH_SCOPE, PROP_ORGANIZATION, PROP_RESPONSE_BUFFERING_ENABLED, PROP_RESPONSE_BUFFERING_MAX_SIZE, PROP_SSO_ENABLED, PROP_STORAGE, PROP_TOKEN_HOSTNAME, PROP_TOKEN_PORT_HTTP, PROP_TOKEN_PORT_HTTPS, PROP_TOKEN_URI_PREFIX, PROP_TOKEN_URL_SUFFIX_AUTHORIZE, PROP_TOKEN_URL_SUFFIX_CLIENT_CREDENTIALS, PROP_TOKEN_URL_SUFFIX_ENTERPRISE_APPS, PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE, PROP_TOKEN_URL_SUFFIX_REGISTER_DEVICE_CLIENT, PROP_TOKEN_URL_SUFFIX_REMOVE_DEVICE_X509, PROP_TOKEN_URL_SUFFIX_RENEW_DEVICE, PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN, PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN_SSO, PROP_TOKEN_URL_SUFFIX_RESOURCE_OWNER_LOGOUT, PROP_TRUSTED_CERT_PINNED_PUBLIC_KEY_HASHES, PROP_TRUSTED_CERTS_PEM, PROP_TRUSTED_PUBLIC_PKI
Constructor and Description | +
---|
DefaultConfiguration(org.json.JSONObject raw,
+ java.lang.String tokenHost,
+ java.lang.Integer port,
+ java.lang.String tokenUriPrefix,
+ java.lang.String clientId,
+ java.lang.String clientSecret,
+ java.lang.String organization,
+ java.lang.String scope,
+ java.lang.String redirectUri)
+Create a DefaultConfiguration that uses the specified token hostname, client ID, client secret,
+ and organization name.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addTrustedCertificateAnchors(java.lang.String... certs)
+Add one or more trusted certificates to be returned by
+getTrustedCertificateAnchors() . |
+
void |
+addTrustedCertificatePinnedPublicKeyHashes(java.lang.String... hashes)
+Add one or more pinned trusted certificate public keys to be returned by
+getTrustedCertificatePinnedPublicKeyHashes() . |
+
java.lang.String |
+getClientId() |
+
java.lang.String |
+getClientScope() |
+
java.lang.String |
+getClientSecret() |
+
java.lang.String |
+getPrefix()
+Based on the provided configuration the the SDK, retrieve the prefix attribute.
+ |
+
<T> T |
+getProperty(java.lang.String propertyName)
+Get an arbitrary configuration property.
+ |
+
org.json.JSONObject |
+getRaw() |
+
java.lang.String |
+getRedirectUri() |
+
java.lang.String |
+getScope() |
+
Server |
+getServer() |
+
java.lang.String |
+getTokenHost() |
+
int |
+getTokenPort() |
+
java.net.URI |
+getTokenUri(java.lang.String operation)
+Get the complete URI for the given operation.
+ |
+
java.util.Collection<java.security.cert.X509Certificate> |
+getTrustedCertificateAnchors()
+Get the server certificate trust anchors that should be trusted for outbound TLS.
+ |
+
java.util.Collection<PublicKeyHash> |
+getTrustedCertificatePinnedPublicKeyHashes()
+Get server certificate pinned public keys.
+ |
+
java.net.URI |
+getUri(java.lang.String relativePath)
+Retrieves the absolute URI for the given relative path based on the provided SDK configuration.
+ |
+
java.net.URI |
+getUserInfoUri()
+Get the complete URI for the given operation.
+ |
+
private static boolean |
+isAbsolute(java.lang.String suffix) |
+
boolean |
+isAlsoTrustPublicPki()
+Check whether public CAs recognized by the OS should be accepted as TLS server certs in addition
+ to the list returned by
+TrustedCertificateConfiguration.getTrustedCertificateAnchors() . |
+
<T> void |
+putProperty(java.lang.String propertyName,
+ T value)
+Set a configuration property.
+ |
+
void |
+setAlsoTrustPublicPki(boolean alsoTrustPublicPki)
+Set whether public CAs recognized by the OS should be accepted as TLS server certs in addition
+ to the list returned by
+getTrustedCertificateAnchors() . |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final java.lang.String clientId+
private final java.lang.String clientSecret+
private final java.lang.String tokenHost+
private final java.lang.String scope+
private final java.lang.String redirectUri+
private final java.util.Map<java.lang.String,java.lang.Object> properties+
private final org.json.JSONObject raw+
private final Server server+
private java.util.Map<java.lang.String,java.lang.String> operationUriSuffixes+
private java.util.List<java.security.cert.X509Certificate> trustedCertificateAnchors+
private boolean alsoTrustPublicPki+
private java.util.Set<PublicKeyHash> trustedCertificatePinnedPublicKeyHashes+
public DefaultConfiguration(org.json.JSONObject raw, + java.lang.String tokenHost, + java.lang.Integer port, + java.lang.String tokenUriPrefix, + java.lang.String clientId, + java.lang.String clientSecret, + java.lang.String organization, + java.lang.String scope, + java.lang.String redirectUri)+
tokenHost
- the token host, eg "oath.example.com". Required.tokenUriPrefix
- URI prefix of token server URIs, eg "/custom", or null to use the empty string.clientId
- the application's client id for the initial OAuth token request, eg "846955e8-a8fb-4bea-bdd7-a16b39770c3d". Required.clientSecret
- the application's client secret for the initial OAuth token request, eg "6ed4ffcb-4110-4c68-b280-cda17f127374". Required.organization
- the organization name for the O component of the client certificate DN, eg "Exampletronics Ltd". Optional.scope
- the scope for the O component of the client certificate DN, eg "msso phone profile address email ". Optional.redirectUri
- the redirectUri name for the O component of the client certificate DN, eg "camsso://com.ca.mas". Optional.public void setAlsoTrustPublicPki(boolean alsoTrustPublicPki)+
getTrustedCertificateAnchors()
.alsoTrustPublicPki
- true to trust public PKI CAs in additional to the list returned from getTrustedCertificateAnchors()
.
+ false to trust only the list returned from getTrustedCertificateAnchors()
.public void addTrustedCertificateAnchors(java.lang.String... certs) + throws MAGRuntimeException+
getTrustedCertificateAnchors()
.certs
- trusted certificates to add, in Base-64 format with or without PEM markers.MAGRuntimeException
- if PEM or X.509 decoding fails for at least one cert.public void addTrustedCertificatePinnedPublicKeyHashes(java.lang.String... hashes)+
getTrustedCertificatePinnedPublicKeyHashes()
.hashes
- public key pin hashes to add, as hex-encoded SHA-256 hashes of the SubjectPublicKeyInfo structure from the certificate.public java.lang.String getClientId()+
getClientId
in interface ConfigurationProvider
public java.lang.String getClientSecret()+
getClientSecret
in interface ConfigurationProvider
public java.lang.String getClientScope()+
getClientScope
in interface ConfigurationProvider
public <T> T getProperty(java.lang.String propertyName)+
ConfigurationProvider
getProperty
in interface ConfigurationProvider
T
- the expected return type of the property value.propertyName
- the name of the property to get. Required.public <T> void putProperty(java.lang.String propertyName, + T value)+
T
- the expected type of the property valuepropertyName
- the property name. Required.value
- the property valuepublic org.json.JSONObject getRaw()+
getRaw
in interface ConfigurationProvider
public Server getServer()+
getServer
in interface ConfigurationProvider
public java.lang.String getTokenHost()+
getTokenHost
in interface ConfigurationProvider
public java.lang.String getScope()+
public java.lang.String getRedirectUri()+
public int getTokenPort()+
getTokenPort
in interface ConfigurationProvider
public java.net.URI getTokenUri(java.lang.String operation)+
ConfigurationProvider
getTokenUri
in interface ConfigurationProvider
operation
- the operation name, eg MobileSsoConfig.PROP_TOKEN_URL_SUFFIX_REQUEST_TOKEN
.public java.net.URI getUserInfoUri()+
ConfigurationProvider
getUserInfoUri
in interface ConfigurationProvider
public java.net.URI getUri(java.lang.String relativePath)+
ConfigurationProvider
getUri
in interface ConfigurationProvider
relativePath
- the relative path to the resource.public java.lang.String getPrefix()+
ConfigurationProvider
getPrefix
in interface ConfigurationProvider
private static boolean isAbsolute(java.lang.String suffix)+
public java.util.Collection<java.security.cert.X509Certificate> getTrustedCertificateAnchors()+
TrustedCertificateConfiguration
TrustedCertificateConfiguration.isAlsoTrustPublicPki()
returns false, then only TLS server certs on this list
+ (or directly or indirectly signed by certs on this list) will be trusted for outbound TLS.getTrustedCertificateAnchors
in interface TrustedCertificateConfiguration
public boolean isAlsoTrustPublicPki()+
TrustedCertificateConfiguration
TrustedCertificateConfiguration.getTrustedCertificateAnchors()
.isAlsoTrustPublicPki
in interface TrustedCertificateConfiguration
TrustedCertificateConfiguration.getTrustedCertificateAnchors()
should be trusted.public java.util.Collection<PublicKeyHash> getTrustedCertificatePinnedPublicKeyHashes()+
TrustedCertificateConfiguration
TrustedCertificateConfiguration.isAlsoTrustPublicPki()
returns true. If you don't trust public
+ PKI certs and are relying on internal PKI or self-signed certificates built into the app then you probably
+ do not need to worry about certificate pinning.
+
+ If this list is nonempty then a TLS server cert will be accepted only if one of the pinned public keys
+ appears somewhere in its certificate chain.
+
+ This prevents CAs -- any public CA, not necessarily the CA that signed the server cert originally -- from being
+ able to create a forged server certificate for an arbitrary target domain.getTrustedCertificatePinnedPublicKeyHashes
in interface TrustedCertificateConfiguration
public class Server
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+host |
+
private int |
+port |
+
private java.lang.String |
+prefix |
+
Constructor and Description | +
---|
Server(org.json.JSONObject config) |
+
Server(java.lang.String host,
+ int port,
+ java.lang.String prefix) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(java.lang.Object o) |
+
java.lang.String |
+getHost() |
+
int |
+getPort() |
+
java.lang.String |
+getPrefix() |
+
int |
+hashCode() |
+
void |
+setHost(java.lang.String host) |
+
void |
+setPort(int port) |
+
void |
+setPrefix(java.lang.String prefix) |
+
java.lang.String |
+toString() |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
private java.lang.String host+
private int port+
private java.lang.String prefix+
public Server(org.json.JSONObject config)+
public Server(java.lang.String host, + int port, + java.lang.String prefix)+
public java.lang.String getHost()+
public void setHost(java.lang.String host)+
public int getPort()+
public void setPort(int port)+
public java.lang.String getPrefix()+
public void setPrefix(java.lang.String prefix)+
public boolean equals(java.lang.Object o)+
equals
in class java.lang.Object
public int hashCode()+
hashCode
in class java.lang.Object
public java.lang.String toString()+
toString
in class java.lang.Object
Interface | +Description | +
---|---|
ConfigurationManager.ConfigurationListener | +
+ Listener to listen for configuration update
+ |
+
ConfigurationProvider | +
+ Interface implemented by a provider of MSSO configuration information.
+ |
+
Class | +Description | +
---|---|
Config | ++ |
ConfigurationManager | ++ |
ConfigurationManager.ClientChangeListener | +
+ For any client id change, we consider there is an update of the client,
+ clean up the stored client id, client secret, and tokens.
+ |
+
DefaultConfiguration | +
+ A simple configuration provider to use if something more elaborate is not required.
+ |
+
Server | ++ |
public class DeviceIdentifier +extends UniqueIdentifier+
identifier
Constructor and Description | +
---|
DeviceIdentifier()
+Generates a set of asymmetric keys in the Android keystore and builds the device identifier off of the public key.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected java.lang.String |
+getIdentifierKey() |
+
toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DeviceIdentifier() + throws KeyStoreException, + java.security.NoSuchAlgorithmException+
KeyStoreException
java.security.NoSuchAlgorithmException
protected java.lang.String getIdentifierKey()+
getIdentifierKey
in class UniqueIdentifier
public class MssoContext
+extends java.lang.Object
+executeRequest(Bundle, MASRequest)
method will process an outbound
+ web API request. This may take a long time and involve multiple round trips to the token server, and should not
+ be executed on the UI thread.
+ To simplify running remote calls in the background from an Activity, the MssoClient and HttpResponseFragment
+ are provided.Modifier and Type | +Field and Description | +
---|---|
private android.content.Context |
+appContext |
+
private ClientCredentialContainer |
+clientCredentialTokens |
+
private ConfigurationProvider |
+configurationProvider |
+
private MASAuthCredentials |
+credentials |
+
private java.lang.String |
+deviceName |
+
private MAGHttpClient |
+magHttpClient |
+
private static int |
+MAX_REQUEST_ATTEMPTS
+Maximum number of RetryRequestExceptions to honor before giving up.
+ |
+
private static java.lang.String |
+MSSO_CONTEXT_NOT_INITIALIZED |
+
private PolicyManager |
+policyManager |
+
private OAuthTokenContainer |
+privateTokens |
+
private TokenManager |
+tokenManager |
+
Modifier | +Constructor and Description | +
---|---|
private |
+MssoContext() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clearAccessToken()
+Clear the access token, forcing the next request to obtain a new one.
+ |
+
void |
+clearClientCredentials() |
+
void |
+clearCredentials() |
+
void |
+clearIdToken() |
+
void |
+clearUserProfile() |
+
void |
+close()
+Shut down the context.
+ |
+
void |
+destroyAllPersistentTokens()
+Clear all tokens in the shared token store.
+ |
+
void |
+destroyPersistentTokens()
+Clear all tokens in the shared token store which associate with the current connected gateway.
+ |
+
MASResponse |
+executeRequest(android.os.Bundle extra,
+ MASRequest request)
+Add an access token to the specified outbound request, transmit it to the target server, and return
+ the response.
+ |
+
java.lang.String |
+getAccessToken()
+Get an access token, if one is presently available.
+ |
+
long |
+getAccessTokenExpiry()
+Get the access token expiry date, if one is available.
+ |
+
java.lang.Long |
+getClientExpiration() |
+
java.lang.String |
+getClientId() |
+
java.lang.String |
+getClientSecret() |
+
ConfigurationProvider |
+getConfigurationProvider()
+Get the configuration provider.
+ |
+
MASAuthCredentials |
+getCredentials() |
+
java.lang.String |
+getDeviceName() |
+
java.lang.String |
+getGrantedScope() |
+
IdToken |
+getIdToken() |
+
MAGHttpClient |
+getMAGHttpClient()
+Get an HTTP client configured to trust server certs per our configuration, and to present a client
+ cert for mutual auth if one is available in our token store.
+ |
+
java.lang.String |
+getRefreshToken() |
+
java.lang.String |
+getStoredClientId() |
+
TokenManager |
+getTokenManager()
+Get the token manager that will be used to persist keys, cert chains, and OAuth tokens.
+ |
+
void |
+init(android.content.Context context)
+Initialize the context.
+ |
+
void |
+initPolicyManager() |
+
boolean |
+isClientCredentialExpired(java.lang.Long clientExpiration) |
+
boolean |
+isDeviceRegistered()
+Check if the device has already been registered.
+ |
+
boolean |
+isInitialized()
+Check if this context has been initialized.
+ |
+
boolean |
+isLogin()
+Check if the user has already been logon.
+ |
+
private boolean |
+isSsoEnabled() |
+
void |
+logout(boolean contactServer)
+Log out the current user (and, if SSO is enabled, all SSO apps on this device), leaving the device registered, and
+ optionally informing the token server of the logout.
+ |
+
static MssoContext |
+newContext()
+Create a new MssoContext.
+ |
+
void |
+onAccessTokenAvailable(java.lang.String accessToken,
+ java.lang.String refreshToken,
+ long expiresInSec,
+ java.lang.String grantedScope)
+Notify that an access token was just obtained.
+ |
+
void |
+onDeviceRegistrationCompleted()
+Notify that device registration has just completed.
+ |
+
void |
+onIdTokenAvailable(IdToken idToken)
+Notify that an ID token is now available.
+ |
+
void |
+removeDeviceRegistration()
+Remove this device registration from the server.
+ |
+
void |
+resetHttpClient()
+Reset the HTTP client, causing a new one to be created.
+ |
+
private void |
+rethrow(MAGServerException e)
+Handle common server error defined under
+ Git: MAS/Gateway-SK-MAG/blob/develop/apidoc/errorcodes/error_codes_overview.xml
+ |
+
void |
+setClientCredentials(ClientCredentials clientCredentials) |
+
void |
+setCredentials(MASAuthCredentials credentials) |
+
private void |
+setIdToken(IdToken idToken) |
+
java.lang.String |
+takeRefreshToken()
+Take and consume the refresh token, if one is available.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final int MAX_REQUEST_ATTEMPTS+
private android.content.Context appContext+
private ConfigurationProvider configurationProvider+
private PolicyManager policyManager+
private TokenManager tokenManager+
private OAuthTokenContainer privateTokens+
private ClientCredentialContainer clientCredentialTokens+
private java.lang.String deviceName+
private volatile MAGHttpClient magHttpClient+
private volatile MASAuthCredentials credentials+
private static final java.lang.String MSSO_CONTEXT_NOT_INITIALIZED+
public static MssoContext newContext()+
init(android.content.Context)
public boolean isInitialized()+
public void init(android.content.Context context)+
context
- a context, for accessing system services such as telephony and location. Required.
+ The context must have a lifetime at least as long as this MssoContext.
+ Typically this means you should not pass an Activity as the context unless you
+ plan to close this MssoContext when the activity is destroyed.MssoException
- if the token store cannot be preparedpublic void initPolicyManager()+
public void close()+
public TokenManager getTokenManager()+
public java.lang.String getDeviceName()+
init(android.content.Context)
has not yet been called.private boolean isSsoEnabled()+
public void clearUserProfile()+
public void clearIdToken()+
public IdToken getIdToken()+
private void setIdToken(IdToken idToken)+
public MASAuthCredentials getCredentials()+
public void setCredentials(MASAuthCredentials credentials)+
public void clearCredentials()+
public boolean isDeviceRegistered()+
public void resetHttpClient()+
public MAGHttpClient getMAGHttpClient()+
public void onIdTokenAvailable(IdToken idToken) + throws JWTValidationException+
idToken
- the ID token. Required.JWTValidationException
public void onDeviceRegistrationCompleted()+
public void onAccessTokenAvailable(java.lang.String accessToken, + java.lang.String refreshToken, + long expiresInSec, + java.lang.String grantedScope)+
accessToken
- the access token that was obtained. Required.refreshToken
- the refresh token to use to obtain a new access token. Required.expiresInSec
- number of seconds until the access token should be considered expired. Required.public void clearAccessToken()+
public java.lang.String getAccessToken()+
public long getAccessTokenExpiry()+
public java.lang.String getGrantedScope()+
public java.lang.String takeRefreshToken()+
public java.lang.String getRefreshToken()+
public ConfigurationProvider getConfigurationProvider()+
public MASResponse executeRequest(android.os.Bundle extra, + MASRequest request) + throws java.lang.Exception+
request
- the request to decorate and send. Required.MAGStateException
- if the request cannot be completed in the current MSSO state
+ (for example, if a username and password must be provided, or if the token store needs to be unlocked).java.io.IOException
- if there is an error communicating with the target server.java.lang.Exception
private void rethrow(MAGServerException e) + throws RetryRequestException, + MAGServerException+
RetryRequestException
MAGServerException
public void logout(boolean contactServer)+
contactServer
- true to make a single best-effort attempt to notify the server of the logout so that
+ it can revoke the tokens. This may fail if we lack network connectivity.
+
+ false to destroy the tokens client side but make no effort to inform the server that
+ it needs to revoke them.
+
+ This option is ignored unless SSO is enabled and an ID token exists.MssoException
- if contactServer is true, SSO is enabled, an ID token is present,
+ and there is an error while attempting to notify the server to log out the ID token or
+ error access the data source.public void removeDeviceRegistration()+
destroyAllPersistentTokens()
.
+
+ The communication with the token server will occur on the current thread. As this may take some time,
+ callers running on the UI thread should consider running this method within an AsyncTask.MssoException
- if there is an error while attempting to tell the token server to unregister this device.public void destroyAllPersistentTokens()+
logout(boolean)
method instead.MssoException
- if there is an error while accessing the storage .public void destroyPersistentTokens()+
logout(boolean)
method instead.MssoException
- if there is an error while accessing the storage .public boolean isLogin()+
public void setClientCredentials(ClientCredentials clientCredentials)+
public java.lang.String getStoredClientId()+
public java.lang.String getClientId()+
public java.lang.String getClientSecret()+
public java.lang.Long getClientExpiration()+
public void clearClientCredentials()+
public boolean isClientCredentialExpired(java.lang.Long clientExpiration)+
public class MssoException
+extends java.lang.RuntimeException
+Constructor and Description | +
---|
MssoException() |
+
MssoException(java.lang.String detailMessage) |
+
MssoException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MssoException(java.lang.Throwable throwable) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MssoException()+
public MssoException(java.lang.String detailMessage)+
public MssoException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MssoException(java.lang.Throwable throwable)+
public abstract class UniqueIdentifier
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected java.lang.String |
+identifier |
+
Constructor and Description | +
---|
UniqueIdentifier()
+Generates a set of asymmetric keys in the Android keystore and builds the device identifier off of the public key.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected abstract java.lang.String |
+getIdentifierKey() |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public UniqueIdentifier() + throws KeyStoreException, + java.security.NoSuchAlgorithmException+
KeyStoreException
java.security.NoSuchAlgorithmException
Class | +Description | +
---|---|
DeviceIdentifier | +
+ Generates a set of asymmetric keys in the Android keystore and builds the device identifier off of the public key.
+ |
+
MssoContext | +
+ Top-level context used by mobile single-sign-on library.
+ |
+
UniqueIdentifier | ++ |
Exception | +Description | +
---|---|
MssoException | +
+ Exception thrown if a problem occurs within the MSSO SDK.
+ |
+
public class AccountManagerStoreDataSource<K,V> +extends java.lang.Object +implements DataSource<K,V>+
AccountManagerStorage
.Modifier and Type | +Field and Description | +
---|---|
private android.content.Context |
+context |
+
private DataConverter |
+converter |
+
private boolean |
+isShared |
+
private static java.lang.String |
+SHARE |
+
private AccountManagerStorage |
+storage |
+
Constructor and Description | +
---|
AccountManagerStoreDataSource(android.content.Context context,
+ org.json.JSONObject param,
+ DataConverter converter) |
+
Modifier and Type | +Method and Description | +
---|---|
V |
+get(K key) |
+
void |
+get(K key,
+ DataSourceCallback callback) |
+
protected DataConverter |
+getConverter() |
+
protected V |
+getData(K key,
+ StorageResult result) |
+
java.util.List<K> |
+getKeys(java.lang.Object filter) |
+
void |
+getKeys(java.lang.Object filter,
+ DataSourceCallback callback) |
+
boolean |
+isReady() |
+
void |
+put(K key,
+ V value) |
+
void |
+put(K key,
+ V value,
+ DataSourceCallback callback) |
+
void |
+remove(K key) |
+
void |
+remove(K key,
+ DataSourceCallback callback) |
+
void |
+removeAll(java.lang.Object filter) |
+
void |
+removeAll(java.lang.Object filter,
+ DataSourceCallback callback) |
+
void |
+unlock() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String SHARE+
private AccountManagerStorage storage+
private DataConverter converter+
private android.content.Context context+
private boolean isShared+
public AccountManagerStoreDataSource(android.content.Context context, + org.json.JSONObject param, + DataConverter converter)+
public void put(K key, + V value, + DataSourceCallback callback)+
put
in interface DataSource<K,V>
public void get(K key, + DataSourceCallback callback)+
get
in interface DataSource<K,V>
public void remove(K key)+
remove
in interface DataSource<K,V>
public void remove(K key, + DataSourceCallback callback)+
remove
in interface DataSource<K,V>
public void removeAll(java.lang.Object filter)+
removeAll
in interface DataSource<K,V>
public void removeAll(java.lang.Object filter, + DataSourceCallback callback)+
removeAll
in interface DataSource<K,V>
public java.util.List<K> getKeys(java.lang.Object filter)+
getKeys
in interface DataSource<K,V>
public void getKeys(java.lang.Object filter, + DataSourceCallback callback)+
getKeys
in interface DataSource<K,V>
public boolean isReady()+
isReady
in interface DataSource<K,V>
public void unlock()+
unlock
in interface DataSource<K,V>
protected V getData(K key, + StorageResult result)+
protected DataConverter getConverter()+
public interface DataConverter<K,V>
+Modifier and Type | +Method and Description | +
---|---|
V |
+convert(K key,
+ byte[] value) |
+
public interface DataSource<K,T>
+Modifier and Type | +Method and Description | +
---|---|
T |
+get(K key) |
+
void |
+get(K key,
+ DataSourceCallback callback) |
+
java.util.List<K> |
+getKeys(java.lang.Object filter) |
+
void |
+getKeys(java.lang.Object filter,
+ DataSourceCallback callback) |
+
boolean |
+isReady() |
+
void |
+put(K key,
+ T value) |
+
void |
+put(K key,
+ T value,
+ DataSourceCallback callback) |
+
void |
+remove(K key) |
+
void |
+remove(K key,
+ DataSourceCallback callback) |
+
void |
+removeAll(java.lang.Object filter) |
+
void |
+removeAll(java.lang.Object filter,
+ DataSourceCallback callback) |
+
void |
+unlock() |
+
void put(K key, + T value, + DataSourceCallback callback)+
void get(K key, + DataSourceCallback callback)+
void remove(K key)+
void remove(K key, + DataSourceCallback callback)+
void removeAll(java.lang.Object filter)+
void removeAll(java.lang.Object filter, + DataSourceCallback callback)+
java.util.List<K> getKeys(java.lang.Object filter)+
void getKeys(java.lang.Object filter, + DataSourceCallback callback)+
boolean isReady()+
void unlock()+
public interface DataSourceCallback
+Modifier and Type | +Method and Description | +
---|---|
android.os.Handler |
+getHandler() |
+
void |
+onError(DataSourceError e) |
+
void |
+onSuccess(java.lang.Object value) |
+
android.os.Handler getHandler()+
void onError(DataSourceError e)+
void onSuccess(java.lang.Object value)+
public class DataSourceException
+extends java.lang.RuntimeException
+Constructor and Description | +
---|
DataSourceException(java.lang.String detailMessage) |
+
DataSourceException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
DataSourceException(java.lang.Throwable throwable) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DataSourceException(java.lang.String detailMessage)+
public DataSourceException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public DataSourceException(java.lang.Throwable throwable)+
public class DataSourceFactory
+extends java.lang.Object
+Constructor and Description | +
---|
DataSourceFactory() |
+
Modifier and Type | +Method and Description | +
---|---|
static <K,V> DataSource<K,V> |
+getStorage(android.content.Context context,
+ java.lang.Class<? extends DataSource> c,
+ org.json.JSONObject param) |
+
static <K,V> DataSource<K,V> |
+getStorage(android.content.Context context,
+ java.lang.Class<? extends DataSource> c,
+ org.json.JSONObject param,
+ DataConverter converter) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static <K,V> DataSource<K,V> getStorage(android.content.Context context, + java.lang.Class<? extends DataSource> c, + org.json.JSONObject param, + DataConverter converter)+
public static <K,V> DataSource<K,V> getStorage(android.content.Context context, + java.lang.Class<? extends DataSource> c, + org.json.JSONObject param)+
public class KeystoreDataSource<K,V> +extends java.lang.Object +implements DataSource<K,V>+
Modifier and Type | +Field and Description | +
---|---|
private android.content.Context |
+context |
+
private DataConverter |
+converter |
+
private boolean |
+isShared |
+
static java.lang.String |
+SHARE |
+
private KeyStoreStorage |
+storage |
+
Constructor and Description | +
---|
KeystoreDataSource(android.content.Context context,
+ org.json.JSONObject param,
+ DataConverter converter) |
+
Modifier and Type | +Method and Description | +
---|---|
V |
+get(K key) |
+
void |
+get(K key,
+ DataSourceCallback callback) |
+
java.util.List<K> |
+getKeys(java.lang.Object filter) |
+
void |
+getKeys(java.lang.Object filter,
+ DataSourceCallback callback) |
+
boolean |
+isReady() |
+
void |
+put(K key,
+ V value) |
+
void |
+put(K key,
+ V value,
+ DataSourceCallback callback) |
+
void |
+remove(K key) |
+
void |
+remove(K key,
+ DataSourceCallback callback) |
+
void |
+removeAll(java.lang.Object filter) |
+
void |
+removeAll(java.lang.Object filter,
+ DataSourceCallback callback) |
+
void |
+unlock() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String SHARE+
private KeyStoreStorage storage+
private DataConverter converter+
private android.content.Context context+
private boolean isShared+
public KeystoreDataSource(android.content.Context context, + org.json.JSONObject param, + DataConverter converter)+
public void put(K key, + V value, + DataSourceCallback callback)+
put
in interface DataSource<K,V>
public void get(K key, + DataSourceCallback callback)+
get
in interface DataSource<K,V>
public void remove(K key)+
remove
in interface DataSource<K,V>
public void remove(K key, + DataSourceCallback callback)+
remove
in interface DataSource<K,V>
public void removeAll(java.lang.Object filter)+
removeAll
in interface DataSource<K,V>
public void removeAll(java.lang.Object filter, + DataSourceCallback callback)+
removeAll
in interface DataSource<K,V>
public java.util.List<K> getKeys(java.lang.Object filter)+
getKeys
in interface DataSource<K,V>
public void getKeys(java.lang.Object filter, + DataSourceCallback callback)+
getKeys
in interface DataSource<K,V>
public boolean isReady()+
isReady
in interface DataSource<K,V>
public void unlock()+
unlock
in interface DataSource<K,V>
public class LocalStoreDataSource +extends java.lang.Object +implements DataSource<LocalStoreKey,LocalStoreEntity>+
Modifier and Type | +Class and Description | +
---|---|
private class |
+LocalStoreDataSource.LocalStorageContract
+SQLite Database related classes
+ |
+
private class |
+LocalStoreDataSource.LocalStorageDbHelper |
+
Modifier and Type | +Field and Description | +
---|---|
private android.content.Context |
+context |
+
private LocalStoreDataSource.LocalStorageDbHelper |
+mLocalStorageDbHelper
+The reference to DB helper class.
+ |
+
Constructor and Description | +
---|
LocalStoreDataSource(android.content.Context context,
+ org.json.JSONObject param,
+ DataConverter converter) |
+
Modifier and Type | +Method and Description | +
---|---|
LocalStoreEntity |
+get(LocalStoreKey key) |
+
void |
+get(LocalStoreKey s,
+ DataSourceCallback dataSourceCallback) |
+
java.util.List<LocalStoreKey> |
+getKeys(java.lang.Object filter) |
+
void |
+getKeys(java.lang.Object filter,
+ DataSourceCallback dataSourceCallback) |
+
private android.util.Pair<java.lang.String,java.lang.String[]> |
+getSelection(LocalStoreKey key) |
+
boolean |
+isReady() |
+
void |
+put(LocalStoreKey key,
+ LocalStoreEntity localStoreItem) |
+
void |
+put(LocalStoreKey key,
+ LocalStoreEntity localStoreItem,
+ DataSourceCallback dataSourceCallback) |
+
void |
+remove(LocalStoreKey key) |
+
void |
+remove(LocalStoreKey s,
+ DataSourceCallback dataSourceCallback) |
+
void |
+removeAll(java.lang.Object filter) |
+
void |
+removeAll(java.lang.Object filter,
+ DataSourceCallback dataSourceCallback) |
+
void |
+unlock() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private android.content.Context context+
private LocalStoreDataSource.LocalStorageDbHelper mLocalStorageDbHelper+
public LocalStoreDataSource(android.content.Context context, + org.json.JSONObject param, + DataConverter converter)+
public void put(@NonNull + LocalStoreKey key, + @NonNull + LocalStoreEntity localStoreItem)+
put
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void put(LocalStoreKey key, + LocalStoreEntity localStoreItem, + DataSourceCallback dataSourceCallback)+
put
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public LocalStoreEntity get(@NonNull + LocalStoreKey key)+
get
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void get(LocalStoreKey s, + DataSourceCallback dataSourceCallback)+
get
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void remove(@NonNull + LocalStoreKey key)+
remove
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void remove(LocalStoreKey s, + DataSourceCallback dataSourceCallback)+
remove
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void removeAll(java.lang.Object filter)+
removeAll
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void removeAll(java.lang.Object filter, + DataSourceCallback dataSourceCallback)+
removeAll
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public java.util.List<LocalStoreKey> getKeys(java.lang.Object filter)+
getKeys
in interface DataSource<LocalStoreKey,LocalStoreEntity>
private android.util.Pair<java.lang.String,java.lang.String[]> getSelection(LocalStoreKey key)+
public void getKeys(java.lang.Object filter, + DataSourceCallback dataSourceCallback)+
getKeys
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public boolean isReady()+
isReady
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public void unlock()+
unlock
in interface DataSource<LocalStoreKey,LocalStoreEntity>
public class LocalStoreEntity
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private byte[] |
+data |
+
private java.lang.String |
+type |
+
Constructor and Description | +
---|
LocalStoreEntity(java.lang.String type,
+ byte[] data) |
+
Modifier and Type | +Method and Description | +
---|---|
byte[] |
+getData() |
+
java.lang.String |
+getType() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class LocalStoreKey
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+createdBy |
+
private java.lang.String |
+key |
+
private java.lang.Integer |
+segment |
+
Constructor and Description | +
---|
LocalStoreKey(java.lang.String key,
+ java.lang.Integer segment,
+ java.lang.String createdBy) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getCreatedBy() |
+
java.lang.String |
+getKey() |
+
java.lang.Integer |
+getSegment() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private java.lang.String key+
private java.lang.Integer segment+
private java.lang.String createdBy+
public class SecureAccountManagerStoreDataSource<K,V> +extends AccountManagerStoreDataSource<K,V>+
Modifier and Type | +Field and Description | +
---|---|
private DefaultEncryptionProvider |
+encryptionProvider |
+
Constructor and Description | +
---|
SecureAccountManagerStoreDataSource(android.content.Context context,
+ org.json.JSONObject param,
+ DataConverter converter) |
+
Modifier and Type | +Method and Description | +
---|---|
protected V |
+getData(K key,
+ StorageResult result) |
+
private byte[] |
+getValueBytes(V value) |
+
void |
+put(K key,
+ V value) |
+
void |
+put(K key,
+ V value,
+ DataSourceCallback callback) |
+
get, get, getConverter, getKeys, getKeys, isReady, remove, remove, removeAll, removeAll, unlock
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private DefaultEncryptionProvider encryptionProvider+
public SecureAccountManagerStoreDataSource(android.content.Context context, + org.json.JSONObject param, + DataConverter converter)+
public void put(K key, + V value)+
put
in interface DataSource<K,V>
put
in class AccountManagerStoreDataSource<K,V>
public void put(K key, + V value, + DataSourceCallback callback)+
put
in interface DataSource<K,V>
put
in class AccountManagerStoreDataSource<K,V>
protected V getData(K key, + StorageResult result)+
getData
in class AccountManagerStoreDataSource<K,V>
private byte[] getValueBytes(V value)+
value
- public class StringDataConverter +extends java.lang.Object +implements DataConverter<java.lang.String,java.lang.String>+
Constructor and Description | +
---|
StringDataConverter() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+convert(java.lang.String key,
+ byte[] value) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public java.lang.String convert(java.lang.String key, + byte[] value)+
convert
in interface DataConverter<java.lang.String,java.lang.String>
Interface | +Description | +
---|---|
DataConverter<K,V> | ++ |
DataSource<K,T> | ++ |
DataSourceCallback | ++ |
Class | +Description | +
---|---|
AccountManagerStoreDataSource<K,V> | +
+ SDK uses this utility wrapper class to use
+AccountManagerStorage . |
+
DataSourceFactory | ++ |
KeystoreDataSource<K,V> | ++ |
LocalStoreDataSource | ++ |
LocalStoreEntity | ++ |
LocalStoreKey | ++ |
SecureAccountManagerStoreDataSource<K,V> | ++ |
StringDataConverter | ++ |
Exception | +Description | +
---|---|
DataSourceException | ++ |
Error | +Description | +
---|---|
DataSourceError | ++ |
public abstract class EnterpriseBrowserException +extends MAGException+
Constructor and Description | +
---|
EnterpriseBrowserException(int errorCode) |
+
EnterpriseBrowserException(int errorCode,
+ java.lang.String detailMessage) |
+
EnterpriseBrowserException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
EnterpriseBrowserException(int errorCode,
+ java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public EnterpriseBrowserException(int errorCode)+
public EnterpriseBrowserException(int errorCode, + java.lang.String detailMessage)+
public EnterpriseBrowserException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public EnterpriseBrowserException(int errorCode, + java.lang.Throwable throwable)+
public class InvalidResponseException +extends EnterpriseBrowserException+
Constructor and Description | +
---|
InvalidResponseException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Exception | +Description | +
---|---|
EnterpriseBrowserException | +
+ The Base Exception class for Enterprise Browser
+ |
+
InvalidResponseException | +
+ This exception is thrown when an error occurs while processing
+ the JSON Message from enterprise endpoint.
+ |
+
public class MAGError
+extends java.lang.Error
+Constructor and Description | +
---|
MAGError(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MAGError(java.lang.Throwable throwable) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public interface MAGErrorCode
+static final int UNKNOWN+
static final int INVALID_URL+
static final int INVALID_JSON+
static final int TYPE_UNSUPPORTED+
static final int FAILED_FILE_NOT_FOUND+
static final int FAILED_JSON_SERIALIZATION+
static final int FAILED_JSON_VALIDATION+
static final int INVALID_ENDPOINT+
static final int GEOLOCATION_IS_INVALID+
static final int GEOLOCATION_IS_MISSING+
static final int MSISDN_IS_INVALID+
static final int MSISDN_IS_MISSING+
static final int APPLICATION_ALREADY_REGISTERED+
static final int APPLICATION_INVALID+
static final int APPLICATION_NOT_REGISTERED+
static final int APPLICATION_INVALID_MAG_IDENTIFER+
static final int DEVICE_ALREADY_REGISTERED+
static final int DEVICE_ALREADY_REGISTERED_WITH_DIFFERENT_FLOW+
static final int DEVICE_COULD_NOT_BE_DEREGISTERED+
static final int DEVICE_NOT_REGISTERED+
static final int DEVICE_NOT_LOGGED_IN+
static final int DEVICE_RECORD_IS_NOT_VALID+
static final int REGISTRATION_ATTEMPTED_WITH_UNREGISTERED_SCOPE+
static final int REGISTRATION_WITHOUT_REQUIRED_PARAMETERS+
static final int DEVICE_NOT_RENEWED+
static final int TOKEN_INVALID_ID_TOKEN+
static final int TOKEN_ID_TOKEN_EXPIRED+
static final int TOKEN_ID_TOKEN_INVALID_AUD+
static final int TOKEN_ID_TOKEN_INVALID_AZP+
static final int TOKEN_ID_TOKEN_INVALID_SIGNATURE+
static final int ACCESS_TOKEN_INVALID+
static final int ENTERPRISE_BROWSER_WEB_APP_INVALID_URL+
static final int ENTERPRISE_BROWSER_NATIVE_APP_DOES_NOT_EXIST+
static final int ENTERPRISE_BROWSER_NATIVE_APP_CANNOT_OPEN+
static final int ENTERPRISE_BROWSER_APP_DOES_NOT_EXIST+
static final int ENTERPRISE_BROWSER_INVALID_RESPONSE+
public class MAGException
+extends java.lang.Exception
+Modifier and Type | +Field and Description | +
---|---|
private int |
+errorCode |
+
Constructor and Description | +
---|
MAGException(int errorCode) |
+
MAGException(int errorCode,
+ java.lang.String detailMessage) |
+
MAGException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MAGException(int errorCode,
+ java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getErrorCode() |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MAGException(int errorCode)+
public MAGException(int errorCode, + java.lang.String detailMessage)+
public MAGException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MAGException(int errorCode, + java.lang.Throwable throwable)+
public class MAGRuntimeException
+extends java.lang.RuntimeException
+Modifier and Type | +Field and Description | +
---|---|
private int |
+errorCode |
+
Constructor and Description | +
---|
MAGRuntimeException(int errorCode) |
+
MAGRuntimeException(int errorCode,
+ java.lang.String detailMessage) |
+
MAGRuntimeException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MAGRuntimeException(int errorCode,
+ java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getErrorCode() |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MAGRuntimeException(int errorCode)+
public MAGRuntimeException(int errorCode, + java.lang.String detailMessage)+
public MAGRuntimeException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MAGRuntimeException(int errorCode, + java.lang.Throwable throwable)+
public class MAGServerException
+extends java.lang.Exception
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+contentType |
+
private int |
+errorCode |
+
private MASResponse |
+response |
+
private int |
+status |
+
Constructor and Description | +
---|
MAGServerException(MAGServerException e) |
+
MAGServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage) |
+
MAGServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getContentType() |
+
int |
+getErrorCode() |
+
MASResponse |
+getResponse() |
+
int |
+getStatus() |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
private int errorCode+
private int status+
private java.lang.String contentType+
private MASResponse response+
public MAGServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage)+
public MAGServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MAGServerException(MAGServerException e)+
public class MAGStateException +extends MAGException+
Constructor and Description | +
---|
MAGStateException() |
+
MAGStateException(java.lang.String detailMessage) |
+
MAGStateException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MAGStateException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MAGStateException()+
public MAGStateException(java.lang.String detailMessage)+
public MAGStateException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MAGStateException(java.lang.Throwable throwable)+
public class TargetApiException
+extends java.lang.Exception
+Modifier and Type | +Field and Description | +
---|---|
private MASResponse |
+response |
+
Constructor and Description | +
---|
TargetApiException(MASResponse response) |
+
Modifier and Type | +Method and Description | +
---|---|
MASResponse |
+getResponse() |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
private final MASResponse response+
public TargetApiException(MASResponse response)+
public MASResponse getResponse()+
Interface | +Description | +
---|---|
MAGErrorCode | ++ |
Exception | +Description | +
---|---|
MAGException | +
+ The Base Exception class for MAG
+ |
+
MAGRuntimeException | ++ |
MAGServerException | +
+ The Base Exception class for MAG Server communication,
+ thrown when an error occurs while accessing the MAG Server endpoint
+ |
+
MAGStateException | +
+ Superclass for exceptions thrown when an MAG request cannot proceed due to the current state of the MSSO
+ engine.
+ |
+
TargetApiException | +
+ This exception is thrown when the target application API return http status code which is not within
+ the range 200 - 299.
+ |
+
Error | +Description | +
---|---|
MAGError | +
+ Thrown when a MAG error occurs.
+ |
+
public class ContentType
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static ContentType |
+APPLICATION_FORM_URLENCODED |
+
static ContentType |
+APPLICATION_JSON |
+
static ContentType |
+APPLICATION_OCTET_STREAM |
+
private java.nio.charset.Charset |
+charset |
+
private java.lang.String |
+mimeType |
+
static ContentType |
+TEXT_PLAIN |
+
Constructor and Description | +
---|
ContentType(java.lang.String mimeType,
+ java.nio.charset.Charset charset) |
+
Modifier and Type | +Method and Description | +
---|---|
java.nio.charset.Charset |
+getCharset() |
+
java.lang.String |
+getMimeType() |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final ContentType APPLICATION_OCTET_STREAM+
public static final ContentType APPLICATION_FORM_URLENCODED+
public static final ContentType APPLICATION_JSON+
public static final ContentType TEXT_PLAIN+
private final java.lang.String mimeType+
private final java.nio.charset.Charset charset+
public ContentType(java.lang.String mimeType, + java.nio.charset.Charset charset)+
public java.lang.String getMimeType()+
public java.nio.charset.Charset getCharset()+
public java.lang.String toString()+
toString
in class java.lang.Object
public class MAGHttpClient
+extends java.lang.Object
+Constructor and Description | +
---|
MAGHttpClient() |
+
Modifier and Type | +Method and Description | +
---|---|
<T> MASResponse<T> |
+execute(MASRequest request) |
+
<T> MASResponse<T> |
+execute(MASRequest request,
+ MASSecurityConfiguration securityConfiguration) |
+
<T> MASResponse<T> |
+execute(MASRequest request,
+ javax.net.ssl.SSLSocketFactory sslSocketFactory)
+Execute a request to the target API.
+ |
+
protected void |
+onConnectionObtained(java.net.HttpURLConnection connection) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public <T> MASResponse<T> execute(MASRequest request, + MASSecurityConfiguration securityConfiguration) + throws java.io.IOException+
java.io.IOException
public <T> MASResponse<T> execute(MASRequest request) + throws java.io.IOException+
java.io.IOException
public <T> MASResponse<T> execute(MASRequest request, + javax.net.ssl.SSLSocketFactory sslSocketFactory) + throws java.io.IOException+
T
- The parsed response typerequest
- The request to executejava.io.IOException
- if any error occur or the connection was aborted.protected void onConnectionObtained(java.net.HttpURLConnection connection)+
public class SSLSocketFactoryProvider
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.util.Map<android.net.Uri,javax.net.ssl.SSLSocketFactory> |
+factories |
+
private static SSLSocketFactoryProvider |
+instance |
+
Modifier | +Constructor and Description | +
---|---|
private |
+SSLSocketFactoryProvider() |
+
Modifier and Type | +Method and Description | +
---|---|
javax.net.ssl.SSLSocketFactory |
+createSSLSocketFactory(MASSecurityConfiguration configuration)
+Creates a SSLSocketFactory for this configuration.
+ |
+
javax.net.ssl.SSLSocketFactory |
+get(java.net.URL url)
+Gets the SSLSocketFactory associated with the specified URL host and port.
+ |
+
static SSLSocketFactoryProvider |
+getInstance() |
+
javax.net.ssl.SSLSocketFactory |
+getPrimaryGatewaySocketFactory()
+Returns the SSLSocketFactory associated with the primary gateway configuration.
+ |
+
javax.net.ssl.SSLSocketFactory |
+getSSLSocketFactory(android.net.Uri hostname)
+Attempts to return the SSLSocketFactory associated with the host configuration.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static SSLSocketFactoryProvider instance+
private java.util.Map<android.net.Uri,javax.net.ssl.SSLSocketFactory> factories+
private SSLSocketFactoryProvider()+
public static SSLSocketFactoryProvider getInstance()+
public javax.net.ssl.SSLSocketFactory get(java.net.URL url)+
url
- urlpublic javax.net.ssl.SSLSocketFactory getPrimaryGatewaySocketFactory() + throws MASInvalidHostException+
MASInvalidHostException
public javax.net.ssl.SSLSocketFactory getSSLSocketFactory(android.net.Uri hostname) + throws MASInvalidHostException+
hostname
- the host URIMASInvalidHostException
public javax.net.ssl.SSLSocketFactory createSSLSocketFactory(MASSecurityConfiguration configuration)+
configuration
- the specified security configurationClass | +Description | +
---|---|
ContentType | +
+ Content type of HTTP request or response body
+ |
+
MAGHttpClient | ++ |
SSLSocketFactoryProvider | ++ |
public class Charsets
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.nio.charset.Charset |
+ASCII |
+
static java.nio.charset.Charset |
+ISO_8859_1 |
+
static java.nio.charset.Charset |
+UTF8 |
+
public class IoUtils
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private static char[] |
+hexadecimal |
+
private static char[] |
+hexadecimal_upper |
+
Modifier | +Constructor and Description | +
---|---|
private |
+IoUtils() |
+
Modifier and Type | +Method and Description | +
---|---|
static java.lang.String |
+base64(java.lang.String str,
+ java.nio.charset.Charset charset)
+Base-64 encode the charset-encoded bytes of the specified string.
+ |
+
static void |
+closeQuietly(java.io.Closeable closeable)
+Close the specified closeable, if it is non-null.
+ |
+
static java.lang.String |
+hexDump(byte[] binaryData)
+Convert the specified binary data into a string containing hexadecimal digits.
+ |
+
static java.lang.String |
+hexDump(byte[] binaryData,
+ int off,
+ int len)
+Convert a portion of the specified binary data into a string containing hexadecimal digits.
+ |
+
static java.lang.String |
+hexDump(byte[] binaryData,
+ int off,
+ int len,
+ boolean upperCase)
+Convert a portion of the specified binary data into a string containing hexadecimal digits.
+ |
+
static byte[] |
+hexToByteArray(java.lang.String s) |
+
static byte[] |
+slurpStream(java.io.InputStream stream,
+ int limit)
+Read the entirety of the specified InputStream into memory and return it as a byte array.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final char[] hexadecimal+
private static final char[] hexadecimal_upper+
public static byte[] slurpStream(java.io.InputStream stream, + int limit) + throws java.io.IOException+
stream
- the stream to read. Required.limit
- the maximum number of bytes to read into memory.java.io.IOException
- if an IOException occurs while reading the stream, or if the stream length limit is exceeded.public static java.lang.String hexDump(byte[] binaryData)+
binaryData
- the data to dumppublic static java.lang.String hexDump(byte[] binaryData, + int off, + int len)+
binaryData
- the data to dumpoff
- offset of first byte to include in the dump.len
- number of bytes to include in the dump.public static java.lang.String hexDump(byte[] binaryData, + int off, + int len, + boolean upperCase)+
binaryData
- the data to dumpoff
- offset of first byte to include in the dump.len
- number of bytes to include in the dump.upperCase
- true if the hex should use uppercase letters.public static byte[] hexToByteArray(java.lang.String s)+
public static java.lang.String base64(java.lang.String str, + java.nio.charset.Charset charset)+
str
- the string to encode. Required.public static void closeQuietly(java.io.Closeable closeable)+
closeable
- a closeable or nullpublic class SingleKeyX509KeyManager
+extends javax.net.ssl.X509ExtendedKeyManager
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+alias |
+
private java.security.cert.X509Certificate[] |
+certChain |
+
private java.security.PrivateKey |
+privateKey |
+
Constructor and Description | +
---|
SingleKeyX509KeyManager(java.security.PrivateKey privateKey,
+ java.security.cert.X509Certificate[] certChain)
+Create a a KeyManager that only knows about a single X.509 certificate.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+chooseClientAlias(java.lang.String[] strings,
+ java.security.Principal[] principals,
+ java.net.Socket socket) |
+
java.lang.String |
+chooseEngineClientAlias(java.lang.String[] strings,
+ java.security.Principal[] principals,
+ javax.net.ssl.SSLEngine sslEngine) |
+
java.lang.String |
+chooseEngineServerAlias(java.lang.String string,
+ java.security.Principal[] principals,
+ javax.net.ssl.SSLEngine sslEngine) |
+
java.lang.String |
+chooseServerAlias(java.lang.String s,
+ java.security.Principal[] principals,
+ java.net.Socket socket) |
+
java.security.cert.X509Certificate[] |
+getCertificateChain(java.lang.String s) |
+
java.lang.String[] |
+getClientAliases(java.lang.String s,
+ java.security.Principal[] principals) |
+
java.security.PrivateKey |
+getPrivateKey(java.lang.String s) |
+
java.lang.String[] |
+getServerAliases(java.lang.String s,
+ java.security.Principal[] principals) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final java.security.cert.X509Certificate[] certChain+
private final java.security.PrivateKey privateKey+
private final java.lang.String alias+
public SingleKeyX509KeyManager(java.security.PrivateKey privateKey, + java.security.cert.X509Certificate[] certChain)+
privateKey
- the private key for this certificate chain. Required.certChain
- the certificate chain to present when challenged (when acting as a client), or to use as the server cert (when acting as a server). Required.public java.lang.String[] getClientAliases(java.lang.String s, + java.security.Principal[] principals)+
public java.lang.String chooseClientAlias(java.lang.String[] strings, + java.security.Principal[] principals, + java.net.Socket socket)+
public java.lang.String[] getServerAliases(java.lang.String s, + java.security.Principal[] principals)+
public java.lang.String chooseServerAlias(java.lang.String s, + java.security.Principal[] principals, + java.net.Socket socket)+
public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String s)+
public java.security.PrivateKey getPrivateKey(java.lang.String s)+
public java.lang.String chooseEngineClientAlias(java.lang.String[] strings, + java.security.Principal[] principals, + javax.net.ssl.SSLEngine sslEngine)+
chooseEngineClientAlias
in class javax.net.ssl.X509ExtendedKeyManager
public java.lang.String chooseEngineServerAlias(java.lang.String string, + java.security.Principal[] principals, + javax.net.ssl.SSLEngine sslEngine)+
chooseEngineServerAlias
in class javax.net.ssl.X509ExtendedKeyManager
public class TrustedCertificateConfigurationTrustManager
+extends java.lang.Object
+implements javax.net.ssl.X509TrustManager
+TrustedCertificateConfiguration
.Modifier and Type | +Field and Description | +
---|---|
private MASSecurityConfiguration |
+config |
+
private java.util.Collection<javax.net.ssl.X509TrustManager> |
+privateTrustStoreDelegates |
+
private java.util.Collection<javax.net.ssl.X509TrustManager> |
+publicPkiDelegates |
+
Constructor and Description | +
---|
TrustedCertificateConfigurationTrustManager(MASSecurityConfiguration config)
+Create a trust manager that uses the specified trust configuration.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+checkClientTrusted(java.security.cert.X509Certificate[] chain,
+ java.lang.String s) |
+
private void |
+checkPrivateTrustStoreDelegates(java.security.cert.X509Certificate[] chain,
+ java.lang.String s) |
+
void |
+checkServerTrusted(java.security.cert.X509Certificate[] chain,
+ java.lang.String s) |
+
private static java.security.KeyStore |
+createTrustStoreWithCerts(java.util.Collection<java.security.cert.Certificate> certs) |
+
java.security.cert.X509Certificate[] |
+getAcceptedIssuers() |
+
private static java.util.Collection<javax.net.ssl.X509TrustManager> |
+getPlatformX509TrustManagers() |
+
private static java.util.Collection<javax.net.ssl.X509TrustManager> |
+getPrivateX509TrustManagers(java.util.Collection<java.security.cert.Certificate> certs) |
+
private static java.util.Collection<javax.net.ssl.X509TrustManager> |
+getX509TrustManagers(java.security.KeyStore trustStore) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final java.util.Collection<javax.net.ssl.X509TrustManager> publicPkiDelegates+
private final java.util.Collection<javax.net.ssl.X509TrustManager> privateTrustStoreDelegates+
private final MASSecurityConfiguration config+
public TrustedCertificateConfigurationTrustManager(MASSecurityConfiguration config)+
config
- trusted cert configuration to use for setting up the trust manager. Required.private static java.util.Collection<javax.net.ssl.X509TrustManager> getPrivateX509TrustManagers(java.util.Collection<java.security.cert.Certificate> certs)+
private static java.util.Collection<javax.net.ssl.X509TrustManager> getPlatformX509TrustManagers()+
private static java.security.KeyStore createTrustStoreWithCerts(java.util.Collection<java.security.cert.Certificate> certs)+
private static java.util.Collection<javax.net.ssl.X509TrustManager> getX509TrustManagers(java.security.KeyStore trustStore)+
private void checkPrivateTrustStoreDelegates(java.security.cert.X509Certificate[] chain, + java.lang.String s) + throws java.security.cert.CertificateException+
java.security.cert.CertificateException
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, + java.lang.String s) + throws java.security.cert.CertificateException+
checkClientTrusted
in interface javax.net.ssl.X509TrustManager
java.security.cert.CertificateException
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, + java.lang.String s) + throws java.security.cert.CertificateException+
checkServerTrusted
in interface javax.net.ssl.X509TrustManager
java.security.cert.CertificateException
public java.security.cert.X509Certificate[] getAcceptedIssuers()+
getAcceptedIssuers
in interface javax.net.ssl.X509TrustManager
Class | +Description | +
---|---|
SingleKeyX509KeyManager | +
+ An SSL X509KeyManager that holds a single pre-configured client cert and private key, and always uses
+ it to respond to challenges.
+ |
+
TrustedCertificateConfigurationTrustManager | +
+ Trust manager that works with a
+TrustedCertificateConfiguration . |
+
public class MAGSocketFactory
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.security.cert.X509Certificate[] |
+clientCertChain |
+
private java.security.PrivateKey |
+clientCertPrivateKey |
+
private static java.security.SecureRandom |
+secureRandom |
+
private MASSecurityConfiguration |
+securityConfiguration |
+
private static java.lang.String |
+SSL_TLS_PROTOCOL |
+
Constructor and Description | +
---|
MAGSocketFactory(MASSecurityConfiguration config)
+Create an SocketFactory factory that will create clients which trust the specified server certs
+ and use the specified client cert for client cert authentication.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
private javax.net.ssl.SSLContext |
+createSslContext() |
+
javax.net.ssl.SSLSocketFactory |
+createTLSSocketFactory() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String SSL_TLS_PROTOCOL+
private static final java.security.SecureRandom secureRandom+
private MASSecurityConfiguration securityConfiguration+
private java.security.PrivateKey clientCertPrivateKey+
private java.security.cert.X509Certificate[] clientCertChain+
public MAGSocketFactory(@NonNull + MASSecurityConfiguration config)+
TokenManager
.Class | +Description | +
---|---|
MAGSocketFactory | ++ |
TLSSocketFactory | ++ |
public class CodeVerifierCache
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+codeVerifier |
+
private static CodeVerifierCache |
+instance |
+
private java.lang.String |
+state |
+
Modifier | +Constructor and Description | +
---|---|
private |
+CodeVerifierCache() |
+
Modifier and Type | +Method and Description | +
---|---|
static CodeVerifierCache |
+getInstance() |
+
void |
+store(java.lang.String state,
+ java.lang.String codeVerifier) |
+
java.lang.String |
+take() |
+
java.lang.String |
+take(java.lang.String state) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static CodeVerifierCache instance+
private java.lang.String state+
private java.lang.String codeVerifier+
public static CodeVerifierCache getInstance()+
public void store(java.lang.String state, + java.lang.String codeVerifier)+
public java.lang.String take(java.lang.String state)+
public java.lang.String take()+
public class OAuthClient +extends ServerClient+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+AUTH_URL |
+
static java.lang.String |
+AUTHORIZATION |
+
static java.lang.String |
+CODE |
+
static java.lang.String |
+CODE_CHALLENGE |
+
static java.lang.String |
+CODE_CHALLENGE_METHOD |
+
private static java.lang.String |
+DEFAULT_DISPLAY |
+
static java.lang.String |
+DISPLAY |
+
static java.lang.String |
+ID |
+
static java.lang.String |
+ID_TOKEN |
+
static java.lang.String |
+ID_TOKEN_TYPE |
+
static java.lang.String |
+IDP |
+
private static int |
+INVALID_CLIENT_CREDENTIALS |
+
static java.lang.String |
+LOGOUT_APPS |
+
static java.lang.String |
+MSSO_REGISTER |
+
static java.lang.String |
+POLL_URL |
+
static java.lang.String |
+PROVIDER |
+
static java.lang.String |
+PROVIDERS |
+
static java.lang.String |
+REDIRECT_URI |
+
static java.lang.String |
+RESPONSE_TYPE |
+
static java.lang.String |
+STATE |
+
ACTIVATED, APPLICATION_X_WWW_FORM_URLENCODED, ASSERTION, CERT_FORMAT, CLIENT_AUTHORIZATION, CLIENT_EXPIRATION, CLIENT_ID, CLIENT_SECRET, conf, CONTENT_TYPE, CREATE_SESSION, DEFAULT_CONTENT_TYPE, DEVICE_ID, DEVICE_NAME, DEVICE_STATUS, GRANT_TYPE, MAG_IDENTIFIER, MSSO, MSSO_CLIENT_REGISTER, mssoContext, NONCE, OPENID, OPENID_PHONE_EMAIL, PEM, REFRESH_TOKEN, REGISTERED, SCOPE, TEXT_PLAIN, UTF_8, X_CA_ERR
Constructor and Description | +
---|
OAuthClient(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
AuthenticationProvider |
+getSocialPlatformProvider(android.content.Context context)
+Retrieve the supported Social Login provider from the Gateway if redirect uri is defined in the configuration.
+ |
+
void |
+logout(IdToken idToken,
+ java.lang.String clientId,
+ java.lang.String clientSecret,
+ boolean logoutApps)
+Inform the token server that the specified ID token should be logged out and sessions canceled for
+ all apps using this token
+ |
+
createServerException, findErrorCode, obtainServerResponseToPostedForm
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final int INVALID_CLIENT_CREDENTIALS+
private static final java.lang.String DEFAULT_DISPLAY+
public static final java.lang.String RESPONSE_TYPE+
public static final java.lang.String CODE+
public static final java.lang.String DISPLAY+
public static final java.lang.String MSSO_REGISTER+
public static final java.lang.String REDIRECT_URI+
public static final java.lang.String IDP+
public static final java.lang.String PROVIDERS+
public static final java.lang.String PROVIDER+
public static final java.lang.String ID+
public static final java.lang.String AUTH_URL+
public static final java.lang.String POLL_URL+
public static final java.lang.String ID_TOKEN+
public static final java.lang.String ID_TOKEN_TYPE+
public static final java.lang.String LOGOUT_APPS+
public static final java.lang.String AUTHORIZATION+
public static final java.lang.String CODE_CHALLENGE+
public static final java.lang.String CODE_CHALLENGE_METHOD+
public static final java.lang.String STATE+
public OAuthClient(MssoContext mssoContext)+
public AuthenticationProvider getSocialPlatformProvider(android.content.Context context) + throws OAuthException, + OAuthServerException+
context
- The MssoContextOAuthException
OAuthServerException
public void logout(@NonNull + IdToken idToken, + @NonNull + java.lang.String clientId, + @NonNull + java.lang.String clientSecret, + boolean logoutApps) + throws OAuthServerException, + OAuthException+
idToken
- an ID token, presumably a JWT. Required.clientId
- the client ID of the app seeking access. Required.clientSecret
- the client secret of the app seeking access. Required.logoutApps
- true if all currently active apps should also be logged out, eg removing all access tokens
+ created using this ID token.
+ false if currently active access tokens should be allowed to remain valid until they expire.OAuthServerException
- if there is an error response from the token serverOAuthException
- if there is an error other than a valid error JSON response from the token serverpublic class OAuthClientUtil
+extends java.lang.Object
+Modifier | +Constructor and Description | +
---|---|
private |
+OAuthClientUtil() |
+
Modifier and Type | +Method and Description | +
---|---|
static PKCE |
+generateCodeChallenge() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class OAuthException +extends MAGException+
Constructor and Description | +
---|
OAuthException(int errorCode) |
+
OAuthException(int errorCode,
+ java.lang.String detailMessage) |
+
OAuthException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
OAuthException(int errorCode,
+ java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public OAuthException(int errorCode)+
public OAuthException(int errorCode, + java.lang.String detailMessage)+
public OAuthException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public OAuthException(int errorCode, + java.lang.Throwable throwable)+
public class OAuthServerException +extends MAGServerException+
Constructor and Description | +
---|
OAuthServerException(MAGServerException e) |
+
OAuthServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage) |
+
OAuthServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
getContentType, getErrorCode, getResponse, getStatus
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public OAuthServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage)+
public OAuthServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public OAuthServerException(MAGServerException e)+
public class OAuthTokenClient +extends ServerClient+
ACTIVATED, APPLICATION_X_WWW_FORM_URLENCODED, ASSERTION, CERT_FORMAT, CLIENT_AUTHORIZATION, CLIENT_EXPIRATION, CLIENT_ID, CLIENT_SECRET, conf, CONTENT_TYPE, CREATE_SESSION, DEFAULT_CONTENT_TYPE, DEVICE_ID, DEVICE_NAME, DEVICE_STATUS, GRANT_TYPE, ID_TOKEN, ID_TOKEN_TYPE, MAG_IDENTIFIER, MSSO, MSSO_CLIENT_REGISTER, MSSO_REGISTER, mssoContext, NONCE, OPENID, OPENID_PHONE_EMAIL, PEM, REFRESH_TOKEN, REGISTERED, SCOPE, TEXT_PLAIN, UTF_8, X_CA_ERR
Constructor and Description | +
---|
OAuthTokenClient(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
OAuthTokenResponse |
+obtainAccessTokenUsingIdToken(IdToken idToken,
+ java.lang.String clientId,
+ java.lang.String clientSecret,
+ java.lang.String scope)
+Exchange an ID token for an access token that can be used to access APIs.
+ |
+
OAuthTokenResponse |
+obtainTokensUsingCredentials(MAGInternalRequest request,
+ java.lang.String clientId,
+ java.lang.String clientSecret,
+ boolean requestIdToken)
+Exchange a username and password for an access token that can be used to access APIs.
+ |
+
OAuthTokenResponse |
+obtainTokenUsingRefreshToken(java.lang.String refreshToken,
+ java.lang.String clientId,
+ java.lang.String clientSecret)
+Exchange a refresh token for a new access token that can be used to access APIs.
+ |
+
private void |
+validate(OAuthTokenResponse tokenResponse) |
+
createServerException, findErrorCode, obtainServerResponseToPostedForm
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public OAuthTokenClient(MssoContext mssoContext)+
public OAuthTokenResponse obtainTokensUsingCredentials(@NonNull + MAGInternalRequest request, + @NonNull + java.lang.String clientId, + @NonNull + java.lang.String clientSecret, + boolean requestIdToken) + throws OAuthException, + OAuthServerException+
request
- the oauth request. Required.clientId
- the client ID of the app seeking access. Required.clientSecret
- the client secret of the app seeking access. Required.requestIdToken
- if true, then "msso" will be added to the requested scope, and the response may include an ID token as well as an access token.OAuthServerException
- if there is an error response from the token serverOAuthException
- if there is an error other than a valid error JSON response from the token serverpublic OAuthTokenResponse obtainAccessTokenUsingIdToken(@NonNull + IdToken idToken, + @NonNull + java.lang.String clientId, + @NonNull + java.lang.String clientSecret, + java.lang.String scope) + throws OAuthException, + OAuthServerException+
idToken
- an ID token, presumably a JWT. Required.clientId
- the client ID of the app seeking access. Required.clientSecret
- the client secret of the app seeking access. Required.scope
- Scope of access to request. If null, defaults to "openid msso".OAuthServerException
- if there is an error response from the token serverOAuthException
- if there is an error other than a valid error JSON response from the token serverprivate void validate(OAuthTokenResponse tokenResponse) + throws OAuthException+
OAuthException
public OAuthTokenResponse obtainTokenUsingRefreshToken(@NonNull + java.lang.String refreshToken, + @NonNull + java.lang.String clientId, + @NonNull + java.lang.String clientSecret) + throws OAuthException, + OAuthServerException+
refreshToken
- a refresh token. Required.clientId
- the client ID of the app seeking access. Required.clientSecret
- the client secret of the app seeking access. Required.OAuthServerException
- if there is an error JSON response from the token serverOAuthException
- if there is an error other than a valid error JSON response from the token serverpublic class OAuthTokenResponse +extends ServerResponse+
Constructor and Description | +
---|
OAuthTokenResponse(int status,
+ int errorCode,
+ java.lang.String json) |
+
OAuthTokenResponse(int status,
+ java.lang.String json) |
+
OAuthTokenResponse(ServerResponse response) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getAccessToken() |
+
long |
+getExpiresIn() |
+
java.lang.String |
+getGrantedScope() |
+
IdToken |
+getIdToken() |
+
java.lang.String |
+getRefreshToken() |
+
boolean |
+isBearer() |
+
getErrorCode, getJson, getStatus, isError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public OAuthTokenResponse(int status, + java.lang.String json) + throws org.json.JSONException+
org.json.JSONException
public OAuthTokenResponse(int status, + int errorCode, + java.lang.String json) + throws org.json.JSONException+
org.json.JSONException
public OAuthTokenResponse(ServerResponse response) + throws org.json.JSONException+
org.json.JSONException
public java.lang.String getAccessToken()+
public java.lang.String getRefreshToken()+
public java.lang.String getGrantedScope()+
public boolean isBearer()+
public long getExpiresIn()+
public IdToken getIdToken()+
public class PKCE
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
java.lang.String |
+codeChallenge |
+
java.lang.String |
+codeChallengeMethod |
+
java.lang.String |
+codeVerifier |
+
Class | +Description | +
---|---|
CodeVerifierCache | +
+ Temporary cache to store code verifier
+ |
+
OAuthClient | +
+ Utility class that encapsulates talking to the token server into Java method calls.
+ |
+
OAuthClientUtil | ++ |
OAuthTokenClient | +
+ Utility class that encapsulates talking to the token server into Java method calls.
+ |
+
OAuthTokenResponse | +
+ Represents a JSON response from the token server.
+ |
+
PKCE | +
+ Created by mujmo02 on 22/10/17.
+ |
+
Exception | +Description | +
---|---|
OAuthException | +
+ This exception is thrown when an error occurs while processing the OAuth Request.
+ |
+
OAuthServerException | +
+ This exception is thrown when an error occurs while accessing OAuth endpoint.
+ |
+
Interface | +Description | +
---|---|
MobileSso | +
+ Top-level interface for the Mobile SSO SDK.
+ |
+
MobileSsoConfig | +
+ Configuration property names and data types.
+ |
+
MobileSsoListener | +
+ Interface that will receive various notifications and requests for the MAG client.
+ |
+
ResponseInterceptor | +
+ A interceptor is an object that intercepts the response of a resource.
+ |
+
Class | +Description | +
---|---|
EventDispatcher | +
+ Dispatch an event to an Observer which listens for the event.
+ |
+
MAGResultReceiver<T> | +
+ Interface for receiving a callback result from
+MobileSso.processRequest(MASRequest, ResultReceiver)
+ Use this by creating a subclass and implement MAGResultReceiver.onSuccess(MASResponse) )}, MAGResultReceiver.onError(MAGError) ,
+ MAGResultReceiver.onRequestCancelled(Bundle) )} |
+
MobileSsoFactory | +
+ Entry point for the Mobile SSO SDK.
+ |
+
public interface MssoAssertion
+Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Shut down this policy, releasing any resources such as registered location callback etc.
+ |
+
void |
+init(MssoContext mssoContext,
+ android.content.Context sysContext)
+Initialize the policy.
+ |
+
void |
+processRequest(MssoContext mssoContext,
+ RequestInfo request)
+Apply the policy to the specified pending outbound request.
+ |
+
void |
+processResponse(MssoContext mssoContext,
+ RequestInfo request,
+ MASResponse response)
+Apply the policy to the specified received response.
+ |
+
void init(@NonNull + MssoContext mssoContext, + @NonNull + android.content.Context sysContext)+
mssoContext
- the MSSO context. Required.sysContext
- Android context to use for initializaton. Required.void processRequest(MssoContext mssoContext, + RequestInfo request) + throws MAGStateException, + MAGException, + MAGServerException+
mssoContext
- the MSSO context. Required.request
- the pending HTTP request. Required.MAGStateException
- if the policy cannot be applied in the current MSSO engine stateMAGException
MAGServerException
void processResponse(MssoContext mssoContext, + RequestInfo request, + MASResponse response) + throws MAGStateException, + MAGException, + MAGServerException+
mssoContext
- the MSSO context. Required.request
- the original request. Required.response
- the HTTP response. Required.MAGStateException
MAGException
MAGServerException
void close()+
public class PolicyManager
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static interface |
+PolicyManager.Route<R> |
+
Modifier and Type | +Field and Description | +
---|---|
private java.util.List<MssoAssertion> |
+defaultPolicy |
+
private MssoContext |
+mssoContext |
+
private java.lang.Object |
+policySync |
+
Constructor and Description | +
---|
PolicyManager(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
private void |
+close(java.util.List<MssoAssertion> policy) |
+
MASResponse |
+execute(RequestInfo requestInfo,
+ PolicyManager.Route<MASResponse> function) |
+
void |
+init(android.content.Context sysContext)
+Initialize policies.
+ |
+
private void |
+init(android.content.Context sysContext,
+ java.util.List<MssoAssertion> policy) |
+
private void |
+processRequest(RequestInfo request,
+ java.util.List<MssoAssertion> policy)
+Process a request.
+ |
+
private void |
+processResponse(RequestInfo request,
+ MASResponse response,
+ java.util.List<MssoAssertion> policy)
+Process a response.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final MssoContext mssoContext+
private final java.util.List<MssoAssertion> defaultPolicy+
private final java.lang.Object policySync+
public PolicyManager(MssoContext mssoContext)+
public void init(android.content.Context sysContext)+
sysContext
- Android context. Required.private void init(android.content.Context sysContext, + java.util.List<MssoAssertion> policy)+
private void processRequest(RequestInfo request, + java.util.List<MssoAssertion> policy) + throws MAGException, + MAGServerException+
request
- the request to process. Required.MAGStateException
- if the request cannot be processed in the current MSSO engine state.MAGException
- Exception occur in MAG EngineMAGServerException
private void processResponse(RequestInfo request, + MASResponse response, + java.util.List<MssoAssertion> policy) + throws MAGException, + MAGServerException+
request
- the original request to which this is a response. Required.response
- the response to examine. Required.MAGStateException
- only for a failed (non-200) response, if the nature of the response indicates that
+ the request cannot be processed in the current MSSO engine state (or should be retried).MAGException
- Exception occur in MAG EngineMAGServerException
public MASResponse execute(RequestInfo requestInfo, + PolicyManager.Route<MASResponse> function) + throws MAGException, + MAGServerException, + java.io.IOException+
MAGException
MAGServerException
java.io.IOException
public void close()+
private void close(java.util.List<MssoAssertion> policy)+
public class RequestInfo
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private android.os.Bundle |
+extra |
+
private int |
+numAttempts |
+
private MAGInternalRequest |
+request |
+
Constructor and Description | +
---|
RequestInfo(MssoContext context,
+ MASRequest request,
+ android.os.Bundle extra) |
+
Modifier and Type | +Method and Description | +
---|---|
android.os.Bundle |
+getExtra() |
+
int |
+getNumAttempts() |
+
MAGInternalRequest |
+getRequest() |
+
void |
+incrementNumAttempts()
+Record that another attempt has been made to send this request.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final MAGInternalRequest request+
private int numAttempts+
private final android.os.Bundle extra+
public RequestInfo(MssoContext context, + MASRequest request, + android.os.Bundle extra)+
public android.os.Bundle getExtra()+
public MAGInternalRequest getRequest()+
public int getNumAttempts()+
public void incrementNumAttempts()+
public class CertificateExpiredException +extends RetryRequestException+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+CERTIFICATE_EXPIRED_SUFFIX |
+
Constructor and Description | +
---|
CertificateExpiredException() |
+
CertificateExpiredException(java.lang.String message) |
+
CertificateExpiredException(java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+recover(MssoContext context) |
+
private void |
+renewDevice(MssoContext mssoContext) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final java.lang.String CERTIFICATE_EXPIRED_SUFFIX+
public CertificateExpiredException()+
public CertificateExpiredException(java.lang.String message)+
public CertificateExpiredException(java.lang.Throwable throwable)+
public void recover(MssoContext context) + throws java.lang.Exception+
recover
in class RetryRequestException
java.lang.Exception
private void renewDevice(MssoContext mssoContext) + throws RegistrationException, + TokenStoreException+
RegistrationException
TokenStoreException
public class CredentialRequiredException +extends MAGStateException+
Constructor and Description | +
---|
CredentialRequiredException() |
+
CredentialRequiredException(java.lang.String detailMessage) |
+
CredentialRequiredException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
CredentialRequiredException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public CredentialRequiredException()+
public CredentialRequiredException(java.lang.String detailMessage)+
public CredentialRequiredException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public CredentialRequiredException(java.lang.Throwable throwable)+
public class InvalidClientCredentialException +extends RetryRequestException+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+INVALID_CLIENT_CREDENTIAL_SUFFIX |
+
Constructor and Description | +
---|
InvalidClientCredentialException() |
+
InvalidClientCredentialException(java.lang.String message) |
+
InvalidClientCredentialException(java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+recover(MssoContext context) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final java.lang.String INVALID_CLIENT_CREDENTIAL_SUFFIX+
public InvalidClientCredentialException()+
public InvalidClientCredentialException(java.lang.String message)+
public InvalidClientCredentialException(java.lang.Throwable throwable)+
public void recover(MssoContext context)+
recover
in class RetryRequestException
public class LocationInvalidException +extends MAGException+
Constructor and Description | +
---|
LocationInvalidException() |
+
LocationInvalidException(java.lang.String detailMessage) |
+
LocationInvalidException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
LocationInvalidException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public LocationInvalidException()+
public LocationInvalidException(java.lang.String detailMessage)+
public LocationInvalidException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public LocationInvalidException(java.lang.Throwable throwable)+
public class LocationRequiredException +extends MAGException+
Constructor and Description | +
---|
LocationRequiredException() |
+
LocationRequiredException(java.lang.String detailMessage) |
+
LocationRequiredException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
LocationRequiredException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public LocationRequiredException()+
public LocationRequiredException(java.lang.String detailMessage)+
public LocationRequiredException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public LocationRequiredException(java.lang.Throwable throwable)+
public class MobileNumberInvalidException +extends MAGException+
Constructor and Description | +
---|
MobileNumberInvalidException() |
+
MobileNumberInvalidException(java.lang.String detailMessage) |
+
MobileNumberInvalidException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MobileNumberInvalidException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MobileNumberInvalidException()+
public MobileNumberInvalidException(java.lang.String detailMessage)+
public MobileNumberInvalidException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MobileNumberInvalidException(java.lang.Throwable throwable)+
public class MobileNumberRequiredException +extends MAGException+
Constructor and Description | +
---|
MobileNumberRequiredException() |
+
MobileNumberRequiredException(java.lang.String detailMessage) |
+
MobileNumberRequiredException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
MobileNumberRequiredException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public MobileNumberRequiredException()+
public MobileNumberRequiredException(java.lang.String detailMessage)+
public MobileNumberRequiredException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public MobileNumberRequiredException(java.lang.Throwable throwable)+
public class OtpException +extends MAGServerException+
Constructor and Description | +
---|
OtpException(int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ OtpResponseHeaders otpResponseHeaders) |
+
OtpException(int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable,
+ OtpResponseHeaders otpResponseHeaders) |
+
Modifier and Type | +Method and Description | +
---|---|
OtpResponseHeaders |
+getOtpResponseHeaders() |
+
getContentType, getErrorCode, getStatus
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public OtpException(int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable, + OtpResponseHeaders otpResponseHeaders)+
public OtpException(int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + OtpResponseHeaders otpResponseHeaders)+
public OtpResponseHeaders getOtpResponseHeaders()+
public abstract class RetryRequestException +extends MAGStateException+
Constructor and Description | +
---|
RetryRequestException() |
+
RetryRequestException(java.lang.String message) |
+
RetryRequestException(java.lang.Throwable throwable) |
+
Modifier and Type | +Method and Description | +
---|---|
abstract void |
+recover(MssoContext context) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public RetryRequestException()+
public RetryRequestException(java.lang.String message)+
public RetryRequestException(java.lang.Throwable throwable)+
public abstract void recover(MssoContext context) + throws java.lang.Exception+
java.lang.Exception
public class TokenStoreUnavailableException +extends MAGStateException+
Constructor and Description | +
---|
TokenStoreUnavailableException() |
+
TokenStoreUnavailableException(java.lang.String detailMessage) |
+
TokenStoreUnavailableException(java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
TokenStoreUnavailableException(java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public TokenStoreUnavailableException()+
public TokenStoreUnavailableException(java.lang.String detailMessage)+
public TokenStoreUnavailableException(java.lang.String detailMessage, + java.lang.Throwable throwable)+
public TokenStoreUnavailableException(java.lang.Throwable throwable)+
Exception | +Description | +
---|---|
CertificateExpiredException | +
+ Exception that indicate the certificate has expired.
+ |
+
CredentialRequiredException | +
+ Exception thrown if the user must be prompted for their username and password.
+ |
+
InvalidClientCredentialException | ++ |
LocationInvalidException | ++ |
LocationRequiredException | ++ |
MobileNumberInvalidException | +
+ This exception is thrown when an invalid phone number is passed to MAG Server
+ |
+
MobileNumberRequiredException | +
+ This exception is thrown when phone number is missing.
+ |
+
RetryRequestException | +
+ Exception thrown if a request should retried from the beginning.
+ |
+
TokenStoreUnavailableException | +
+ Exception thrown if the token store is needed but is unavailable (not initialized, device locked)
+ |
+
Interface | +Description | +
---|---|
MssoAssertion | +
+ Represents a policy that applies to outbound requests from the MSSO SDK.
+ |
+
PolicyManager.Route<R> | ++ |
Class | +Description | +
---|---|
AccessTokenAssertion | +
+ A policy that includes an access token with each outbound request.
+ |
+
ClientCredentialAssertion | ++ |
CustomHeaderAssertion | +
+ A policy that inject addtional headers to the request.
+ |
+
DeviceRegistrationAssertion | +
+ Ensures that the device is registered.
+ |
+
LocationAssertion | +
+ A policy that adds location information to outbound requests.
+ |
+
PolicyManager | +
+ Keeps track of policies that can be applied to requests.
+ |
+
RequestInfo | +
+ Holds a request being processed by policy along with other metadata.
+ |
+
ResponseRecoveryAssertion | +
+ An Assertion that handle common error return from server and determine if
+ the SDK can recover the error and retry the request
+ |
+
SecureLockAssertion | ++ |
StorageReadyAssertion | ++ |
TelephoneAssertion | +
+ A policy that adds telephone information to outbound requests.
+ |
+
public class DeviceRegistrationAwaitingActivationException +extends MAGException+
Modifier and Type | +Field and Description | +
---|---|
(package private) static java.lang.String |
+DEFAULT_MESSAGE |
+
Constructor and Description | +
---|
DeviceRegistrationAwaitingActivationException() |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
static final java.lang.String DEFAULT_MESSAGE+
public static interface RegistrationClient.DeviceRegistrationResult
+Modifier and Type | +Method and Description | +
---|---|
java.security.cert.X509Certificate[] |
+getClientCertificateChain() |
+
RegistrationClient.DeviceStatus |
+getDeviceStatus() |
+
IdToken |
+getIdToken() |
+
java.lang.String |
+getMagIdentifier() |
+
RegistrationClient.DeviceStatus getDeviceStatus()+
java.lang.String getMagIdentifier()+
IdToken getIdToken()+
java.security.cert.X509Certificate[] getClientCertificateChain()+
public static enum RegistrationClient.DeviceStatus +extends java.lang.Enum<RegistrationClient.DeviceStatus>+
Enum Constant and Description | +
---|
ACTIVATED
+Streamlined activation has succeeded.
+ |
+
REGISTERED
+Manual activation is required.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static RegistrationClient.DeviceStatus |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static RegistrationClient.DeviceStatus[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final RegistrationClient.DeviceStatus ACTIVATED+
public static final RegistrationClient.DeviceStatus REGISTERED+
public static RegistrationClient.DeviceStatus[] values()+
+for (RegistrationClient.DeviceStatus c : RegistrationClient.DeviceStatus.values()) + System.out.println(c); +
public static RegistrationClient.DeviceStatus valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class RegistrationClient +extends ServerClient+
Modifier and Type | +Class and Description | +
---|---|
static interface |
+RegistrationClient.DeviceRegistrationResult
+Represents the result of a successful device registration.
+ |
+
static class |
+RegistrationClient.DeviceStatus
+Represents the type of registration that occurred.
+ |
+
ACTIVATED, APPLICATION_X_WWW_FORM_URLENCODED, ASSERTION, CERT_FORMAT, CLIENT_AUTHORIZATION, CLIENT_EXPIRATION, CLIENT_ID, CLIENT_SECRET, conf, CONTENT_TYPE, CREATE_SESSION, DEFAULT_CONTENT_TYPE, DEVICE_ID, DEVICE_NAME, DEVICE_STATUS, GRANT_TYPE, ID_TOKEN, ID_TOKEN_TYPE, MAG_IDENTIFIER, MSSO, MSSO_CLIENT_REGISTER, MSSO_REGISTER, mssoContext, NONCE, OPENID, OPENID_PHONE_EMAIL, PEM, REFRESH_TOKEN, REGISTERED, SCOPE, TEXT_PLAIN, UTF_8, X_CA_ERR
Constructor and Description | +
---|
RegistrationClient(MssoContext mssoContext) |
+
Modifier and Type | +Method and Description | +
---|---|
private static RegistrationClient.DeviceStatus |
+findDeviceStatus(MASResponse response) |
+
private IdToken |
+findIdToken(MASResponse response,
+ boolean require) |
+
private java.lang.String |
+findMagIdentifier(MASResponse response) |
+
RegistrationClient.DeviceRegistrationResult |
+registerDevice(byte[] certificateSigningRequest,
+ MASRequest request,
+ java.lang.String clientId,
+ java.lang.String clientSecret,
+ java.lang.String deviceId,
+ java.lang.String deviceName,
+ boolean createSession)
+Register a device with the token server.
+ |
+
void |
+removeDeviceRegistration()
+Remove the device registration for the current device, both authorizing the removal via
+ TLS mutual authentication with the device's TLS client certificate private key.
+ |
+
createServerException, findErrorCode, obtainServerResponseToPostedForm
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RegistrationClient(MssoContext mssoContext)+
public RegistrationClient.DeviceRegistrationResult registerDevice(@NonNull + byte[] certificateSigningRequest, + @NonNull + MASRequest request, + @NonNull + java.lang.String clientId, + @NonNull + java.lang.String clientSecret, + @NonNull + java.lang.String deviceId, + @NonNull + java.lang.String deviceName, + boolean createSession) + throws RegistrationException, + RegistrationServerException+
certificateSigningRequest
- a PKCS#10 certificate signing request in raw binary form. Required.request
- the OAuth RequestclientId
- the client identifier for the app triggering registration. Required.clientSecret
- the client secret for the app triggering registration. Required.deviceId
- the device unique identifier string (eg the IMEI number). Required.deviceName
- the device name (eg "Joe's Nexus S"). Required.createSession
- true to create an SSO session at the same time as device registration. An ID token will be returned in the result.
+ false to register the device but create no SSO session. No ID token will be returned in the result.RegistrationClient.DeviceRegistrationResult
.RegistrationServerException
- if there is an error response from the token serverRegistrationException
private static RegistrationClient.DeviceStatus findDeviceStatus(MASResponse response) + throws RegistrationException+
RegistrationException
private java.lang.String findMagIdentifier(MASResponse response) + throws RegistrationException+
RegistrationException
private IdToken findIdToken(MASResponse response, + boolean require) + throws RegistrationException+
RegistrationException
public void removeDeviceRegistration() + throws RegistrationException, + RegistrationServerException+
RegistrationServerException
- if there is an error response from the token serverRegistrationException
- if there is an error other than a valid error JSON response from the token serverpublic class RegistrationException +extends MAGException+
Constructor and Description | +
---|
RegistrationException(int errorCode) |
+
RegistrationException(int errorCode,
+ java.lang.String detailMessage) |
+
RegistrationException(int errorCode,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
RegistrationException(int errorCode,
+ java.lang.Throwable throwable) |
+
getErrorCode
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public RegistrationException(int errorCode)+
public RegistrationException(int errorCode, + java.lang.String detailMessage)+
public RegistrationException(int errorCode, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public RegistrationException(int errorCode, + java.lang.Throwable throwable)+
public class RegistrationServerException +extends MAGServerException+
Constructor and Description | +
---|
RegistrationServerException(MAGServerException e) |
+
RegistrationServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage) |
+
RegistrationServerException(MASResponse response,
+ int errorCode,
+ int status,
+ java.lang.String contentType,
+ java.lang.String detailMessage,
+ java.lang.Throwable throwable) |
+
getContentType, getErrorCode, getResponse, getStatus
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public RegistrationServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage)+
public RegistrationServerException(MASResponse response, + int errorCode, + int status, + java.lang.String contentType, + java.lang.String detailMessage, + java.lang.Throwable throwable)+
public RegistrationServerException(MAGServerException e)+
Interface | +Description | +
---|---|
RegistrationClient.DeviceRegistrationResult | +
+ Represents the result of a successful device registration.
+ |
+
Class | +Description | +
---|---|
RegistrationClient | +
+ Utility class that encapsulates talking to the token server into Java method calls.
+ |
+
Enum | +Description | +
---|---|
RegistrationClient.DeviceStatus | +
+ Represents the type of registration that occurred.
+ |
+
Exception | +Description | +
---|---|
DeviceRegistrationAwaitingActivationException | +
+ Exception thrown if MAG requests cannot proceed because the device is registered but is awaiting
+ approval and activation by an administrator.
+ |
+
RegistrationException | +
+ This exception is thrown when an error occurs while processing the registration process.
+ |
+
RegistrationServerException | +
+ This exception is thrown when an error occurs while accessing register endpoint.
+ |
+
public class MAGInternalRequest +extends MAGRequestProxy+
MASRequest.MASRequestBuilder, MASRequest.Method
Modifier and Type | +Field and Description | +
---|---|
private MssoContext |
+context |
+
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
+magHeaders |
+
request
Constructor and Description | +
---|
MAGInternalRequest(MssoContext context,
+ MASRequest request) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addHeader(java.lang.String name,
+ java.lang.String value) |
+
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
+getHeaders() |
+
MASRequest |
+getRequest() |
+
java.lang.String |
+getScope() |
+
boolean |
+isLocalRequest() |
+
getBody, getConnectionListener, getGrantProvider, getMethod, getResponseBody, getURL, isPublic, notifyOnCancel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> magHeaders+
private MssoContext context+
public MAGInternalRequest(MssoContext context, + MASRequest request)+
public void addHeader(java.lang.String name, + java.lang.String value)+
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()+
getHeaders
in interface MASRequest
getHeaders
in class MAGRequestProxy
public java.lang.String getScope()+
getScope
in interface MASRequest
getScope
in class MAGRequestProxy
public boolean isLocalRequest()+
public MASRequest getRequest()+
public class AuthenticateRequest +extends MAGRequestProxy +implements LocalRequest+
MASRequest.MASRequestBuilder, MASRequest.Method
request
Constructor and Description | +
---|
AuthenticateRequest() |
+
Modifier and Type | +Method and Description | +
---|---|
MASResponse |
+send(MssoContext context) |
+
getBody, getConnectionListener, getGrantProvider, getHeaders, getMethod, getResponseBody, getScope, getURL, isPublic, notifyOnCancel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBody, getConnectionListener, getGrantProvider, getHeaders, getMethod, getResponseBody, getScope, getURL, isPublic, notifyOnCancel
public MASResponse send(MssoContext context)+
send
in interface LocalRequest
public interface LocalRequest<T> +extends MASRequest+
MASRequest.MASRequestBuilder, MASRequest.Method
Modifier and Type | +Method and Description | +
---|---|
MASResponse<T> |
+send(MssoContext context) |
+
getBody, getConnectionListener, getGrantProvider, getHeaders, getMethod, getResponseBody, getScope, getURL, isPublic, notifyOnCancel
MASResponse<T> send(MssoContext context) + throws java.io.IOException+
java.io.IOException
public abstract class MAGRequestProxy +extends java.lang.Object +implements MASRequest+
MASRequest.MASRequestBuilder, MASRequest.Method
Modifier and Type | +Field and Description | +
---|---|
protected MASRequest |
+request |
+
Constructor and Description | +
---|
MAGRequestProxy() |
+
Modifier and Type | +Method and Description | +
---|---|
MASRequestBody |
+getBody() |
+
MASConnectionListener |
+getConnectionListener() |
+
MASGrantProvider |
+getGrantProvider() |
+
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
+getHeaders() |
+
java.lang.String |
+getMethod() |
+
MASResponseBody |
+getResponseBody() |
+
java.lang.String |
+getScope() |
+
java.net.URL |
+getURL() |
+
boolean |
+isPublic() |
+
boolean |
+notifyOnCancel()
+Notify the
+MASCallback.onError(Throwable) when the request is cancelled by MAS.cancelRequest(long) . |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected MASRequest request+
public java.net.URL getURL()+
getURL
in interface MASRequest
public java.lang.String getMethod()+
getMethod
in interface MASRequest
MASRequest.Method
for supporting methodpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()+
getHeaders
in interface MASRequest
public MASGrantProvider getGrantProvider()+
getGrantProvider
in interface MASRequest
MASGrantProvider
for
+ supporting grant provider.public MASRequestBody getBody()+
getBody
in interface MASRequest
public MASResponseBody getResponseBody()+
getResponseBody
in interface MASRequest
MASResponseBody.byteArrayBody()
, you can change the response body to
+ MASResponseBody.jsonBody()
, and MASResponseBody.stringBody()
or you can
+ implement your own type of response body type.public MASConnectionListener getConnectionListener()+
getConnectionListener
in interface MASRequest
HttpURLConnection
listener.public java.lang.String getScope()+
getScope
in interface MASRequest
public boolean isPublic()+
isPublic
in interface MASRequest
public boolean notifyOnCancel()+
MASRequest
MASCallback.onError(Throwable)
when the request is cancelled by MAS.cancelRequest(long)
.notifyOnCancel
in interface MASRequest
MASCallback.onError(Throwable)
with MAS.RequestCancelledException
when the request is cancelled by
+ MAS.cancelRequest(long)
. Default is false.Interface | +Description | +
---|---|
LocalRequest<T> | +
+ A Request that send to the SDK but not to the Gateway.
+ |
+
Class | +Description | +
---|---|
AuthenticateRequest | ++ |
MAGRequestProxy | ++ |
Class | +Description | +
---|---|
MAGInternalRequest | +
+ A request message from a MAG SDK to MAG Server.
+ |
+
public class AccountManagerKeyStorageProvider +extends KeyStoreKeyStorageProvider+
Modifier and Type | +Field and Description | +
---|---|
private DataSource<java.lang.String,byte[]> |
+storage |
+
Constructor and Description | +
---|
AccountManagerKeyStorageProvider(android.content.Context ctx)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected boolean |
+deleteSecretKeyLocally(java.lang.String alias)
+Delete the secret key locally.
+ |
+
protected byte[] |
+getEncryptedSecretKey(java.lang.String alias) |
+
protected boolean |
+storeSecretKeyLocally(java.lang.String alias,
+ byte[] encryptedSecretkey) |
+
getContext, getKey, removeKey
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private DataSource<java.lang.String,byte[]> storage+
public AccountManagerKeyStorageProvider(@NonNull + android.content.Context ctx)+
ctx
- protected boolean storeSecretKeyLocally(java.lang.String alias, + byte[] encryptedSecretkey)+
storeSecretKeyLocally
in class KeyStoreKeyStorageProvider
alias
- The alias to store the key against.encryptedSecretkey
- The encrypted secret key to store.protected byte[] getEncryptedSecretKey(java.lang.String alias)+
getEncryptedSecretKey
in class KeyStoreKeyStorageProvider
alias
- The alias for the required secret key.protected boolean deleteSecretKeyLocally(java.lang.String alias)+
deleteSecretKeyLocally
in class KeyStoreKeyStorageProvider
alias
- The alias for the required secret key.public class AndroidJellyBeanKeyRepository +extends KeyStoreRepository+
Modifier and Type | +Field and Description | +
---|---|
private KeyStore |
+keyStore |
+
private static java.lang.String |
+PUTBLIC_KEY |
+
Constructor and Description | +
---|
AndroidJellyBeanKeyRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
java.security.KeyPair |
+createPrivateKey(java.lang.String alias,
+ GenerateKeyAttribute attributes)
+Create Private key and store to keystore
+ |
+
private java.security.PrivateKey |
+decodeRsaPrivateKey(byte[] pkcs8EncodedKeyBytes)
+Decode the specified PKCS#8 encoded RSA private key bytes into an RSA PrivateKey instance.
+ |
+
private java.security.PublicKey |
+decodeRsaPublicKey(byte[] x509EncodedKeyBytes)
+Decode the specified X.509 encoded SubjectPublicKeyInfo bytes into an RSA PublicKey instance.
+ |
+
void |
+deleteCertificateChain(java.lang.String alias)
+Delete certificate chain from keystore
+ |
+
void |
+deleteKey(java.lang.String alias)
+Delete Key from keystore
+ |
+
private static byte[] |
+encodeRsaPrivateKey(java.security.PrivateKey privateKey)
+Convert the specified private key into encoded key bytes in PKCS#8 format.
+ |
+
private byte[] |
+encodeRsaPublicKey(java.security.PublicKey publicKey)
+Convert the specified RSA public key into an X.509 SubjectPublicKeyInfo structure.
+ |
+
byte[] |
+generateCertificateSigningRequest(java.lang.String commonName,
+ java.lang.String deviceId,
+ java.lang.String deviceName,
+ java.lang.String organization,
+ java.security.PrivateKey privateKey,
+ java.security.PublicKey publicKey)
+Generate Certificate Signing Request
+ |
+
java.security.cert.X509Certificate[] |
+getCertificateChain(java.lang.String alias)
+Retrieve the stored Certificate Chain
+ |
+
java.security.Key |
+getPrivateKey(java.lang.String alias)
+Retrieve Private from keystore
+ |
+
java.security.Key |
+getPublicKey(java.lang.String alias)
+Retrieve Public from keystore
+ |
+
void |
+saveCertificateChain(java.lang.String alias,
+ java.security.cert.X509Certificate[] chain)
+Save certificate chain to keystore
+ |
+
getKeyStoreRepository, isPinRequired
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final java.lang.String PUTBLIC_KEY+
private KeyStore keyStore+
public AndroidJellyBeanKeyRepository()+
public java.security.Key getPrivateKey(java.lang.String alias) + throws KeyStoreException+
KeyStoreRepository
getPrivateKey
in class KeyStoreRepository
alias
- Private Key AliasKeyStoreException
public java.security.Key getPublicKey(java.lang.String alias) + throws KeyStoreException+
KeyStoreRepository
getPublicKey
in class KeyStoreRepository
alias
- Public Key AliasKeyStoreException
public void deleteKey(java.lang.String alias)+
KeyStoreRepository
deleteKey
in class KeyStoreRepository
alias
- Key Aliaspublic java.security.KeyPair createPrivateKey(java.lang.String alias, + GenerateKeyAttribute attributes) + throws KeyStoreException+
KeyStoreRepository
createPrivateKey
in class KeyStoreRepository
alias
- Alias to store the key pairattributes
- Attribute to generate the private keyKeyStoreException
public void saveCertificateChain(java.lang.String alias, + java.security.cert.X509Certificate[] chain)+
KeyStoreRepository
saveCertificateChain
in class KeyStoreRepository
alias
- Alias to store the certificate chainchain
- The certificate chain.public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias) + throws KeyStoreException+
KeyStoreRepository
getCertificateChain
in class KeyStoreRepository
alias
- Alias for the Certificate ChainKeyStoreException
public void deleteCertificateChain(java.lang.String alias)+
KeyStoreRepository
deleteCertificateChain
in class KeyStoreRepository
alias
- Alias for the Certificate Chainpublic byte[] generateCertificateSigningRequest(java.lang.String commonName, + java.lang.String deviceId, + java.lang.String deviceName, + java.lang.String organization, + java.security.PrivateKey privateKey, + java.security.PublicKey publicKey) + throws java.security.cert.CertificateException+
KeyStoreRepository
generateCertificateSigningRequest
in class KeyStoreRepository
java.security.cert.CertificateException
private static byte[] encodeRsaPrivateKey(java.security.PrivateKey privateKey)+
privateKey
- the private key to encode. Required.java.lang.IllegalArgumentException
- if the key is not RSA or cannot be encoded (perhaps it is a hardware key that cannot be exported)private java.security.PrivateKey decodeRsaPrivateKey(byte[] pkcs8EncodedKeyBytes) + throws java.security.NoSuchAlgorithmException, + java.security.spec.InvalidKeySpecException+
pkcs8EncodedKeyBytes
- the PKCS#8 encoded RSA private key bytes. Required.java.lang.IllegalArgumentException
- if the key cannot be decodedjava.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
private byte[] encodeRsaPublicKey(java.security.PublicKey publicKey)+
publicKey
- the public key to encode. Required.java.lang.IllegalArgumentException
- if the key is not RSA or cannot be encoded.private java.security.PublicKey decodeRsaPublicKey(byte[] x509EncodedKeyBytes) + throws java.security.NoSuchAlgorithmException, + java.security.spec.InvalidKeySpecException+
x509EncodedKeyBytes
- the X.509 encoded bytes of the public key. Required.java.lang.IllegalArgumentException
- if the key cannot be decodedjava.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
public class AndroidJellyBeanMR2KeyRepository +extends AndroidKeyStoreRepository+
Constructor and Description | +
---|
AndroidJellyBeanMR2KeyRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
(package private) java.security.spec.AlgorithmParameterSpec |
+getAlgorithmParameterSpec(java.lang.String alias,
+ GenerateKeyAttribute attribute) |
+
(package private) android.security.KeyPairGeneratorSpec.Builder |
+getKeyPairGeneratorSpecBuilder(java.lang.String alias,
+ GenerateKeyAttribute attributes) |
+
createPrivateKey, deleteCertificateChain, deleteKey, generateCertificateSigningRequest, getCertificateChain, getPrivateKey, getPublicKey, saveCertificateChain
getKeyStoreRepository, isPinRequired
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AndroidJellyBeanMR2KeyRepository()+
java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec(java.lang.String alias, + GenerateKeyAttribute attribute) + throws KeyStoreException+
getAlgorithmParameterSpec
in class AndroidKeyStoreRepository
KeyStoreException
android.security.KeyPairGeneratorSpec.Builder getKeyPairGeneratorSpecBuilder(java.lang.String alias, + GenerateKeyAttribute attributes)+
public class AndroidKitKatKeyRepository +extends AndroidJellyBeanMR2KeyRepository+
Constructor and Description | +
---|
AndroidKitKatKeyRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
(package private) android.security.KeyPairGeneratorSpec.Builder |
+getKeyPairGeneratorSpecBuilder(java.lang.String alias,
+ GenerateKeyAttribute attributes) |
+
getAlgorithmParameterSpec
createPrivateKey, deleteCertificateChain, deleteKey, generateCertificateSigningRequest, getCertificateChain, getPrivateKey, getPublicKey, saveCertificateChain
getKeyStoreRepository, isPinRequired
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AndroidKitKatKeyRepository()+
android.security.KeyPairGeneratorSpec.Builder getKeyPairGeneratorSpecBuilder(java.lang.String alias, + GenerateKeyAttribute attributes)+
getKeyPairGeneratorSpecBuilder
in class AndroidJellyBeanMR2KeyRepository
public class AndroidMKeyRepository +extends AndroidKeyStoreRepository+
Constructor and Description | +
---|
AndroidMKeyRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
(package private) java.security.spec.AlgorithmParameterSpec |
+getAlgorithmParameterSpec(java.lang.String alias,
+ GenerateKeyAttribute attributes) |
+
(package private) android.security.keystore.KeyGenParameterSpec.Builder |
+getKeyGenParameterSpecBuilder(java.lang.String alias,
+ GenerateKeyAttribute attributes) |
+
createPrivateKey, deleteCertificateChain, deleteKey, generateCertificateSigningRequest, getCertificateChain, getPrivateKey, getPublicKey, saveCertificateChain
getKeyStoreRepository, isPinRequired
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
android.security.keystore.KeyGenParameterSpec.Builder getKeyGenParameterSpecBuilder(java.lang.String alias, + GenerateKeyAttribute attributes)+
java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec(java.lang.String alias, + GenerateKeyAttribute attributes)+
getAlgorithmParameterSpec
in class AndroidKeyStoreRepository
public class AndroidNKeyRepository +extends AndroidMKeyRepository+
Constructor and Description | +
---|
AndroidNKeyRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
(package private) android.security.keystore.KeyGenParameterSpec.Builder |
+getKeyGenParameterSpecBuilder(java.lang.String alias,
+ GenerateKeyAttribute attributes) |
+
getAlgorithmParameterSpec
createPrivateKey, deleteCertificateChain, deleteKey, generateCertificateSigningRequest, getCertificateChain, getPrivateKey, getPublicKey, saveCertificateChain
getKeyStoreRepository, isPinRequired
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
android.security.keystore.KeyGenParameterSpec.Builder getKeyGenParameterSpecBuilder(java.lang.String alias, + GenerateKeyAttribute attributes)+
getKeyGenParameterSpecBuilder
in class AndroidMKeyRepository
public class DefaultEncryptionProvider +extends java.lang.Object +implements EncryptionProvider+
Modifier and Type | +Field and Description | +
---|---|
private static java.lang.String |
+KEY_ALIAS |
+
private KeyStorageProvider |
+ksp |
+
Constructor and Description | +
---|
DefaultEncryptionProvider(android.content.Context ctx) |
+
DefaultEncryptionProvider(android.content.Context ctx,
+ KeyStorageProvider keyStorageProvider) |
+
Modifier and Type | +Method and Description | +
---|---|
byte[] |
+decrypt(byte[] encryptedData) |
+
private void |
+destroyKey(javax.crypto.SecretKey key)
+Destroys the ephemeral key, in this case the Secret key generated for MAC, if the key implements Destroyable
+ |
+
byte[] |
+encrypt(byte[] data)
+Encrypts the given data.
+ |
+
protected java.lang.String |
+getKeyAlias() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private KeyStorageProvider ksp+
private static final java.lang.String KEY_ALIAS+
public DefaultEncryptionProvider(@NonNull + android.content.Context ctx)+
public DefaultEncryptionProvider(android.content.Context ctx, + KeyStorageProvider keyStorageProvider)+
protected java.lang.String getKeyAlias()+
public byte[] encrypt(byte[] data)+
encrypt
in interface EncryptionProvider
data
- : the data to encryptpublic byte[] decrypt(byte[] encryptedData)+
decrypt
in interface EncryptionProvider
encryptedData
- : data to be decryptedprivate void destroyKey(javax.crypto.SecretKey key)+
key
- public interface EncryptionProvider
+Modifier and Type | +Method and Description | +
---|---|
byte[] |
+decrypt(byte[] encryptedData) |
+
byte[] |
+encrypt(byte[] plaintext) |
+
public class GenerateKeyAttribute
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private java.lang.String |
+dn |
+
private boolean |
+encryptionRequired |
+
private boolean |
+invalidatedByBiometricEnrollment |
+
private int |
+keySize |
+
private boolean |
+userAuthenticationRequired |
+
private int |
+userAuthenticationValidityDurationSeconds |
+
Constructor and Description | +
---|
GenerateKeyAttribute() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getDn() |
+
int |
+getKeySize() |
+
int |
+getUserAuthenticationValidityDurationSeconds() |
+
boolean |
+isEncryptionRequired() |
+
boolean |
+isInvalidatedByBiometricEnrollment() |
+
boolean |
+isUserAuthenticationRequired() |
+
void |
+setDn(java.lang.String dn) |
+
void |
+setEncryptionRequired(boolean encryptionRequired) |
+
void |
+setInvalidatedByBiometricEnrollment(boolean invalidatedByBiometricEnrollment) |
+
void |
+setKeySize(int keySize) |
+
void |
+setUserAuthenticationRequired(boolean userAuthenticationRequired) |
+
void |
+setUserAuthenticationValidityDurationSeconds(int userAuthenticationValidityDurationSeconds) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private int keySize+
private boolean userAuthenticationRequired+
private boolean encryptionRequired+
private int userAuthenticationValidityDurationSeconds+
private boolean invalidatedByBiometricEnrollment+
private java.lang.String dn+
public boolean isEncryptionRequired()+
public void setEncryptionRequired(boolean encryptionRequired)+
public int getKeySize()+
public java.lang.String getDn()+
public void setDn(java.lang.String dn)+
public void setKeySize(int keySize)+
public boolean isUserAuthenticationRequired()+
public void setUserAuthenticationRequired(boolean userAuthenticationRequired)+
public int getUserAuthenticationValidityDurationSeconds()+
public void setUserAuthenticationValidityDurationSeconds(int userAuthenticationValidityDurationSeconds)+
public boolean isInvalidatedByBiometricEnrollment()+
public void setInvalidatedByBiometricEnrollment(boolean invalidatedByBiometricEnrollment)+
public interface KeyStorageProvider
+Modifier and Type | +Method and Description | +
---|---|
javax.crypto.SecretKey |
+getKey(java.lang.String alias,
+ boolean userAuthenticationRequired)
+Retrieve the SecretKey from Storage
+ |
+
boolean |
+removeKey(java.lang.String alias)
+Remove the key
+ |
+
javax.crypto.SecretKey getKey(java.lang.String alias, + boolean userAuthenticationRequired)+
alias
- : The alias to find the Keyboolean removeKey(java.lang.String alias)+
alias
- the alias of the key to removepublic interface KeyStore
+Modifier and Type | +Field and Description | +
---|---|
static int |
+KEY_NOT_FOUND |
+
static int |
+LOCKED |
+
static int |
+NO_ERROR |
+
static int |
+PERMISSION_DENIED |
+
static int |
+PROTOCOL_ERROR |
+
static int |
+SYSTEM_ERROR |
+
static int |
+UNDEFINED_ACTION |
+
static int |
+UNINITIALIZED |
+
static int |
+VALUE_CORRUPTED |
+
static int |
+WRONG_PASSWORD |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+contains(java.lang.String key) |
+
boolean |
+delete(java.lang.String key) |
+
byte[] |
+get(java.lang.String key) |
+
int |
+getLastError() |
+
boolean |
+isUnlocked() |
+
boolean |
+put(java.lang.String key,
+ byte[] value) |
+
java.lang.String[] |
+saw(java.lang.String prefix) |
+
static final int NO_ERROR+
static final int LOCKED+
static final int UNINITIALIZED+
static final int SYSTEM_ERROR+
static final int PROTOCOL_ERROR+
static final int PERMISSION_DENIED+
static final int KEY_NOT_FOUND+
static final int VALUE_CORRUPTED+
static final int UNDEFINED_ACTION+
static final int WRONG_PASSWORD+
boolean isUnlocked()+
boolean contains(java.lang.String key)+
boolean delete(java.lang.String key)+
boolean put(java.lang.String key, + byte[] value)+
byte[] get(java.lang.String key)+
int getLastError()+
java.lang.String[] saw(java.lang.String prefix)+
public class KeyStoreAdapter +extends java.lang.Object +implements KeyStore+
KeyStore
for various
+ Android KeyStore implementations from API level 16 and up
+
+ This class uses reflection to access the internal Android Keystore interface, this is not recommended to
+ use android internal interface, will consider to rewrite this component using
+ Android AccountManager.Modifier and Type | +Field and Description | +
---|---|
private java.lang.Object |
+mAndroidKeyStore |
+
private java.lang.reflect.Method |
+mContains |
+
private java.lang.reflect.Method |
+mDelete |
+
private java.lang.reflect.Method |
+mGet |
+
private java.lang.reflect.Method |
+mGetLastError |
+
private java.lang.reflect.Method |
+mList |
+
private java.lang.reflect.Method |
+mPut |
+
private java.lang.reflect.Method |
+mState |
+
private java.lang.Object[] |
+mStateEnumConstants |
+
private static KeyStoreAdapter |
+sInstance |
+
KEY_NOT_FOUND, LOCKED, NO_ERROR, PERMISSION_DENIED, PROTOCOL_ERROR, SYSTEM_ERROR, UNDEFINED_ACTION, UNINITIALIZED, VALUE_CORRUPTED, WRONG_PASSWORD
Modifier | +Constructor and Description | +
---|---|
private |
+KeyStoreAdapter() |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+contains(java.lang.String key) |
+
boolean |
+delete(java.lang.String key) |
+
byte[] |
+get(java.lang.String key) |
+
static KeyStore |
+getKeyStore() |
+
int |
+getLastError() |
+
boolean |
+isUnlocked() |
+
boolean |
+put(java.lang.String key,
+ byte[] value) |
+
java.lang.String[] |
+saw(java.lang.String prefix) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static KeyStoreAdapter sInstance+
private java.lang.Object mAndroidKeyStore+
private java.lang.reflect.Method mContains+
private java.lang.reflect.Method mDelete+
private java.lang.reflect.Method mPut+
private java.lang.reflect.Method mGet+
private java.lang.reflect.Method mGetLastError+
private java.lang.reflect.Method mList+
private java.lang.reflect.Method mState+
private java.lang.Object[] mStateEnumConstants+
public static KeyStore getKeyStore()+
public boolean isUnlocked()+
isUnlocked
in interface KeyStore
public boolean contains(java.lang.String key)+ +
public boolean delete(java.lang.String key)+ +
public boolean put(java.lang.String key, + byte[] value)+ +
public int getLastError()+
getLastError
in interface KeyStore
public class KeyStoreException
+extends java.lang.Exception
+Constructor and Description | +
---|
KeyStoreException(java.lang.String message,
+ java.lang.Throwable cause) |
+
KeyStoreException(java.lang.Throwable cause) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public abstract class KeyStoreKeyStorageProvider +extends java.lang.Object +implements KeyStorageProvider+
Modifier and Type | +Field and Description | +
---|---|
private static java.lang.String |
+ASYM_KEY_ALIAS |
+
private android.content.Context |
+context |
+
private static java.lang.String |
+RSA_ECB_PKCS1_PADDING |
+
private static int |
+VALIDITY_SECONDS |
+
Constructor and Description | +
---|
KeyStoreKeyStorageProvider(android.content.Context ctx)
+Default constructor.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
private javax.crypto.SecretKey |
+decryptSecretKey(byte[] encryptedSecretKey)
+This method decrypts a SecretKey using an RSA key.
+ |
+
(package private) abstract boolean |
+deleteSecretKeyLocally(java.lang.String alias)
+Delete the secret key locally.
+ |
+
private byte[] |
+encryptSecretKey(javax.crypto.SecretKey secretKey)
+This method encrypts a SecretKey using an RSA key.
+ |
+
android.content.Context |
+getContext() |
+
(package private) abstract byte[] |
+getEncryptedSecretKey(java.lang.String alias) |
+
javax.crypto.SecretKey |
+getKey(java.lang.String alias,
+ boolean userAuthenticationRequired)
+Retrieve the SecretKey from Storage
+ |
+
boolean |
+removeKey(java.lang.String alias)
+Remove the key
+ |
+
(package private) abstract boolean |
+storeSecretKeyLocally(java.lang.String alias,
+ byte[] encryptedSecretKey) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final int VALIDITY_SECONDS+
private static final java.lang.String ASYM_KEY_ALIAS+
private static final java.lang.String RSA_ECB_PKCS1_PADDING+
private android.content.Context context+
public KeyStoreKeyStorageProvider(@NonNull + android.content.Context ctx)+
ctx
- contextpublic javax.crypto.SecretKey getKey(java.lang.String alias, + boolean userAuthenticationRequired)+
getKey
in interface KeyStorageProvider
alias
- : The alias to find the Keypublic boolean removeKey(java.lang.String alias)+
removeKey
in interface KeyStorageProvider
alias
- the alias of the key to removeabstract boolean storeSecretKeyLocally(java.lang.String alias, + byte[] encryptedSecretKey)+
alias
- The alias to store the key against.encryptedSecretKey
- The encrypted secret key to store.abstract byte[] getEncryptedSecretKey(java.lang.String alias)+
alias
- The alias for the required secret key.abstract boolean deleteSecretKeyLocally(java.lang.String alias)+
alias
- Alias of the secret keyprivate byte[] encryptSecretKey(javax.crypto.SecretKey secretKey)+
secretKey
- SecretKey to encryptprivate javax.crypto.SecretKey decryptSecretKey(byte[] encryptedSecretKey)+
encryptedSecretKey
- the encrypted bytes of the secret keypublic android.content.Context getContext()+
public abstract class KeyStoreRepository
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private static KeyStoreRepository |
+keyStoreRepository |
+
private static boolean |
+pinRequired |
+
Constructor and Description | +
---|
KeyStoreRepository() |
+
Modifier and Type | +Method and Description | +
---|---|
abstract java.security.KeyPair |
+createPrivateKey(java.lang.String alias,
+ GenerateKeyAttribute attributes)
+Create Private key and store to keystore
+ |
+
abstract void |
+deleteCertificateChain(java.lang.String alias)
+Delete certificate chain from keystore
+ |
+
abstract void |
+deleteKey(java.lang.String alias)
+Delete Key from keystore
+ |
+
abstract byte[] |
+generateCertificateSigningRequest(java.lang.String commonName,
+ java.lang.String deviceId,
+ java.lang.String deviceName,
+ java.lang.String organization,
+ java.security.PrivateKey privateKey,
+ java.security.PublicKey publicKey)
+Generate Certificate Signing Request
+ |
+
abstract java.security.cert.X509Certificate[] |
+getCertificateChain(java.lang.String alias)
+Retrieve the stored Certificate Chain
+ |
+
static KeyStoreRepository |
+getKeyStoreRepository() |
+
abstract java.security.Key |
+getPrivateKey(java.lang.String alias)
+Retrieve Private from keystore
+ |
+
abstract java.security.Key |
+getPublicKey(java.lang.String alias)
+Retrieve Public from keystore
+ |
+
static boolean |
+isPinRequired() |
+
abstract void |
+saveCertificateChain(java.lang.String alias,
+ java.security.cert.X509Certificate[] chain)
+Save certificate chain to keystore
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final KeyStoreRepository keyStoreRepository+
private static final boolean pinRequired+
public abstract java.security.Key getPrivateKey(java.lang.String alias) + throws KeyStoreException+
alias
- Private Key AliasKeyStoreException
public abstract java.security.Key getPublicKey(java.lang.String alias) + throws KeyStoreException+
alias
- Public Key AliasKeyStoreException
public abstract void deleteKey(java.lang.String alias)+
alias
- Key Aliaspublic abstract java.security.KeyPair createPrivateKey(java.lang.String alias, + GenerateKeyAttribute attributes) + throws KeyStoreException+
alias
- Alias to store the key pairattributes
- Attribute to generate the private keyKeyStoreException
public abstract void saveCertificateChain(java.lang.String alias, + java.security.cert.X509Certificate[] chain) + throws KeyStoreException+
alias
- Alias to store the certificate chainchain
- The certificate chain.KeyStoreException
public abstract java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias) + throws KeyStoreException+
alias
- Alias for the Certificate ChainKeyStoreException
public abstract void deleteCertificateChain(java.lang.String alias)+
alias
- Alias for the Certificate Chainpublic abstract byte[] generateCertificateSigningRequest(java.lang.String commonName, + java.lang.String deviceId, + java.lang.String deviceName, + java.lang.String organization, + java.security.PrivateKey privateKey, + java.security.PublicKey publicKey) + throws java.security.cert.CertificateException+
java.security.cert.CertificateException
public static KeyStoreRepository getKeyStoreRepository()+
public static boolean isPinRequired()+
public class LockableEncryptionProvider +extends java.lang.Object +implements EncryptionProvider+
Modifier and Type | +Field and Description | +
---|---|
protected android.content.Context |
+ctx |
+
private java.lang.String |
+keyAlias |
+
Constructor and Description | +
---|
LockableEncryptionProvider(android.content.Context ctx) |
+
LockableEncryptionProvider(android.content.Context ctx,
+ java.lang.String keyAlias) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+clear()
+This does not clear the key, since it is protected
+ |
+
byte[] |
+decrypt(byte[] encryptedData)
+Decrypt the given data.
+ |
+
byte[] |
+encrypt(byte[] data)
+Encrypts the given data.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected android.content.Context ctx+
private java.lang.String keyAlias+
public LockableEncryptionProvider(@NonNull + android.content.Context ctx)+
public LockableEncryptionProvider(@NonNull + android.content.Context ctx, + @NonNull + java.lang.String keyAlias)+
public byte[] encrypt(byte[] data)+
encrypt
in interface EncryptionProvider
data
- the data to encryptpublic byte[] decrypt(byte[] encryptedData)+
decrypt
in interface EncryptionProvider
encryptedData
- data to be decryptedpublic boolean clear()+
public class ScreenLockEncryptionProvider +extends java.lang.Object +implements EncryptionProvider+
Modifier and Type | +Field and Description | +
---|---|
protected android.content.Context |
+ctx |
+
private java.lang.String |
+keyAlias |
+
private KeyStoreKeyStorageProvider |
+keyStorageProvider |
+
Constructor and Description | +
---|
ScreenLockEncryptionProvider(android.content.Context ctx)
+Constructor
+ |
+
ScreenLockEncryptionProvider(android.content.Context ctx,
+ KeyStoreKeyStorageProvider keyStorageProvider)
+Constructor for Android Pre-M, allows for setting
+ KeyStoreKeyStorageProvider
+ |
+
Modifier and Type | +Method and Description | +
---|---|
byte[] |
+decrypt(byte[] encryptedData)
+Decrypt the given data.
+ |
+
protected boolean |
+deviceHasScreenLock()
+Determine if there is a screen lock
+ |
+
byte[] |
+encrypt(byte[] data)
+Encrypts the given data.
+ |
+
protected javax.crypto.SecretKey |
+getKey(java.lang.String alias)
+Retrieve the SecretKey from Storage
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected android.content.Context ctx+
private java.lang.String keyAlias+
private KeyStoreKeyStorageProvider keyStorageProvider+
public ScreenLockEncryptionProvider(@NonNull + android.content.Context ctx)+
public ScreenLockEncryptionProvider(@NonNull + android.content.Context ctx, + KeyStoreKeyStorageProvider keyStorageProvider)+
public byte[] encrypt(byte[] data)+
encrypt
in interface EncryptionProvider
data
- the data to encryptpublic byte[] decrypt(byte[] encryptedData)+
decrypt
in interface EncryptionProvider
encryptedData
- data to be decryptedprotected javax.crypto.SecretKey getKey(java.lang.String alias)+
alias
- : The alias to find the Keyprotected boolean deviceHasScreenLock()+
public class SecureLockException
+extends java.lang.RuntimeException
+Constructor and Description | +
---|
SecureLockException() |
+
SecureLockException(java.lang.String message) |
+
SecureLockException(java.lang.String message,
+ java.lang.Throwable cause) |
+
SecureLockException(java.lang.Throwable cause) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public SecureLockException()+
public SecureLockException(java.lang.String message)+
public SecureLockException(java.lang.Throwable cause)+
public SecureLockException(java.lang.String message, + java.lang.Throwable cause)+
Interface | +Description | +
---|---|
EncryptionProvider | ++ |
KeyStorageProvider | +
+ This interface manages cryptographic keys
+ |
+
KeyStore | ++ |
Class | +Description | +
---|---|
AccountManagerKeyStorageProvider | ++ |
AndroidJellyBeanKeyRepository | ++ |
AndroidJellyBeanMR2KeyRepository | ++ |
AndroidKeyStoreRepository | ++ |
AndroidKitKatKeyRepository | ++ |
AndroidMKeyRepository | ++ |
AndroidNKeyRepository | ++ |
DefaultEncryptionProvider | ++ |
GenerateKeyAttribute | +
+ Attributes to generate keys
+ |
+
KeyStoreAdapter | +
+ Adapter that provides a common interface
+KeyStore for various
+ Android KeyStore implementations from API level 16 and up
+
+ This class uses reflection to access the internal Android Keystore interface, this is not recommended to
+ use android internal interface, will consider to rewrite this component using
+ Android AccountManager. |
+
KeyStoreKeyStorageProvider | ++ |
KeyStoreRepository | +
+ Abstract class to access and store keys and Certificate to the Android KeyStore.
+ |
+
LockableEncryptionProvider | ++ |
ScreenLockEncryptionProvider | +
+ This class supports key storage.
+ |
+
SharedPreferencesKeyStorageProvider | ++ |
Exception | +Description | +
---|---|
KeyStoreException | ++ |
SecureLockException | ++ |
public class AuthenticationProvider
+extends java.lang.Object
+implements android.os.Parcelable
+android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+ALL |
+
static android.os.Parcelable.Creator<AuthenticationProvider> |
+CREATOR |
+
static java.lang.String |
+ENTERPRISE |
+
(package private) java.lang.String |
+idp |
+
(package private) java.util.List<Provider> |
+providers |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
protected |
+AuthenticationProvider(android.os.Parcel in) |
+
|
+AuthenticationProvider(java.lang.String idp,
+ java.util.List<Provider> providers) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+describeContents() |
+
java.lang.String |
+getIdp() |
+
java.util.List<Provider> |
+getProviders() |
+
boolean |
+isEnterpriseEnabled() |
+
void |
+writeToParcel(android.os.Parcel dest,
+ int flags) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String ALL+
public static final java.lang.String ENTERPRISE+
java.lang.String idp+
java.util.List<Provider> providers+
public static final android.os.Parcelable.Creator<AuthenticationProvider> CREATOR+
public AuthenticationProvider(java.lang.String idp, + java.util.List<Provider> providers)+
protected AuthenticationProvider(android.os.Parcel in)+
public boolean isEnterpriseEnabled()+
public java.lang.String getIdp()+
public java.util.List<Provider> getProviders()+
public int describeContents()+
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, + int flags)+
writeToParcel
in interface android.os.Parcelable
public class MssoClient
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
private static class |
+MssoClient.MssoClientAuthenticateAsyncTask |
+
Modifier and Type | +Field and Description | +
---|---|
private android.content.Context |
+appContext |
+
private MssoContext |
+mssoContext |
+
Constructor and Description | +
---|
MssoClient(MssoContext mssoContext,
+ android.content.Context sysContext)
+Create a service client with the specified MSSO context and system context.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+authenticate(MASAuthCredentials credentials,
+ MAGResultReceiver resultReceiver)
+Logs in a user with MASAuthCredentials.
+ |
+
void |
+cancelAll(android.os.Bundle data)
+Canceling any pending requests and responses that were created by this MssoClient.
+ |
+
void |
+cancelRequest(long requestId,
+ android.os.Bundle data)
+Cancel the specified request ID.
+ |
+
private android.content.Intent |
+createAuthenticationIntent(MASAuthCredentials credentials,
+ MAGResultReceiver resultReceiver) |
+
void |
+processPendingRequests()
+Submit a wakeup message to the intent service, ensuring that any enqueued requests are being processed.
+ |
+
long |
+processRequest(MASRequest request,
+ android.os.ResultReceiver resultReceiver)
+Submit a request to be processed.
+ |
+
static MASResponse |
+takeMAGResponse(long requestId)
+Collect a response to the specified request ID, if one is available.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private final android.content.Context appContext+
private final MssoContext mssoContext+
public MssoClient(MssoContext mssoContext, + android.content.Context sysContext)+
mssoContext
- the configured and initialized MSSO context. Required.sysContext
- the system context to use for invoking the MssoService. Required.public long processRequest(MASRequest request, + android.os.ResultReceiver resultReceiver)+
request
- the request to send. Required.resultReceiver
- the resultReceiver to notify when a response is available, or if there is an error. Required.private android.content.Intent createAuthenticationIntent(MASAuthCredentials credentials, + MAGResultReceiver resultReceiver)+
public void authenticate(MASAuthCredentials credentials, + MAGResultReceiver resultReceiver)+
Logs in a user with MASAuthCredentials. +
The response to the request will eventually be delivered to the specified result receiver.
+This method returns immediately to the calling thread
credentials
- The credentials to log in withresultReceiver
- The resultReceiver to notify when a response is available, or if there is an error. Required.public void processPendingRequests()+
public static MASResponse takeMAGResponse(long requestId)+
requestId
- the request ID whose response to pick up.public void cancelRequest(long requestId, + android.os.Bundle data)+
requestId
- the request ID to cancel.public void cancelAll(android.os.Bundle data)+
public interface MssoIntents
+Holds constants related to intents used by the MSSO service.
+If implementing a custom login dialog activity, you will need to start the login activity in response + to an OBTAIN_CREDENTIALS intent. When credentials are obtained you should startService with the CREDENTIALS_OBTAINED + intent. If the activity is canceled (including via the back button), you should startService with the CANCEL_REQUEST + intent. Response intents must include the EXTRA_REQUEST_ID long value copied from the OBTAIN_CREDENTIALS intent.
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+ACTION_CREDENTIALS_OBTAINED
+An Intent with this action is used by a logon activity to send logon information back to the MssoService.
+ |
+
static java.lang.String |
+ACTION_PROCESS_REQUEST
+An Intent with this action triggers processing (or reprocessing) of a request expected to be already present in the MssoRequestQueue.
+ |
+
static java.lang.String |
+EXTRA_ADDITIONAL_HEADERS |
+
static java.lang.String |
+EXTRA_AUTH_PROVIDERS
+The authentication provider.
+ |
+
static java.lang.String |
+EXTRA_CREDENTIALS
+The user credentials being provided with CREDENTIALS_OBTAINED.
+ |
+
static java.lang.String |
+EXTRA_OTP_HANDLER
+The otp authentication otp handler.
+ |
+
static java.lang.String |
+EXTRA_REQUEST_ID
+The ID of the request to (re)process, or -1 to process all pending queued requests that are not currently being processed.
+ |
+
static int |
+RESULT_CODE_ERR
+Result code indicating the a response could not be obtained due to an I/O error.
+ |
+
static int |
+RESULT_CODE_ERR_CANCELED
+Result code indicating that a request was canceled, perhaps by the user canceling a log on dialog.
+ |
+
static int |
+RESULT_CODE_SUCCESS
+Result code indicating an HTTP request was delivered to the target server and a response was received (though the HTTP-level response code may be other than 200).
+ |
+
static java.lang.String |
+RESULT_ERROR
+An error object related to a result code other than RESULT_CODE_SUCCESS.
+ |
+
static java.lang.String |
+RESULT_ERROR_MESSAGE
+An error message related to a result code other than RESULT_CODE_SUCCESS.
+ |
+
static java.lang.String |
+RESULT_REQUEST_ID
+The ID of the request, for picking up the result from the MssoResponseQueue.
+ |
+
static final java.lang.String ACTION_PROCESS_REQUEST+
static final java.lang.String ACTION_CREDENTIALS_OBTAINED+
static final java.lang.String EXTRA_REQUEST_ID+
static final java.lang.String EXTRA_CREDENTIALS+
static final java.lang.String EXTRA_ADDITIONAL_HEADERS+
static final java.lang.String EXTRA_OTP_HANDLER+
static final java.lang.String EXTRA_AUTH_PROVIDERS+
static final int RESULT_CODE_SUCCESS+
static final int RESULT_CODE_ERR+
static final int RESULT_CODE_ERR_CANCELED+
static final java.lang.String RESULT_REQUEST_ID+
static final java.lang.String RESULT_ERROR_MESSAGE+
static final java.lang.String RESULT_ERROR+
public class MssoService
+extends android.app.IntentService
+START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVE
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
MssoService() |
+
Modifier and Type | +Method and Description | +
---|---|
private MssoResponse |
+createMssoResponse(MssoRequest request,
+ MASResponse response) |
+
private void |
+handleErrorResponse(MssoRequest request,
+ java.lang.Exception e) |
+
private boolean |
+handleInterceptors(long requestId,
+ MASRequest request,
+ android.os.Bundle requestExtra,
+ MASResponse response) |
+
private void |
+onCredentialsObtained(android.os.Bundle extras,
+ MssoRequest request) |
+
protected void |
+onHandleIntent(android.content.Intent intent) |
+
private void |
+onProcessAllPendingRequests() |
+
private void |
+onProcessRequest(MssoRequest request) |
+
private boolean |
+requestFinished(MssoRequest request) |
+
private void |
+respondError(android.os.ResultReceiver receiver,
+ MAGError error) |
+
private void |
+respondSuccess(android.os.ResultReceiver receiver,
+ long requestId,
+ java.lang.String errorMessage) |
+
private void |
+startThreadedRequest(android.os.Bundle extras,
+ MssoRequest request) |
+
private MssoRequest |
+takeActiveRequest(long requestId) |
+
onBind, onCreate, onDestroy, onStart, onStartCommand, setIntentRedelivery
dump, getApplication, onConfigurationChanged, onLowMemory, onRebind, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
attachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected void onHandleIntent(android.content.Intent intent)+
onHandleIntent
in class android.app.IntentService
private void startThreadedRequest(android.os.Bundle extras, + MssoRequest request)+
private void onCredentialsObtained(android.os.Bundle extras, + MssoRequest request)+
private void onProcessAllPendingRequests()+
private void onProcessRequest(MssoRequest request)+
private void handleErrorResponse(MssoRequest request, + java.lang.Exception e)+
private boolean handleInterceptors(long requestId, + MASRequest request, + android.os.Bundle requestExtra, + MASResponse response)+
private MssoResponse createMssoResponse(MssoRequest request, + MASResponse response)+
private MssoRequest takeActiveRequest(long requestId)+
private boolean requestFinished(MssoRequest request)+
private void respondError(android.os.ResultReceiver receiver, + MAGError error)+
private void respondSuccess(android.os.ResultReceiver receiver, + long requestId, + java.lang.String errorMessage)+
public class MssoState
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private static java.util.concurrent.atomic.AtomicBoolean |
+expectingUnlock |
+
Modifier and Type | +Method and Description | +
---|---|
(package private) static boolean |
+isExpectedUnlock() |
+
(package private) static void |
+setExpectingUnlock(boolean b) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class Provider
+extends java.lang.Object
+implements android.os.Parcelable
+android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
static android.os.Parcelable.Creator<Provider> |
+CREATOR |
+
private java.lang.Integer |
+iconId |
+
private java.lang.String |
+id |
+
private java.lang.String |
+pollUrl |
+
private java.lang.String |
+url |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
protected |
+Provider(android.os.Parcel in) |
+
|
+Provider(java.lang.String id,
+ java.lang.String url,
+ java.lang.String pollUrl,
+ java.lang.Integer iconId) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+describeContents() |
+
java.lang.Integer |
+getIconId() |
+
java.lang.String |
+getId() |
+
java.lang.String |
+getPollUrl() |
+
java.lang.String |
+getUrl() |
+
void |
+writeToParcel(android.os.Parcel dest,
+ int flags) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private java.lang.String id+
private java.lang.String url+
private java.lang.String pollUrl+
private java.lang.Integer iconId+
public static final android.os.Parcelable.Creator<Provider> CREATOR+
public Provider(java.lang.String id, + java.lang.String url, + java.lang.String pollUrl, + java.lang.Integer iconId)+
protected Provider(android.os.Parcel in)+
public java.lang.String getId()+
public java.lang.String getPollUrl()+
public java.lang.String getUrl()+
public java.lang.Integer getIconId()+
public int describeContents()+
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, + int flags)+
writeToParcel
in interface android.os.Parcelable
Interface | +Description | +
---|---|
MssoIntents | +
+ Holds constants related to intents used by the MSSO service.
+ |
+
Class | +Description | +
---|---|
AuthenticationProvider | ++ |
MssoActiveQueue | +
+ Represents pending active requests.
+ |
+
MssoClient | +
+ Encapsulates use of the MssoService.
+ |
+
MssoClient.MssoClientAuthenticateAsyncTask | ++ |
MssoExecutorService | +
+ An executor service to manage the thread launching mechanism for
+MssoService . |
+
MssoRequest | +
+ Holds information about an MSSO request while it is waiting to be processed.
+ |
+
MssoRequestQueue | +
+ Represents pending outbound requests.
+ |
+
MssoResponse | +
+ Holds information about a response to an MSSO request that is awaiting pickup.
+ |
+
MssoResponseQueue | +
+ Represents completed responses awaiting pickup.
+ |
+
MssoService | +
+ An IntentService that receives outbound HTTP requests encoded into Intents and returns the eventual responses
+ via a ResultReceiver.
+ |
+
MssoState | +
+ Holds flag variables indicating various things.
+ |
+
Provider | ++ |
public abstract class Storage
+extends java.lang.Object
+StorageResult
, when ever possible.
+
+ The interface has methods that
+
+ a) Returns a value: These are generally meant for Synchronous operations. Implementations should
+ throw an StorageException
with code StorageException.UNSUPPORTED_OPERATION
+ if the storage cannot be accessed in a Synchronous/Atomic way, so that a value can be returned.
+
+ b) Does not return a value: These are meant for Asynchronous operations. The caller should be
+ notified about the operation status via the callback parameter that is passed in. Also these
+ methods could throw Exceptions, in case of some input validations.
+ Modifier and Type | +Field and Description | +
---|---|
protected static java.lang.String |
+UTF8 |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+Storage(java.lang.Object options)
+Initialize the storage.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
abstract StorageResult |
+deleteAll()
+Deletes all entries from the storage.
+ |
+
abstract void |
+deleteAll(StorageResultReceiver callback)
+Deletes all entries from the storage.
+ |
+
abstract StorageResult |
+deleteData(java.lang.String key)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
abstract void |
+deleteData(java.lang.String key,
+ StorageResultReceiver callback)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
abstract StorageResult |
+deleteString(java.lang.String key) |
+
abstract void |
+deleteString(java.lang.String key,
+ StorageResultReceiver callback) |
+
abstract StorageResult |
+getAllKeys()
+Fetch all the keys against which data are stored.
+ |
+
abstract void |
+getAllKeys(StorageResultReceiver callback)
+Fetch all the keys against which data are stored.
+ |
+
abstract MASStorageManager.MASStorageType |
+getType()
+Gets the type of storage.
+ |
+
abstract StorageResult |
+readData(java.lang.String key)
+Fetches generic data from the Store.
+ |
+
abstract void |
+readData(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches generic data from the Store.
+ |
+
abstract StorageResult |
+readString(java.lang.String key)
+Fetches String data from the Store.
+ |
+
abstract void |
+readString(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches String from the Store.
+ |
+
abstract StorageResult |
+updateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
abstract void |
+updateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
abstract StorageResult |
+updateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new String.
+ |
+
abstract void |
+updateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new String.
+ |
+
abstract StorageResult |
+writeData(java.lang.String key,
+ byte[] value)
+Writes some generic data to the Storage.
+ |
+
abstract void |
+writeData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Writes some generic data to the Storage.
+ |
+
abstract StorageResult |
+writeOrUpdateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
abstract void |
+writeOrUpdateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
abstract StorageResult |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new one.
+ |
+
abstract void |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
abstract StorageResult |
+writeString(java.lang.String key,
+ java.lang.String value)
+Writes String data to the Storage.
+ |
+
abstract void |
+writeString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Writes String data to the Storage.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected static final java.lang.String UTF8+
protected Storage(java.lang.Object options) + throws StorageException+
options
- Input to set up the storageStorageException
- if initialization of storage fails.public abstract MASStorageManager.MASStorageType getType()+
MASStorageManager.MASStorageType.TYPE_KEYSTORE
public abstract StorageResult writeData(java.lang.String key, + byte[] value) + throws StorageException+
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedStorageException
- if input validation fails.public abstract void writeData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult writeString(java.lang.String key, + java.lang.String value) + throws StorageException+
key
- The key against which the data has to be storedvalue
- The String data that need to be storedStorageException
- if input validation fails.public abstract void writeString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
key
- The key against which the data has to be storedvalue
- The String data that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult readData(java.lang.String key) + throws StorageException+
key
- The key for which the data has to be retrievedStorageException
- if input validation fails.public abstract void readData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult readString(java.lang.String key) + throws StorageException+
key
- The key for which the String data has to be retrievedStorageException
- if input validation fails.public abstract void readString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the String data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult updateData(java.lang.String key, + byte[] value) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public abstract void updateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult updateString(java.lang.String key, + java.lang.String value) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public abstract void updateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult writeOrUpdateData(java.lang.String key, + byte[] value) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public abstract void writeOrUpdateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult writeOrUpdateString(java.lang.String key, + java.lang.String value) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public abstract void writeOrUpdateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult deleteData(java.lang.String key) + throws StorageException+
key
- The key for which the data will be deletedStorageException
public abstract StorageResult deleteString(java.lang.String key) + throws StorageException+
StorageException
public abstract void deleteData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
key
- The key for which the data will be deletedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract void deleteString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
StorageException
public abstract StorageResult deleteAll()+
public abstract void deleteAll(StorageResultReceiver callback) + throws StorageException+
callback
- Notifies the caller with a StorageResult which is expected to have
+ - status part to be SUCCESS, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public abstract StorageResult getAllKeys()+
public abstract void getAllKeys(StorageResultReceiver callback) + throws StorageException+
callback
- send a StorageResult , which is expected to have
+ - a list of all the keys (or an empty list) as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public class StorageException
+extends java.lang.Exception
+implements android.os.Parcelable
+android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
private int |
+code
+The code that is associated with this instance
+ |
+
static android.os.Parcelable.Creator |
+CREATOR |
+
static int |
+DATA_SIZE_LIMIT_EXCEEDED |
+
static int |
+DO_NOT_USE |
+
static int |
+INSTANTIATION_ERROR |
+
static int |
+INSTANTIATION_ERROR_UNAUTHORIZED |
+
static int |
+INVALID_INPUT |
+
static int |
+INVALID_INPUT_CALLBACK |
+
static int |
+INVALID_INPUT_KEY |
+
static int |
+INVALID_INPUT_VALUE |
+
static int |
+KEY_SIZE_LIMIT_EXCEEDED |
+
static int |
+KEYSTORE_DATA_SIZE_LIMIT_EXCEEDED |
+
static int |
+KEYSTORE_KEY_SIZE_LIMIT_EXCEEDED |
+
static int |
+OPERATION_FAILED |
+
static int |
+READ_DATA_NOT_FOUND |
+
static int |
+STORE_NOT_FOUND |
+
static int |
+STORE_NOT_UNLOCKED |
+
static int |
+UNKNOWN_ERROR |
+
static int |
+UNSUPPORTED_DATA |
+
static int |
+UNSUPPORTED_OPERATION |
+
static int |
+WRITE_DATA_ALREADY_EXISTS |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
|
+StorageException(int code) |
+
private |
+StorageException(android.os.Parcel input) |
+
|
+StorageException(java.lang.String detailMessage,
+ java.lang.Throwable throwable,
+ int code) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+describeContents() |
+
int |
+getCode() |
+
void |
+writeToParcel(android.os.Parcel destination,
+ int flags) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final android.os.Parcelable.Creator CREATOR+
public static final int UNKNOWN_ERROR+
public static final int INVALID_INPUT_KEY+
public static final int INVALID_INPUT_VALUE+
public static final int INVALID_INPUT_CALLBACK+
public static final int WRITE_DATA_ALREADY_EXISTS+
public static final int READ_DATA_NOT_FOUND+
public static final int INSTANTIATION_ERROR+
public static final int DO_NOT_USE+
public static final int STORE_NOT_FOUND+
public static final int UNSUPPORTED_DATA+
public static final int OPERATION_FAILED+
public static final int INVALID_INPUT+
public static final int UNSUPPORTED_OPERATION+
public static final int KEY_SIZE_LIMIT_EXCEEDED+
public static final int DATA_SIZE_LIMIT_EXCEEDED+
public static final int INSTANTIATION_ERROR_UNAUTHORIZED+
public static final int KEYSTORE_KEY_SIZE_LIMIT_EXCEEDED+
public static final int KEYSTORE_DATA_SIZE_LIMIT_EXCEEDED+
public static final int STORE_NOT_UNLOCKED+
private int code+
public StorageException(int code)+
public StorageException(java.lang.String detailMessage, + java.lang.Throwable throwable, + int code)+
private StorageException(android.os.Parcel input)+
public int getCode()+
public int describeContents()+
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel destination, + int flags)+
writeToParcel
in interface android.os.Parcelable
public static enum StorageResult.StorageOperationStatus +extends java.lang.Enum<StorageResult.StorageOperationStatus>+
Enum Constant and Description | +
---|
FAILURE |
+
SUCCESS |
+
Modifier and Type | +Field and Description | +
---|---|
private int |
+value |
+
Modifier and Type | +Method and Description | +
---|---|
static StorageResult.StorageOperationStatus |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static StorageResult.StorageOperationStatus[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final StorageResult.StorageOperationStatus SUCCESS+
public static final StorageResult.StorageOperationStatus FAILURE+
public static StorageResult.StorageOperationStatus[] values()+
+for (StorageResult.StorageOperationStatus c : StorageResult.StorageOperationStatus.values()) + System.out.println(c); +
public static StorageResult.StorageOperationStatus valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum StorageResult.StorageOperationType +extends java.lang.Enum<StorageResult.StorageOperationType>+
Enum Constant and Description | +
---|
DELETE |
+
DELETE_ALL |
+
DELETE_STRING |
+
GET_ALL_KEYS |
+
READ |
+
READ_STRING |
+
UPDATE |
+
UPDATE_STRING |
+
WRITE |
+
WRITE_OR_UPDATE |
+
WRITE_OR_UPDATE_STRING |
+
WRITE_STRING |
+
Modifier and Type | +Field and Description | +
---|---|
private int |
+value |
+
Modifier and Type | +Method and Description | +
---|---|
static StorageResult.StorageOperationType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static StorageResult.StorageOperationType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final StorageResult.StorageOperationType WRITE+
public static final StorageResult.StorageOperationType WRITE_STRING+
public static final StorageResult.StorageOperationType READ+
public static final StorageResult.StorageOperationType READ_STRING+
public static final StorageResult.StorageOperationType UPDATE+
public static final StorageResult.StorageOperationType UPDATE_STRING+
public static final StorageResult.StorageOperationType DELETE+
public static final StorageResult.StorageOperationType DELETE_STRING+
public static final StorageResult.StorageOperationType DELETE_ALL+
public static final StorageResult.StorageOperationType WRITE_OR_UPDATE+
public static final StorageResult.StorageOperationType WRITE_OR_UPDATE_STRING+
public static final StorageResult.StorageOperationType GET_ALL_KEYS+
public static StorageResult.StorageOperationType[] values()+
+for (StorageResult.StorageOperationType c : StorageResult.StorageOperationType.values()) + System.out.println(c); +
public static StorageResult.StorageOperationType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class StorageResult
+extends java.lang.Object
+implements android.os.Parcelable
+Modifier and Type | +Class and Description | +
---|---|
static class |
+StorageResult.StorageOperationStatus |
+
static class |
+StorageResult.StorageOperationType |
+
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Modifier and Type | +Field and Description | +
---|---|
static android.os.Parcelable.Creator |
+CREATOR |
+
private java.lang.Object |
+data
+The data that needs to be passed across.
+ |
+
private StorageResult.StorageOperationStatus |
+status
+The Status of the operation, which defaults to
+StorageResult.StorageOperationStatus.SUCCESS |
+
private StorageResult.StorageOperationType |
+type
+The type of the operation, this result represents
+ |
+
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | +Constructor and Description | +
---|---|
private |
+StorageResult(android.os.Parcel input) |
+
|
+StorageResult(StorageResult.StorageOperationType type) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+describeContents() |
+
java.lang.Object |
+getData() |
+
StorageResult.StorageOperationStatus |
+getStatus() |
+
StorageResult.StorageOperationType |
+getType() |
+
void |
+setData(java.lang.Object data) |
+
void |
+setStatus(StorageResult.StorageOperationStatus status) |
+
void |
+setType(StorageResult.StorageOperationType type) |
+
void |
+writeToParcel(android.os.Parcel dest,
+ int flags) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final android.os.Parcelable.Creator CREATOR+
private StorageResult.StorageOperationStatus status+
StorageResult.StorageOperationStatus.SUCCESS
private java.lang.Object data+
private StorageResult.StorageOperationType type+
public StorageResult(StorageResult.StorageOperationType type)+
private StorageResult(android.os.Parcel input)+
public StorageResult.StorageOperationType getType()+
public void setType(StorageResult.StorageOperationType type)+
public StorageResult.StorageOperationStatus getStatus()+
public void setStatus(StorageResult.StorageOperationStatus status)+
public java.lang.Object getData()+
public void setData(java.lang.Object data)+
public int describeContents()+
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, + int flags)+
writeToParcel
in interface android.os.Parcelable
public class StorageResultReceiver
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
private android.os.ResultReceiver |
+receiver |
+
Constructor and Description | +
---|
StorageResultReceiver(android.os.Handler handler) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onReceiveResult(StorageResult result)
+Override to receive results delivered to this object
+ |
+
void |
+send(StorageResult result)
+Deliver a result to this receiver.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public StorageResultReceiver(android.os.Handler handler)+
public final void send(StorageResult result)+
result
- The @{link StorageResult} to onReceiveResult to the caller.public void onReceiveResult(StorageResult result)+
result
- The @{link StorageResult} holding the operation resultpublic class AMSAuthenticatorService
+extends android.app.Service
+Modifier and Type | +Class and Description | +
---|---|
private class |
+AMSAuthenticatorService.AccountAuthenticator
+Empty Authenticator implementation, as our main goal here is storage.
+ |
+
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVE
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
AMSAuthenticatorService() |
+
Modifier and Type | +Method and Description | +
---|---|
android.os.IBinder |
+onBind(android.content.Intent intent) |
+
dump, getApplication, onConfigurationChanged, onCreate, onDestroy, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
attachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class AccountManagerStorage +extends Storage+
AccountManager
+ to store key value pairs in the Android Accounts Database (inside the "extras" table).Modifier and Type | +Class and Description | +
---|---|
private class |
+AccountManagerStorage.AccountIndexFormatter
+Class responsible for marshalling and unmarshalling the key index.
+ |
+
Modifier and Type | +Field and Description | +
---|---|
private AMSSManager |
+accountManager
+AMS Manager
+ |
+
private static java.lang.String |
+KEYINDEX_COLUMN_NAME
+Column name for the key-index
+ |
+
private static int |
+MAX_DATA_SIZE |
+
private static int |
+MAX_KEY_SIZE |
+
private android.content.Context |
+mContext
+The application context
+ |
+
private AccountManagerStorage.AccountIndexFormatter |
+mFormatter
+Handle to the class responsible to marshaling and unmarshaling the key index.
+ |
+
private java.lang.String |
+mPrefix
+Key Prefix.
+ |
+
private static int |
+SQLITE_MAX_LENGTH
+Limits for key/value
+ |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+AccountManagerStorage(java.lang.Object options)
+Initialize the storage.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
StorageResult |
+deleteAll()
+Deletes all entries from the storage.
+ |
+
void |
+deleteAll(StorageResultReceiver callback)
+Deletes all entries from the storage.
+ |
+
StorageResult |
+deleteData(java.lang.String key)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
void |
+deleteData(java.lang.String key,
+ StorageResultReceiver callback)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
StorageResult |
+deleteString(java.lang.String key) |
+
void |
+deleteString(java.lang.String key,
+ StorageResultReceiver callback) |
+
StorageResult |
+getAllKeys()
+Fetch all the keys against which data are stored.
+ |
+
void |
+getAllKeys(StorageResultReceiver callback)
+Fetch all the keys against which data are stored.
+ |
+
MASStorageManager.MASStorageType |
+getType()
+Gets the type of storage.
+ |
+
private void |
+notifyCallback(StorageResultReceiver callback,
+ StorageResult result) |
+
private java.lang.String |
+readAccountData(android.content.Context ctx,
+ java.lang.String key) |
+
StorageResult |
+readData(java.lang.String key)
+Fetches generic data from the Store.
+ |
+
void |
+readData(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches generic data from the Store.
+ |
+
StorageResult |
+readString(java.lang.String key)
+Fetches String data from the Store.
+ |
+
void |
+readString(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches String from the Store.
+ |
+
private void |
+updateAccountKeyIndex(android.content.Context ctx,
+ java.lang.String key,
+ java.lang.String value) |
+
StorageResult |
+updateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+updateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+updateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new String.
+ |
+
void |
+updateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new String.
+ |
+
private void |
+validateInputs(java.lang.String key,
+ byte[] value)
+This methods checks for cases such as null or min and max length of the key and data.
+ |
+
private void |
+validateInputs(java.lang.String key,
+ java.lang.String value)
+This methods checks for cases such as null or min and max length of the key and data.
+ |
+
private void |
+writeAccountData(android.content.Context ctx,
+ java.lang.String encodedKey,
+ java.lang.String value) |
+
StorageResult |
+writeData(java.lang.String key,
+ byte[] value)
+Writes some generic data to the Storage.
+ |
+
private StorageResult |
+writeData(java.lang.String key,
+ byte[] value,
+ int option) |
+
void |
+writeData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Writes some generic data to the Storage.
+ |
+
StorageResult |
+writeOrUpdateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+writeOrUpdateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+writeString(java.lang.String key,
+ java.lang.String value)
+Writes String data to the Storage.
+ |
+
void |
+writeString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Writes String data to the Storage.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private static final int SQLITE_MAX_LENGTH+
private static final int MAX_DATA_SIZE+
private static final int MAX_KEY_SIZE+
private static final java.lang.String KEYINDEX_COLUMN_NAME+
private java.lang.String mPrefix+
private android.content.Context mContext+
private AccountManagerStorage.AccountIndexFormatter mFormatter+
private AMSSManager accountManager+
protected AccountManagerStorage(java.lang.Object options) + throws StorageException+
options
- Array of Objects
+ First object: Context
+ (Optional) Second: boolean value indicating shared or private spaceStorageException
- if any of the mandatory inputs are invalid/null
+ or if the initialization of storage fails.public MASStorageManager.MASStorageType getType()+
Storage
getType
in class Storage
MASStorageManager.MASStorageType.TYPE_KEYSTORE
private StorageResult writeData(java.lang.String key, + byte[] value, + int option) + throws StorageException+
StorageException
public StorageResult writeData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
writeData
in class Storage
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedStorageException
- if input validation fails.public void writeData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeData
in class Storage
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
writeString
in class Storage
key
- The key against which the data has to be storedvalue
- The String data that need to be storedStorageException
- if input validation fails.public void writeString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeString
in class Storage
key
- The key against which the data has to be storedvalue
- The String data that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult readData(java.lang.String key) + throws StorageException+
Storage
readData
in class Storage
key
- The key for which the data has to be retrievedStorageException
- if input validation fails.public void readData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
readData
in class Storage
key
- The key for which the data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult readString(java.lang.String key) + throws StorageException+
Storage
readString
in class Storage
key
- The key for which the String data has to be retrievedStorageException
- if input validation fails.public void readString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
readString
in class Storage
key
- The key for which the String data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult updateData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
updateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public void updateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
updateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult updateString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
updateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public void updateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
updateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeOrUpdateData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
writeOrUpdateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public void writeOrUpdateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeOrUpdateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeOrUpdateString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
writeOrUpdateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public void writeOrUpdateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeOrUpdateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult deleteData(java.lang.String key) + throws StorageException+
Storage
deleteData
in class Storage
key
- The key for which the data will be deletedStorageException
public StorageResult deleteString(java.lang.String key) + throws StorageException+
deleteString
in class Storage
StorageException
public void deleteData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
deleteData
in class Storage
key
- The key for which the data will be deletedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public void deleteString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
deleteString
in class Storage
StorageException
public StorageResult deleteAll()+
Storage
public void deleteAll(StorageResultReceiver callback) + throws StorageException+
Storage
deleteAll
in class Storage
callback
- Notifies the caller with a StorageResult which is expected to have
+ - status part to be SUCCESS, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult getAllKeys()+
Storage
getAllKeys
in class Storage
public void getAllKeys(StorageResultReceiver callback) + throws StorageException+
Storage
getAllKeys
in class Storage
callback
- send a StorageResult , which is expected to have
+ - a list of all the keys (or an empty list) as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.private void notifyCallback(StorageResultReceiver callback, + StorageResult result)+
private void updateAccountKeyIndex(android.content.Context ctx, + java.lang.String key, + java.lang.String value) + throws java.lang.Exception+
java.lang.Exception
private void writeAccountData(android.content.Context ctx, + java.lang.String encodedKey, + java.lang.String value) + throws java.lang.Exception+
java.lang.Exception
private java.lang.String readAccountData(android.content.Context ctx, + java.lang.String key) + throws java.lang.Exception+
java.lang.Exception
private void validateInputs(java.lang.String key, + java.lang.String value) + throws StorageException+
key
- the key to put in the storevalue
- the value corresponding to the key to be put in the storeStorageException
private void validateInputs(java.lang.String key, + byte[] value) + throws StorageException+
key
- the key to put in the storevalue
- the value corresponding to the key to be put in the storeStorageException
public final class KeyStoreStorage +extends Storage+
Modifier and Type | +Field and Description | +
---|---|
private KeyStore |
+ks
+The L7 KeyStore utility instance.
+ |
+
private static int |
+MAX_DATA_SIZE
+MAX size of data, in bytes, that can be written in to this storage.
+ |
+
private static int |
+MAX_KEY_SIZE
+MAX size of the Key, in characters, that can be written in to this storage.
+ |
+
private java.lang.String |
+prefix
+Key Prefix.
+ |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+KeyStoreStorage(java.lang.Object options)
+Initialize the storage.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
private void |
+checkForError(boolean success) |
+
StorageResult |
+deleteAll()
+Deletes all entries from the storage.
+ |
+
void |
+deleteAll(StorageResultReceiver callback)
+Deletes all entries from the storage.
+ |
+
StorageResult |
+deleteData(java.lang.String key)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
void |
+deleteData(java.lang.String key,
+ StorageResultReceiver callback)
+Deletes an entry, essentially a key-value pair, from the storage.
+ |
+
StorageResult |
+deleteString(java.lang.String key) |
+
void |
+deleteString(java.lang.String key,
+ StorageResultReceiver callback) |
+
StorageResult |
+getAllKeys()
+Fetch all the keys against which data are stored.
+ |
+
void |
+getAllKeys(StorageResultReceiver callback)
+Fetch all the keys against which data are stored.
+ |
+
MASStorageManager.MASStorageType |
+getType()
+Gets the type of storage.
+ |
+
private boolean |
+isReady(StorageResult result) |
+
private void |
+notifyCallback(StorageResultReceiver callback,
+ StorageResult result) |
+
private java.lang.String |
+rcToStr(int rc) |
+
StorageResult |
+readData(java.lang.String key)
+Fetches generic data from the Store.
+ |
+
void |
+readData(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches generic data from the Store.
+ |
+
StorageResult |
+readString(java.lang.String key)
+Fetches String data from the Store.
+ |
+
void |
+readString(java.lang.String key,
+ StorageResultReceiver callback)
+Fetches String from the Store.
+ |
+
private java.lang.String |
+sanitizeKey(java.lang.String key)
+Adds the prefix to the key.
+ |
+
StorageResult |
+updateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+updateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+updateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new String.
+ |
+
void |
+updateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new String.
+ |
+
private void |
+validateInputs(java.lang.String key,
+ byte[] value) |
+
private void |
+validateInputs(java.lang.String key,
+ java.lang.String value) |
+
StorageResult |
+writeData(java.lang.String key,
+ byte[] value)
+Writes some generic data to the Storage.
+ |
+
void |
+writeData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Writes some generic data to the Storage.
+ |
+
StorageResult |
+writeOrUpdateData(java.lang.String key,
+ byte[] value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+writeOrUpdateData(java.lang.String key,
+ byte[] value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value)
+Updates a pre-existing data with a new one.
+ |
+
void |
+writeOrUpdateString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Updates a pre-existing data with a new one.
+ |
+
StorageResult |
+writeString(java.lang.String key,
+ java.lang.String value)
+Writes String data to the Storage.
+ |
+
void |
+writeString(java.lang.String key,
+ java.lang.String value,
+ StorageResultReceiver callback)
+Writes String data to the Storage.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private KeyStore ks+
private java.lang.String prefix+
private static int MAX_KEY_SIZE+
private static final int MAX_DATA_SIZE+
protected KeyStoreStorage(java.lang.Object options) + throws StorageException+
options
- Object[] with 2 elements
+ 1) An android.content.Context
+ 2) (optional) Boolean value indicating whether the storage is Shared or notStorageException
- if initialization of storage fails.public MASStorageManager.MASStorageType getType()+
Storage
getType
in class Storage
MASStorageManager.MASStorageType.TYPE_KEYSTORE
public StorageResult writeData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
writeData
in class Storage
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedStorageException
- if input validation fails.public void writeData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeData
in class Storage
key
- The key against which the data has to be storedvalue
- The generic data that needs to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
writeString
in class Storage
key
- The key against which the data has to be storedvalue
- The String data that need to be storedStorageException
- if input validation fails.public void writeString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeString
in class Storage
key
- The key against which the data has to be storedvalue
- The String data that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult readData(java.lang.String key) + throws StorageException+
Storage
readData
in class Storage
key
- The key for which the data has to be retrievedStorageException
- if input validation fails.public void readData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
readData
in class Storage
key
- The key for which the data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult readString(java.lang.String key) + throws StorageException+
Storage
readString
in class Storage
key
- The key for which the String data has to be retrievedStorageException
- if input validation fails.public void readString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
readString
in class Storage
key
- The key for which the String data has to be retrievedcallback
- send a StorageResult, which is expected to have
+ - the requested data as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult updateData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
updateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public void updateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
updateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult updateString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
updateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public void updateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
updateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeOrUpdateData(java.lang.String key, + byte[] value) + throws StorageException+
Storage
writeOrUpdateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedStorageException
public void writeOrUpdateData(java.lang.String key, + byte[] value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeOrUpdateData
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult writeOrUpdateString(java.lang.String key, + java.lang.String value) + throws StorageException+
Storage
writeOrUpdateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedStorageException
public void writeOrUpdateString(java.lang.String key, + java.lang.String value, + StorageResultReceiver callback) + throws StorageException+
Storage
writeOrUpdateString
in class Storage
key
- The key for which the data has to be retrievedvalue
- The new String data, that need to be storedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult deleteData(java.lang.String key) + throws StorageException+
Storage
deleteData
in class Storage
key
- The key for which the data will be deletedStorageException
public StorageResult deleteString(java.lang.String key) + throws StorageException+
deleteString
in class Storage
StorageException
public void deleteData(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
Storage
deleteData
in class Storage
key
- The key for which the data will be deletedcallback
- Notifies the caller with a StorageResult which is expected to have
+ - the key as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public void deleteString(java.lang.String key, + StorageResultReceiver callback) + throws StorageException+
deleteString
in class Storage
StorageException
public StorageResult deleteAll()+
Storage
public void deleteAll(StorageResultReceiver callback) + throws StorageException+
Storage
deleteAll
in class Storage
callback
- Notifies the caller with a StorageResult which is expected to have
+ - status part to be SUCCESS, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.public StorageResult getAllKeys()+
Storage
getAllKeys
in class Storage
public void getAllKeys(StorageResultReceiver callback) + throws StorageException+
Storage
getAllKeys
in class Storage
callback
- send a StorageResult , which is expected to have
+ - a list of all the keys (or an empty list) as the data part, if the operation is a SUCCESS
+ - StorageException as the data part, if the operation is a FAILUREStorageException
- if input validation fails.private java.lang.String sanitizeKey(java.lang.String key)+
key
- Key to sanitize.private void validateInputs(java.lang.String key, + byte[] value) + throws StorageException+
StorageException
private void validateInputs(java.lang.String key, + java.lang.String value) + throws StorageException+
StorageException
private void notifyCallback(StorageResultReceiver callback, + StorageResult result)+
private void checkForError(boolean success) + throws StorageException+
StorageException
private java.lang.String rcToStr(int rc)+
private boolean isReady(StorageResult result)+