Object - auth : OutboundBasicAuthProvider

Represents the outbound Basic Auth authenticator, which is an implementation of the auth:OutboundAuthProvider interface. This uses the usernames and passwords provided by the Ballerina configurations to authenticate external endpoints.

  auth:OutboundBasicAuthProvider outboundBasicAuthProvider = new({
      username: "tom",
      password: "123"
  });

Constructor

__init

(Credential? credential)

  • credential Credential? ()
  • Credential configurations

Methods

Generates a token for Basic authentication.
 string|auth:Error token = outboundBasicAuthProvider.generateToken();
Inspects the incoming data and generates the token for Basic authentication.

Fields

  • credential Credential?
  • auth:Credential configurations

generateToken

()

returns string | Error
Generates a token for Basic authentication.
 string|auth:Error token = outboundBasicAuthProvider.generateToken();
  • Return Type

    (string | Error)
  • The generated token or else an auth:Error occurred during the validation

inspect

(map data)

returns string | Error | ()
Inspects the incoming data and generates the token for Basic authentication.

Parameters

  • data map
  • Map of the data, which is extracted from the HTTP response.

  • Return Type

    (string | Error | ())
  • The token as a string, an auth:Error occurred when generating the token, or else () if nothing is to be returned