new AuthService()
Vert.x authentication and authorisation service.
Handles authentication and role/permission based authorisation.
- Source:
Methods
-
hasPermission(loginID, permission, resultHandler) → {AuthService}
-
Does the user have the specified permission?
Parameters:
Name Type Description loginID
string the login ID as provided by #login. permission
string the permission resultHandler
function will be called with the result - true if has permission, false if not - Source:
Returns:
- Type
- AuthService
-
hasPermissions(loginID, permissions, resultHandler) → {AuthService}
-
Does the user have the specified permissions?
Parameters:
Name Type Description loginID
string the login ID as provided by #login. permissions
Array.<string> the set of permissions resultHandler
function will be called with the result - true if has permissions, false if not - Source:
Returns:
- Type
- AuthService
-
hasRole(loginID, role, resultHandler) → {AuthService}
-
Does the user have the specified role?
Parameters:
Name Type Description loginID
string the login ID as provided by #login. role
string the role resultHandler
function will be called with the result - true if has role, false if not - Source:
Returns:
- Type
- AuthService
-
hasRoles(loginID, roles, resultHandler) → {AuthService}
-
Does the user have the specified roles?
Parameters:
Name Type Description loginID
string the login ID as provided by #login. roles
Array.<string> the set of roles resultHandler
function will be called with the result - true if has roles, false if not - Source:
Returns:
- Type
- AuthService
-
login(principal, credentials, resultHandler) → {AuthService}
-
Authenticate (login) using the specified credentials. The contents of the credentials depend on what the auth provider is expecting. The default login ID timeout will be used.
Parameters:
Name Type Description principal
Object represents the unique id (e.g. username) of the user being logged in credentials
Object the credentials - e.g. password resultHandler
function will be passed a failed result if login failed or will be passed a succeeded result containing the login ID (a string) if login was successful. - Source:
Returns:
- Type
- AuthService
-
loginWithTimeout(principal, credentials, timeout, resultHandler) → {AuthService}
-
Authenticate (login) using the specified credentials. The contents of the credentials depend on what the auth provider is expecting. The specified login ID timeout will be used.
Parameters:
Name Type Description principal
Object represents the unique id (e.g. username) of the user being logged in credentials
Object the credentials timeout
number the login timeout to use, in ms resultHandler
function will be passed a failed result if login failed or will be passed a succeeded result containing the login ID (a string) if login was successful. - Source:
Returns:
- Type
- AuthService
-
logout(loginID, resultHandler) → {AuthService}
-
Logout the user
Parameters:
Name Type Description loginID
string the login ID as provided by #login. resultHandler
function will be called with success or failure - Source:
Returns:
- Type
- AuthService
-
refreshLoginSession(loginID, resultHandler) → {AuthService}
-
Refresh an existing login ID so it doesn't expire
Parameters:
Name Type Description loginID
string the login ID as provided by #login. resultHandler
function will be called with success or failure - Source:
Returns:
- Type
- AuthService
-
setReaperPeriod(reaperPeriod) → {AuthService}
-
Set the reaper period - how often to check for expired logins, in ms.
Parameters:
Name Type Description reaperPeriod
number the reaper period, in ms - Source:
Returns:
- Type
- AuthService
-
start()
-
Start the service
- Source:
-
stop()
-
Stop the service
- Source: