Object - jwt : InboundJwtAuthProvider

Represents the inbound JWT auth provider, which authenticates by validating a JWT. The jwt:InboundJwtAuthProvider is another implementation of the auth:InboundAuthProvider interface.

 jwt:InboundJwtAuthProvider inboundJwtAuthProvider = new({
     issuer: "example",
     audience: "ballerina",
     trustStoreConfig: {
         certificateAlias: "ballerina",
         trustStore: {
             path: "${ballerina.home}/bre/security/ballerinaTruststore.p12",
             password: "ballerina"
         }
     }
 });

Constructor

__init

(JwtValidatorConfig jwtValidatorConfig)

Methods

Authenticates provided JWT against jwt:JwtValidatorConfig.
 boolean|auth:Error result = inboundJwtAuthProvider.authenticate("<credential>");

Fields

authenticate

(string credential)

returns boolean | Error
Authenticates provided JWT against jwt:JwtValidatorConfig.
 boolean|auth:Error result = inboundJwtAuthProvider.authenticate("<credential>");

Parameters

  • credential string
  • JWT to be authenticated

  • Return Type

    (boolean | Error)
  • true if authentication is successful, false otherwise or else an auth:Error if JWT validation failed