Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The JSON Web Token(JWT) is simply a JSON string containing claim values. The JWT Bearer grant handler will evaluate and validate the claims in the JWT token, and issue an access token at the Authorization Server end.

...

Table of Contents

The Flow


Image RemovedImage Added

A client can exchange a JWT token to an OAuth 2.0 access token using this grant type.  Once an application is created in on the API Store, keys for the application must be generated. When the keys are generated, there will be a Service Provider created on the WSO2 API Manager.  The service provider is the entity from which entity  is used by the WSO2 API Manager APIM server obtains to obtain information of the application created on the API Store.  There needs to be an Identity Provider configuration corresponding to the IDP created on the WSO2 APIM Server as well. This IDP is who creates and signs the JWT assertion.  This is required so that the server can identify the issuer of the JWT and obtain the public certificate of the IDP, inorder to validate the JWT. 

...

Code Block
languagegroovy
titleSample payload
{  
   "sub":"admin",
   "aud":[  
      "https://localhost:9443/oauth2/token"
   ],
   "nbf":1507546100,
   "iss":"jwtIDP",
   "exp":1507606100,
   "iat":1507546100,
   "jti":"Token56756"
}

The signature is calculated by base64 URL encoding the header and payload and concatenating them with a period as a separator and signing it:

Code Block
Signature = sign(encodeBase64(header) + '.' + encodeBase64(payload))

The signature must then be base64 URL encoded. JWT assertion can be generated by concatenating these three encoded values with a separator dot ".".

Code Block
assertion =  encodeBase64(header) + '.' + encodeBase64(payload) + '.' + encodeBase64(signature)

...