Functions - auth

extractUsernameAndPassword

Extracts the username and password from the credential values.

prepareError

Log and prepare error as a Error.

setAuthenticationContext

Set the authentication context values to invocation context.

setPrincipal

Set the principal values to invocation context.

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

prepareError

(string message, error? err)

returns Error

Log and prepare error as a Error.

Parameters

  • message string
  • Error message

  • err error? - ()
  • error instance

  • Return Type

    (Error)
  • Prepared Error instance

setAuthenticationContext

Set the authentication context values to invocation context.

Parameters

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

  • authToken string
  • Auth token (credential)

setPrincipal

Set the principal values to invocation context.

Parameters

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

  • username string? - ()
  • Username of the authenticated user.

  • scopes string[]? - ()
  • Authenticated user scopes.

  • claims map? - ()
  • Claims of the authenticated user.