Class: ListenerJwtAuthProvider

Represents the listener JWT Auth provider, which authenticates by validating a JWT.

1jwt:ListenerJwtAuthProvider provider = new({
2 issuer: "example",
3 audience: "ballerina",
4 signatureConfig: {
5 certificateAlias: "ballerina",
6 trustStore: {
7 path: "/path/to/truststore.p12",
8 password: "ballerina"
9 }
10 }
11});

Constructor

Provides authentication based on the provided JWT.

init (ValidatorConfig validatorConfig)

Methods

authenticate

Authenticates provided JWT against jwt:ValidatorConfig.

authenticate

function authenticate(string credential) returns Payload | Error
Isolated Function

Authenticates provided JWT against jwt:ValidatorConfig.

1boolean|auth:Error result = provider.authenticate("<credential>");

Parameters

  • credential string
  • JWT to be authenticated

Return Type

(Payload | Error)

jwt:Payload if authentication is successful or else an auth:Error if JWT validation failed