Salesforce

Concepts of Login and Logout (Magic xpa 4.x)

« Go Back

Information

 
Approval Process StatusPublished
Objective
Description

Concepts of Login and Logout

In any Web application, there is a need to handle user authentication and access control. Basic authentication functionality like login and logout is required in an enterprise web application. Along with authentication, you need to provide the functionality to manage user rights.

The user authentication is done using Magic Logon() function. Magic also has a built-in security system built on user Rights. Once you are logged-in with certain Rights, you can use the Rights() function in any Expression, to perform any necessary logic. Rights can be used as execute right for any Web client program.

Magic xpa now supports the functionality to:

  • Enable you to implement Logout functionality for Web client.

  • Maintain login status - whether the user is logged in or not and expose it to the html via functions (Magic and Angular)

  • Enable you to use the CanActivate guard in Angular for routing when the user is logged-in.

To support the above functionality, Magic xpa has introduced the below functions:

Magic Functions

IsLoggedIn()

This function checks if the user is logged-in or not. This function checks the current session and returns TRUE if the user is logged–in; else it returns FALSE.

Logout()

This function logs-out a user from the current session. This function checks the user within the current session and logs-out the user. Logout function returns TRUE if user is successfully logged-out; else it returns FALSE. The logout function does not close the session but it clears all the rights for the user and returns TRUE on the successful logout.

Angular functions

mg.isLoggedIn()

This client-side Angular function is added to check if the user is logged-in or not. This function checks the current session and returns TRUE if the user is logged-in; else it returns FALSE.

getIsLoggedIn()

This function on the service EngineMagicService is used from all TypeScript (TS) files. You need to inject EngineMagicService to the TS that you want to use, and then you can use this function all over the code.

The function mg.IsLoggedIn can be used from the HTML and the Typescript that belong to a components but you cannot use mg.IsLoggedIn from the TypeScript that does not belong to a component. Hence we added the new function getIsLoggedIn() to enable you to use it in all the TS as needed. As a result, you will have two ways to get the information about the log-in. One from mg.IsLoggedIn() and the other from the service EngineMagicService.getIsLoggedIn().

Reference
TitleConcepts of Login and Logout (Magic xpa 4.x)
URL NameConcepts-of-Login-and-Logout-xpa-4x