Class: ListenerJwtAuthProvider

Isolated

Represents the listener JWT Auth provider, which is used to authenticate the provided credentials (JWT) against the provided JWT validator configurations.

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 the provided JWT.

authenticate

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

Authenticates the provided JWT.

1boolean result = check provider.authenticate("<credential>");

Parameters

  • credential string
  • JWT to be authenticated

Return Type

(Payload | Error)

jwt:Payload if authentication is successful or else a jwt:Error if an error occurred