new OAuth2RBAC()
Functional interface that allows users to implement custom RBAC verifiers for OAuth2/OpenId Connect.
Users are to implement the
isAuthorized method to verify authorities. For provides that do not
export the permissions/roles in the token, this interface allows you to communicate with 3rd party services
such as graph APIs to collect the required data.
The contract is that once an authority is checked for a given user, it's value is cached during the execution
of the request. If a user is stored to a persistent storage, or the token is introspected, the cache is cleared
and a new call will be handled to the implementation.
Methods
isAuthorized(user, authority, handler)
This method should verify if the user has the given authority and return either a boolean value or an error.
Note that false and errors are not the same. A user might not have a given authority but that doesn't mean that
there was an error during the call.
Parameters:
| Name | Type | Description |
|---|---|---|
user |
AccessToken | the given user to assert on |
authority |
string | the authority to lookup |
handler |
function | the result handler. |