Object - jwt : OutboundJwtAuthProvider

Represents the outbound JWT auth provider, which is used to authenticate with an external endpoint by generating a JWT. The jwt:OutboundJwtAuthProvider is another implementation of the auth:OutboundAuthProvider interface.

 jwt:OutboundJwtAuthProvider jwtAuthProvider = new({
     issuer: "example",
     audience: ["ballerina"],
     keyStoreConfig: {
         keyAlias: "ballerina",
         keyPassword: "ballerina",
         keyStore: {
             path: "${ballerina.home}/bre/security/ballerinaKeystore.p12",
             password: "ballerina"
         }
     }
 });

Constructor

__init

(JwtIssuerConfig? jwtIssuerConfig)

Methods

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

Fields

generateToken

()

returns string | Error
Generates the token for JWT authentication.
 string|auth:Error token = outboundJwtAuthProvider.generateToken();
  • Return Type

    (string | Error)
  • Generated token or else an auth:Error if token can't be generated

inspect

(map data)

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

Parameters

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

  • Return Type

    (string | Error | ())
  • JWT as string, () if nothing to be returned or else an auth:Error if token can't be generated