authorjapps / authorjapps/zerocode

JWT token decode

Open
#351 4 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
Java
Stars
1k
Forks
453
Avg merge
7d 2h
Merged PRs (30d)
5

Description

Hi there !

Is there any way to decode jwt token and check for a specific value. I am using a custom step method to decode and check by part of the string. It would be much easier to do it with framework if there is a possibility.
```json
{
"scenarioName": "Keycloak login - get role",
"steps": [
{
"name": "jwt",
"url": "${urlKeycloakLogin}",
"operation": "POST",
"request": {
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"body": {
"username": "${username}",
"password": "${password}",
"grant_type": "${grantType}",
"client_id": "${clientId}",
"client_secret": "${clientSecret}"
}
},
"assertions": {
"status": 200,
"headers": {
"Content-Type": [ "application/json" ]
},
"body": {
"access_token": "$NOT.NULL"
}
}
},
{
"name": "decode_jwt",
"url": "keycloak_login.Auxiliary",
"operation": "DecodeJWT",
"request": "${$.jwt.response.body.access_token}",
"assertions": "$CONTAINS.STRING:\"resource_access\":{\"roles\":[\"Admin\"]}"
}
]
}
```

Best

ab

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.