Class: AuthProvider

vertx-auth-js/auth_provider~ AuthProvider

new AuthProvider()

This interface is implemented by auth providers which provide the actual auth functionality - e.g. we have a implementation which uses Apache Shiro.

If you wish to use the auth service with other providers, implement this interface for your provider.

Source:

Methods

hasPermission(principal, permission, resultHandler)

Handle whether a principal has a permission
Parameters:
Name Type Description
principal Object represents the unique id (e.g. username) of the user being logged in
permission string the permission
resultHandler function this must return a failure if the check could not be performed - e.g. the principal is not known. Otherwise it must return a succeeded result which contains a boolean `true` if the principal has the permission, or `false` if they do not have the permission.
Source:

hasRole(principal, role, resultHandler)

Handle whether a principal has a role
Parameters:
Name Type Description
principal Object represents the unique id (e.g. username) of the user being logged in
role string the role
resultHandler function this must return a failure if the check could not be performed - e.g. the principal is not known. Otherwise it must return a succeeded result which contains a boolean `true` if the principal has the role, or `false` if they do not have the role.
Source:

login(principal, credentials, resultHandler)

Handle the actual login
Parameters:
Name Type Description
principal Object represents the unique id (e.g. username) of the user being logged in
credentials Object the credentials - this can contain anything your provider expects, e.g. password
resultHandler function this must return a failed result if login fails and it must return a succeeded result if the login succeeds
Source: