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

Object - auth : OutboundAuthProvider

Represents the outbound Auth provider, which could be used to authenticate external endpoints. Any type of implementation such as JWT, OAuth2, LDAP, JDBC, file-based etc. should be object-wise similar to the auth:OutboundAuthProvider object.

Methods

Generates an authentication token for the outbound request with outbound Auth providers such as JWT and OAuth2.

Inspects the incoming data and generates the authentication token as needed.

generateToken

()

returns string | Error

Generates an authentication token for the outbound request with outbound Auth providers such as JWT and OAuth2.

  • Return Type

    (string | Error)
  • The token as a string or else an auth:Error occurred when generating the token

inspect

(map<anydata> data)

returns string | Error | ()

Inspects the incoming data and generates the authentication token as needed. For example, if the incoming data indicates that it needs to regenerate the token because the previously-generated token is invalid, this method will generate it.

Parameters

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