Availability: Release 6.0
JSON Web Tokens (JWTs) are a way to securely transmit information between parties, especially in web applications. They are commonly used for authentication (proving that you are who you say you are) and authorization (allowing you to access certain resources or perform certain actions).
JWTs are often sent in an HTTP header or as a URL parameter. When a user logs in to a web application, the server generates a JWT and sends it back to the client (usually a web browser). The client can then use the JWT to authenticate subsequent requests to the server. The server can also use information in the JWT to authorize the user to perform certain actions.
A JWT consists of three parts: a header, a payload, and a signature. The header identifies the type of token and the algorithm used to create the signature. The payload contains claims about the user or other information, such as their name or email address. The signature is used to verify that the sender of the JWT is who they say they are and to make sure the message hasn't been changed along the way.
ACCELQ provides support for building automation test logic involving JSON Web Tokens (JWT). You can generate tokens with various configurations to suit your testing needs. ACCELQ offers a range of options to generate these tokens, which can be particularly useful for testing server authentication.
Create JWT Token
This command creates a new JWT (JSON Web Token) with the given header and payload. You can also specify an expiration date/time for the token or sign it with a secret key if needed.
header |
The header of the JWT, in JSON format. |
If you choose to use an auto-generated key for signing, you can retrieve the generated keys by using the "Get Key used for JWT Token" command.
Get Key used for JWT Token
This command allows you to retrieve the key used for signing a JWT token. This can be useful in cases where you need to verify the authenticity of the token, or if you want to know which key was used to sign it.
key type |
The type of key to return. It can be one of the following values: |
Example
The following logic generates a JWT token with some custom headers and payload. Further the token is set to expire at a certain date and is signed with a private key. The next step retrieves the key used for signing the token. This is useful in certain places.
Comments
0 comments
Please sign in to leave a comment.