-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all user attributes in the id_token if requested by RP
- Loading branch information
Showing
5 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ | |
|
||
import static com.nimbusds.oauth2.sdk.auth.JWTAuthentication.CLIENT_ASSERTION_TYPE; | ||
import static io.restassured.RestAssured.given; | ||
import static java.util.Collections.emptyList; | ||
import static org.junit.Assert.*; | ||
|
||
@SuppressWarnings("unchecked") | ||
|
@@ -130,6 +131,19 @@ public void tokenWithClaims() throws IOException, ParseException, JOSEException, | |
assertEquals("Johhny", claimsSet.getClaim("nickname")); | ||
} | ||
|
||
@Test | ||
public void claimsInIdToken() throws IOException, ParseException, JOSEException, BadJOSEException { | ||
Response response = doAuthorizeWithClaims("student.mobility.rp.localhost", "code", null, null, null, emptyList()); | ||
String code = getCode(response); | ||
Map<String, Object> body = doToken(code, "student.mobility.rp.localhost", "secret", GrantType.AUTHORIZATION_CODE); | ||
|
||
String idToken = (String) body.get("id_token"); | ||
JWTClaimsSet claimsSet = processToken(idToken, port); | ||
|
||
assertEquals("[email protected]", claimsSet.getClaim("email")); | ||
assertEquals("Johhny", claimsSet.getClaim("nickname")); | ||
} | ||
|
||
@Test | ||
public void clientCredentials() throws ParseException, IOException { | ||
Map<String, Object> body = doToken(null, "mock-sp", "secret", GrantType.CLIENT_CREDENTIALS); | ||
|
@@ -325,7 +339,7 @@ public void codeChallengeFlow() throws IOException { | |
CodeChallenge codeChallenge = CodeChallenge.compute(CodeChallengeMethod.S256, new CodeVerifier(verifier)); | ||
|
||
Response response = doAuthorizeWithClaimsAndScopesAndCodeChallengeMethod("mock-sp", "code", null, "nonce", | ||
codeChallenge.getValue(), Collections.emptyList(), "openid", "state", CodeChallengeMethod.S256.getValue()); | ||
codeChallenge.getValue(), emptyList(), "openid", "state", CodeChallengeMethod.S256.getValue()); | ||
String code = getCode(response); | ||
Map<String, Object> body = doToken(code, "mock-sp", null, GrantType.AUTHORIZATION_CODE, verifier); | ||
assertTrue(body.containsKey("id_token")); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters