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

Module : jwt

Module Overview

This module provides an inbound and outbound JWT authentication provider, which can be used to authenticate using a JWT and the functionality related to issuing and validating JWT.

For information on the operations, which you can perform with this module, see the below Functions. For examples on the usage of the operations, see the following.

Records

Detail

Record type to hold the details of an error.

InboundJwtCacheEntry Deprecated Represents an entry of JWT cache.
JwksConfig

Represents the JWKs endpoint configurations.

JwtHeader

Represents JWT header.

JwtIssuerConfig

Represents JWT validator configurations.

JwtKeyStoreConfig

Represents JWT key store configurations.

JwtPayload

Represents JWT payload.

JwtTrustStoreConfig

Represents JWT trust store configurations.

JwtValidatorConfig

Represents JWT validator configurations.

Objects

InboundJwtAuthProvider

Represents the inbound JWT auth provider, which authenticates by validating a JWT.

OutboundJwtAuthProvider

Represents the outbound JWT auth provider, which is used to authenticate with an external endpoint by generating a JWT.

Functions

buildHeaderString

Builds the header string from the jwt:JwtHeader record.

buildPayloadString

Builds the payload string from the jwt:JwtPayload record.

decodeJwt

Decodes the given JWT string.

issueJwt

Issues a JWT based on the provided header and payload.

validateJwt

Validates the given JWT string.

Constants

RS256

The RSA-SHA256 algorithm

RS384

The RSA-SHA384 algorithm

RS512

The RSA-SHA512 algorithm

NONE

Unsecured JWTs (no signing)

JWT_ERROR

Represents the reason of the JWT error.

Types

JwtSigningAlgorithm

The key algorithms supported by crypto module.

Errors

Error

Represents the JWT error type with details.