authorjapps / authorjapps/zerocode
JWT token decode
- 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
Assessment
This issue has not been assessed yet.