Functions
-
auth
checkForScopeMatch |
Checks whether the scopes of the user match the scopes of the resource. |
extractUsernameAndPassword |
Extracts the username and the password from the base64-encoded |
getInvocationContext |
Returns the |
setInvocationContext |
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:Cache
for positive authorizations
- negativeAuthzCache Cache?
-
The
cache:Cache
for negative authorizations
-
Return Type
(boolean) true
if there is a match between the resource and user scopes or elsefalse
otherwise
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:password
value
-
Return Type
([string, string] | Error) A
string
tuple with the extracted username and password or else anauth:Error
occurred while extracting credentials
Returns the auth:InvocationContext
instance.
auth:InvocationContext invocationContext = auth:getInvocationContext();
-
Return Type
(InvocationContext) The
auth:InvocationContext
instance
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 <string?> ())
-
Auth scheme (
JWT
,LDAP
,OAuth2
,Basic
, etc.)
- token string? (default <string?> ())
-
Auth token (credential)
- userId string? (default <string?> ())
-
User ID of the authenticated user
- scopes string[]? (default <string[]?> ())
-
Authenticated user scopes
- claims map<any> (default <map?> ())
-
Claims of the authenticated user