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: "/path/to/keystore.p12",
password: "ballerina"
}
}
});
Constructor
__init
(JwtIssuerConfig? jwtIssuerConfig)
- jwtIssuerConfig JwtIssuerConfig? ()
-
JWT issuer configurations
Methods
Fields
- jwtIssuerConfig JwtIssuerConfig?
-
JWT issuer configurations
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
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 anauth:Error
if token can't be generated