Class: MASPluginUser

MASPluginUser

The main class representing the User Lifecycle Management like login,logout etc.
MASUser Singleton instance
MASPlugin.MASUser.currentUser(successHandler(theUser),errorHandler(error));//theUser is the singleton here

Members

active :boolean

Checks if the user is active
Type:
  • boolean
Source:

addresses :array

List of the addresses of the user
Type:
  • array
Source:

emailAddresses :array

List of the email addresses of the user
Type:
  • array
Source:

familyName :string

The family name of the user
Type:
  • string
Source:

formattedName :string

The formatted name of the user
Type:
  • string
Source:

givenName :string

The given name of the user
Type:
  • string
Source:

groups :array

List of the groups the user is a part of
Type:
  • array
Source:

phoneNumbers :array

List of the phone numbers of the user
Type:
  • array
Source:

photos :string

Returns the base64 string of the user's photo
Type:
  • string
Source:

userName :string

The username of the user
Type:
  • string
Source:

Methods

(static) currentUser(successHandler, errorHandler)

The authenticated user for the application, if any. Returns null if no authenticated user found.. This is a singleton object. Developers should call this API first in order to use the instance attributes or functionsof the MASUser object.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:
Example

For instance, to access the username field of the logged in user (and to see if the session is locked) you must call this API as follows

MASPluginUser.currentUser(
	function(result) {
		// Get username of the user
		var username = result.userName;
		// Get Session Locked state
		result.isSessionLocked(
			function(success){
				var isSessionLocked = success;
			},function(error){});

	},function(error) {}
);

(static) initializeBrowserBasedAuthentication(successHandler, errorHandler)

Authenticates a user by launching a Browser which in turn loads a URL (templatized). The URL needed is retrieved from the server endpoint mentioned in the configuration file.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

(static) loginWithAuthCode(successHandler, errorHandler, authCode, state)

Authenticates a user asynchronously using an authorization code and a state(optional) variable
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
authCode string The Authorization code as received from an OAuth server.
state string A state variable for supporting the PKCE validation.
Source:

(static) loginWithAuthCredentialsAuthCode(successHandler, errorHandler, authorizationCode, state)

Authenticates a user asynchronously using the MAS native AuthCredential construct containing an authorization code and a state(optional) variable
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
authorizationCode string The Authorization code as received from an OAuth server.
state string A state variable for supporting the PKCE validation.
Source:

(static) loginWithAuthCredentialsJWT(successHandler, errorHandler, jwt, tokenType)

Authenticates a user asynchronously using the MAS native AuthCredential construct containing a JWT(id_token) and a token type
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
jwt string The id_token for the user. Ensure that the id_token is a valid JWT
tokenType string Token type of id_token.
Example
{`urn:ietf:params:oauth:grant-type:jwt-bearer`}
Source:

(static) loginWithAuthCredentialsUsernamePassword(successHandler, errorHandler, userName, password)

Authenticates the user asynchronously using the MAS native AuthCredential construct that contains username and password.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
userName string username of the user
password string password of the user
Source:

(static) loginWithIdTokenAndTokenType(successHandler, errorHandler, idToken, tokenType)

Authenticates a user asynchronously using and id_token
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
idToken string The id_token for the user. Ensure that the id_token is a valid JWT
tokenType string Token type of id_token.
Example
{`urn:ietf:params:oauth:grant-type:jwt-bearer`}
Source:

(static) loginWithUsernameAndPassword(successHandler, errorHandler, userName, password)

Authenticates the user asynchronously using the username and password.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
userName string username of the user
password string password of the user
Source:

getAccessToken(successHandler, errorHandler)

String accessToken value of the current logged in user.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

isAuthenticated(successHandler, errorHandler)

Boolean indicator that specifies whether the MASPluginUser object is authenticated
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

isCurrentUser(successHandler, errorHandler)

Boolean indicator that specifies whether the MASPluginUser object is the current user.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

isSessionLocked(successHandler, errorHandler)

Boolean indicator that specifies whether the currently authenticated MASPluginUser object has the session locked.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

listAttributes(successHandler, errorHandler)

Lists all the attributes of the Current logged in user. The attributes are in the form of a JSON with key:value pairs.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

lockSession(successHandler, errorHandler)

Locks the current session of the user. The user must log in to use this API.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

logout(successHandler, errorHandler, force)

Logs off the user from this app (In case of SSO the user is logged off from other apps too).
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
force boolean The behavior for different values of force would be
ValueDescription
trueThe SDK clears local tokens regardless if the logout call to the server is successful or not.
falseThe SDK clears local tokens only if the logout call to the server is successful.
If no value is provided, then the default value `false` is used. This is for backward compatibility with old logout signature.
Source:

removeSessionLock(successHandler, errorHandler)

Removes the session lock for the user. Remove session causes all the stored tokens in the device to be wiped-out. The user must log in to use this API.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

unlockSession(successHandler, errorHandler)

Unlocks the current session of the user. The user must log in to use this API.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
Source:

unlockSessionWithMessage(successHandler, errorHandler, message)

Unlocks the current session of the user with a customizable message while unlocking. The user must log in to use this API.
Parameters:
Name Type Description
successHandler successCallbackFunction user defined success callback that is invoked on success scenario.
errorHandler errorCallbackFunction user defined error callback that is invoked on failure scenario.
message string A user defined message that is displyed on the lock screen before asking for PIN/Fingerprint.
Source: