The Security Manager interface contains functions to logon and logoff users.
You can authenticate a user using the system.securitymanager.logon()
function that takes two parameters:
webServiceName
- specifies which System Logon Service to use.
inParameters
- an array of arrays containing up to three pairs of parameters. For example:
[["Script", fields.email.value], ["Script", fields.password.value]]
Each pair contains two strings corresponding to the parameter's source and value. The source can be used to distinguish the origin of the authentication request.
The source and value of the first array item are mapped to PARAM1_SOURCE and PARAM1_VALUE respectively. The source and value of the second and third array items also have corresponding fields.
Should the logon fail for any reason, a LogonException
is thrown. The LogonException
contains the error code and description returned from the Logon Service.
Further methods are available from the system.securityManager
interface that can be used throughout the user's session:
getUserName()
- returns the value stored in the USERID field for the current user or null
when the user is not logged on.
isUserLoggedOn()
- returns true
when a user is logged on.
logoff()
- logs a user off the system and clears authorizations, credentials and roles from the current session. Future calls to isUserLoggedOn()
return false
.