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

Provides authentication based on the provided Basic Auth configurations.



__init

(Credential? credential)

  • credential Credential? <ballerina/auth:1.0.0:Credential?> ()
  • Credential configurations

Methods

Generates a token for Basic authentication.

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

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