Functions - auth

checkForScopeMatch

Check whether the scopes of the user and scopes of resource matches.

extractUsernameAndPassword

Extracts the username and password from the credential values.

setAuthenticationContext

Set the authentication related values (scheme, auth token) to the authentication context of the invocation context.

setPrincipal

Set the authentication related values (user id, username, scopes, claims) to the principal of the invocation context.

checkForScopeMatch

(string | string resourceScopes, string userScopes, string authzCacheKey, Cache? positiveAuthzCache, Cache? negativeAuthzCache)

returns boolean

Check whether the scopes of the user and scopes of resource matches.

Parameters

  • resourceScopes string | string
  • Scopes of resource

  • userScopes string
  • Scopes of user

  • authzCacheKey string
  • Authorization cache key

  • positiveAuthzCache Cache?
  • The cache for positive authorizations

  • negativeAuthzCache Cache?
  • The cache for negative authorizations

  • Return Type

    (boolean)
  • true if there is a match between resource and user scopes, else false

extractUsernameAndPassword

(string credential)

returns [string, string] | Error

Extracts the username and password from the credential values.

Parameters

  • credential string
  • The credential values.

  • Return Type

    ([string, string] | Error)
  • A string tuple with the extracted username and password or Error occurred while extracting credentials

setAuthenticationContext

Set the authentication related values (scheme, auth token) to the authentication context of the invocation context.

Parameters

  • scheme string
  • Auth scheme (JWT, LDAP, OAuth2, Basic etc.)

  • authToken string
  • Auth token (credential)

setPrincipal

Set the authentication related values (user id, username, scopes, claims) to the principal of the invocation context.

Parameters

  • userId string (default ())
  • User Id of the authenticated user.

  • username string (default ())
  • Username of the authenticated user.

  • scopes string (default ())
  • Authenticated user scopes.

  • claims map (default ())
  • Claims of the authenticated user.