JSON Web Token (JWT)¶
Note
This feature is not yet implemented
For authorization, TIRA uses a “Bearer Token” (RFC 6750), which can simply be thought of as a string.
The content of this string is dictated by the specific token type that is used. In our case: “JSON Web Token” (“JWT”; RFC 7519). A JWT consists off three parts: A header, payload and signature. The header simply states “this is a JWT”
while the payload presents “claims”. This can be, for example “My Username is: …” (in JSON this could be, for example, 'username': '...'
) or even “I have access to resource …”. The advantage with JWT is that the API does not need to check with the authorization or authentication server to request this information as seen in the following example:
Here, TIRA does not need to fetch the user information (located at /user
) from the authentication provider since it is stored within the JWT token already. TIRA only needs to verify the signature of the JWT token to ensure it is genuine.
Example¶
Request to
/user
without a bearer tokenGET /user HTTP/2 Host: http://example.org/ Accept: */*
Response:
401 Unauthorized
Authentication request to authentication provider
User authenticates at the authentication provider
Authentication response:
200 OK
with a JWTRequest to
/user
with the new token
Storing JWT¶
Revocation and Expiration¶
Access and Refresh Token
exp field