This API documentation is for Ballerina 1.2.0. View API documentation for the latest release.

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.

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<anydata> data)

returns string | Error | ()

Inspects the incoming data and generates the token for Basic authentication.

Parameters

  • data map<anydata>
  • 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