Skip to content

uib/gravitee-policy-generate-jwt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate JWT policy

Gravitee.io License Releases CircleCI Join the community forum

Phase

onRequest onResponse onRequestContent onResponseContent

X

-

-

-

Description

You use the generate-JWT policy to generate a signed JWT with a configurable set of claims. This JWT can subsequently be forwarded to backend targets, or used in some other way.

When a signed JWT is generated, it is put in the jwt.generated attribute of the request execution context.

Configuration

Property Required Description Type Default

signature

X

Signature used to sign the token

Algorithm

RS256

kid

-

key ID (kid) to include in the JWT header

string

-

id

-

JWT ID (jti) claim is a unique identifier for the JWT

string

UUID

audiences

-

JWT audience claim; can be a string or an array of strings

List of string

-

issuer

-

Claim that identifies the issuer of the JWT

string

-

subject

-

Claim that identifies or makes a statement about the subject of the JWT

string

-

Attributes

Name Description

jwt.generated

JWT generated by the policy

You can read the token using Expression Language:

{#context.attributes['jwt.generated']}

Examples

"policy-generate-jwt": {
    "signature":"RSA_RS256",
    "expiresIn":30,
    "expiresInUnit":"SECONDS",
    "issuer":"urn://gravitee-api-gw",
    "audiences":["graviteeam"],
    "customClaims":[],
    "id":"817c6cfa-6ae6-446e-a631-5ded215b404b",
    "content":"-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDg0MY5LcTnpM/N\nd9ohW/mls6CqF3PoVocwUpKSb324QFuSGvo5s2qzM1JkR2uNTS5lapGltF0Krc5j\nmUgKqVZUx3ie76ngvHTVrz9qNHe9znsTFndtpsaFZuNIiGT8X+eAYgqKUaoKA+3y\nNWynEmXL9ywtFtGommPO1iBwMYfbucuxBmwtklkzxCrFGftAsTJANy8T+CV61TpB\nP2LbFVngfT0uDgjfoG/KMSBUZR88YZNvEyj1mEDPvZPZD6vYUBlTMlWgAwAD+pUn\n6b/a1BsZ69mMvMzvOg9NhuwMLwGDwQ45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MdCo8LwCvuMeGEC1uGYEybsEeyiW8AQKBgBnkExWeD6KQQL9rrImq\nwhPqz9yuMpIsBtf93fDLXwmy/0VG9L6uDf/3MKl+RYs4PQGe+QQSmXTgqcbHr5ug\nNEFDDK0C9k0Gd0Zl/Z29H6vZWJH9E4ur/xZToeADc3sQT/Ga78LwF8s5EtOPuGVD\nOyCUoLQJgofJWKk2Tp5gKogB\n-----END PRIVATE KEY-----"
}

Errors

HTTP status code

Code Message

500

Unexpected error while creating and signing the token

About

Gravitee Policy - Generate JWT

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%