Provides a possibility to work with user authentication and login screen.
Methods
# static authRequired()
Authenticates the user based on the saved data in the system.
Therefore before calling this action, you need to save information about the current user with help of {setLoggedInUser} action.
Properties:
Name | Type | Description |
---|---|---|
type |
string | AUTH_REQUIRED |
# static logout()
Calls API to logout the current user and wipes all information about logged in user from Redux store.
Properties:
Name | Type | Description |
---|---|---|
type |
string | LOGOUT |
# static setImageDataUrl(imageDataUrl)
When user loses the session we make the page not accessible and display the modal window to re-authenticate. On top of that we also make the page blurred with help of the image. This action specifically dedicated to define that image.
Parameters:
Name | Type | Description |
---|---|---|
imageDataUrl |
string | The URL to an image which will be layered on top of the whole page |
Properties:
Name | Type | Description |
---|---|---|
type |
string | SET_IMAGE_DATA_URL |
# static setLoggedInUser(username, viewAs, loginProviders)
Saves the information about logged in user.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | the name of currently logged in user. |
viewAs |
object | Represented as {user, roles}, where user is string and roles - array of strings. |
loginProviders |
object | Structure of the object is {isLocalUrl, loginUrl, logoutUrl}. loginUrl - is the link which will be called when user sign in. logoutUrl - is the link which will be called when user sign out. isLocalUrl - specifies if XLD has enabled or disabled SSO. |
Properties:
Name | Type | Description |
---|---|---|
type |
string | SET_LOGGED_IN_USER |
# static setReAuthentication(reAuthentication, reAuthenticationMessage, reAuthenticationDescription)
Notifies the user that the session is lost and requires to reauthenticate. At this case the appropriate modal window is displayed and the main page is blurred, so no actions are allowed and nothing is visible.
Parameters:
Name | Type | Description |
---|---|---|
reAuthentication |
boolean | if true, displays re-authentication modal window |
reAuthenticationMessage |
string | a title of the modal window |
reAuthenticationDescription |
string | a description in the modal window explaining to the user what is happening now. |
Properties:
Name | Type | Description |
---|---|---|
type |
string | SET_RE_AUTHENTICATION |
# static submitCredentials(password, rememberMe, username)
Submits provided credentials of the user for singing in to the system.
Parameters:
Name | Type | Description |
---|---|---|
password |
string | password credential of the user |
rememberMe |
boolean | should the session be saved in rememberMe cookie |
username |
string | login credential of the user |
Properties:
Name | Type | Description |
---|---|---|
type |
string | SUBMIT_CREDENTIALS |