Skip to content

Commit

Permalink
fix(readme): replace scope with code (#754)
Browse files Browse the repository at this point in the history
The scope request parameter is no longer supported.
Follow up from
#712
  • Loading branch information
jenspav authored Oct 11, 2024
1 parent 29e2e45 commit 79b4d80
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ Example:
"tokenExpiry": 120,
"requestMappings": [
{
"requestParam": "scope",
"match": "scope1",
"requestParam": "code",
"match": "code1",
"claims": {
"sub": "subByScope",
"sub": "subByCode",
"aud": [
"audByScope"
"audByCode"
]
}
}
Expand Down Expand Up @@ -328,20 +328,20 @@ The following configuration will set the system time to `2020-01-21T00:00:00Z`:
*From the first JSON example above:*
A token request to `http://localhost:8080/issuer1/token` with parameter `scope` equal to `scope1` will match the first `tokenCallback`:
A token request to `http://localhost:8080/issuer1/token` with parameter `code` equal to `code1` will match the first `tokenCallback`:
```json
{
"issuerId": "issuer1",
"tokenExpiry": 120,
"requestMappings": [
{
"requestParam": "scope",
"match": "scope1",
"requestParam": "code",
"match": "code1",
"claims": {
"sub": "subByScope",
"sub": "subByCode",
"aud": [
"audByScope"
"audByCode"
]
}
}
Expand All @@ -353,8 +353,8 @@ and return a token response containing a token with the following claims:
```json
{
"sub": "subByScope",
"aud": "audByScope",
"sub": "subByCode",
"aud": "audByCode",
"nbf": 1616416942,
"iss": "http://localhost:54905/issuer1",
"exp": 1616417062,
Expand All @@ -363,6 +363,8 @@ and return a token response containing a token with the following claims:
}
```
Earlier versions of this documentation used `scope` as `requestParam` in the example. The scope request parameter is no logner supported by nimbus due to [c960757](https://github.com/navikt/mock-oauth2-server/commit/c9607571743cc087b190112f2197f4ac0a27aef2), so the call back needs to be configured with a different key.
Use variable `clientId` to set `sub` claim for Client Credentials Grant dynamically.
A token request with client credentials where `clientId = myClientId` and `tokenCallback`:
Expand All @@ -372,12 +374,12 @@ A token request with client credentials where `clientId = myClientId` and `token
"tokenExpiry": 120,
"requestMappings": [
{
"requestParam": "scope",
"match": "scope1",
"requestParam": "code",
"match": "code1",
"claims": {
"sub": "${clientId}",
"aud": [
"audByScope"
"audByCode"
]
}
}
Expand All @@ -390,7 +392,7 @@ will return a token response containing a token with the following claims:
```json
{
"sub": "myClientId",
"aud": "audByScope",
"aud": "audByCode",
"nbf": 1616416942,
"iss": "http://localhost:54905/issuer1",
"exp": 1616417062,
Expand Down

0 comments on commit 79b4d80

Please sign in to comment.