Functions
-
auth
| checkForScopeMatch |
I
Checks whether the scopes of the user match the scopes of the resource. |
| extractUsernameAndPassword |
I
Extracts the username and the password from the base64-encoded |
| getInvocationContext |
I
Returns the |
| setInvocationContext |
I
Sets the authentication-related values to the invocation context. |
checkForScopeMatch
(string[] | string[][] resourceScopes, string[] userScopes, string authzCacheKey, Cache? positiveAuthzCache, Cache? negativeAuthzCache)
returns booleanChecks whether the scopes of the user match the scopes of the resource.
Parameters
- resourceScopes string[] | string[][]
-
Scopes of the resource
- userScopes string[]
-
Scopes of the user
- authzCacheKey string
-
Authorization cache key
- positiveAuthzCache Cache?
-
The
cache:Cachefor positive authorizations
- negativeAuthzCache Cache?
-
The
cache:Cachefor negative authorizations
-
Return Type
(boolean) trueif there is a match between the resource and user scopes or elsefalseotherwise
Extracts the username and the password from the base64-encoded username:password value.
[string, string]|auth:Error [username, password] = auth:extractUsernameAndPassword("<credential>");
Parameters
- credential string
-
Base64-encoded
username:passwordvalue
-
Return Type
([string, string] | Error) A
stringtuple with the extracted username and password or else anauth:Erroroccurred while extracting credentials
Returns the auth:InvocationContext instance.
auth:InvocationContext invocationContext = auth:getInvocationContext();
-
Return Type
(InvocationContext) The
auth:InvocationContextinstance
setInvocationContext
(string? scheme, string? token, string? userId, string[]? scopes, map<any> claims)
Sets the authentication-related values to the invocation context.
auth:setInvocationContext("jwt", "<credential>", "<userID>", <scopes>, <claims>);
Parameters
- scheme string? (default ())
-
Auth scheme (
JWT,LDAP,OAuth2,Basic, etc.)
- token string? (default ())
-
Auth token (credential)
- userId string? (default ())
-
User ID of the authenticated user
- scopes string[]? (default ())
-
Authenticated user scopes
- claims map<any> (default ())
-
Claims of the authenticated user