[java-idp-oidc] branch main updated: Add a couple of tests.
Scott Cantor
cantor.2 at osu.edu
Thu Jan 20 17:31:42 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-idp-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=470151a4b5f1f858d26c3d8deccd629a96c48a23
The following commit(s) were added to refs/heads/main by this push:
new 470151a4 Add a couple of tests.
470151a4 is described below
commit 470151a4b5f1f858d26c3d8deccd629a96c48a23
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 20 12:31:39 2022 -0500
Add a couple of tests.
---
.../flow/ClientCredentialsTokenFlowTest.java | 60 ++++------------------
1 file changed, 9 insertions(+), 51 deletions(-)
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/ClientCredentialsTokenFlowTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/ClientCredentialsTokenFlowTest.java
index e8b2b2f1..ecd09153 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/ClientCredentialsTokenFlowTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/ClientCredentialsTokenFlowTest.java
@@ -169,68 +169,26 @@ public class ClientCredentialsTokenFlowTest extends AbstractOidcClientAuthentica
verifyClaims("JWT", response.getTokens().getBearerAccessToken(), scope,
Collections.singletonList(resource));
}
-
- /*
-
- @Test
- public void testValidSecretJWT() throws Exception {
- final ClientSecretJWT clientAuth = buildSecretJwtAuth(clientSecret);
- final FlowExecutionResult result = launchWithJwtAuthentication(clientAuth, JWSAlgorithm.HS256);
- final AccessTokenResponse response = parseSuccessResponse(result, AccessTokenResponse.class);
- Assert.assertNotNull(response.getTokens().getAccessToken());
- }
- @Test
- public void testValidSecretJWTNoAlg() throws Exception {
- final ClientSecretJWT clientAuth = buildSecretJwtAuth(clientSecret);
- final FlowExecutionResult result = launchWithJwtAuthentication(clientAuth, null);
- final AccessTokenResponse response = parseSuccessResponse(result, AccessTokenResponse.class);
- Assert.assertNotNull(response.getTokens().getAccessToken());
- }
@Test
- public void testInvalidSecretJWT() throws Exception {
+ public void testInvalidSecretJWTAuthn() throws Exception {
final ClientSecretJWT clientAuth = buildSecretJwtAuth(clientSecret + "invalid");
final FlowExecutionResult result = launchWithJwtAuthentication(clientAuth, JWSAlgorithm.HS256);
assertErrorCode(result, OAuth2Error.INVALID_CLIENT_CODE);
}
-
- @Test
- public void testValidGrantWrappedClaimsUI() throws Exception {
- final String claimName = "name";
- final String claimValue = "John Doe";
- final JSONObject claimsUI = new JSONObject();
- claimsUI.put(claimName, claimValue);
- initializeGrantAndRequest(clientId, createRequestParameters(clientId, scope, resource));
- final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
- final AccessTokenResponse response = parseSuccessResponse(result, AccessTokenResponse.class);
- final AccessTokenClaimsSet claimsSet = unwrapAccessToken(response);
- Assert.assertNotNull(claimsSet);
- final ClaimsSet dlClaimsSet = claimsSet.getUserinfoDeliveryClaims();
- Assert.assertNotNull(dlClaimsSet);
- Assert.assertEquals(dlClaimsSet.getClaim(claimName), claimValue);
- Assert.assertNull(claimsSet.getDeliveryClaims().getClaim(claimName));
- Assert.assertNull(claimsSet.getIDTokenDeliveryClaims());
- }
@Test
- public void testValidGrantWrappedClaims() throws Exception {
- final String claimName = "name";
- final String claimValue = "John Doe";
- final JSONObject claims = new JSONObject();
- claims.put(claimName, claimValue);
- initializeGrantAndRequest(clientId, createRequestParameters(clientId, scope, resource));
- final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ public void testValidSecretJWTAuthn() throws Exception {
+ final ClientSecretJWT clientAuth = buildSecretJwtAuth(clientSecret);
+ final FlowExecutionResult result = launchWithJwtAuthentication(clientAuth, JWSAlgorithm.HS256);
final AccessTokenResponse response = parseSuccessResponse(result, AccessTokenResponse.class);
- final AccessTokenClaimsSet claimsSet = unwrapAccessToken(response);
- Assert.assertNotNull(claimsSet);
- final ClaimsSet dlClaimsSet = claimsSet.getDeliveryClaims();
- Assert.assertNotNull(dlClaimsSet);
- Assert.assertEquals(dlClaimsSet.getClaim(claimName), claimValue);
- Assert.assertNull(claimsSet.getUserinfoDeliveryClaims().getClaim(claimName));
- Assert.assertNull(claimsSet.getIDTokenDeliveryClaims());
+ Assert.assertNotNull(response.getTokens().getBearerAccessToken());
+ Assert.assertEquals(response.getTokens().getBearerAccessToken().getLifetime(), 600);
+ Assert.assertEquals(response.getTokens().getBearerAccessToken().getScope(), scope);
+ verifyClaims(null, response.getTokens().getBearerAccessToken(), scope,
+ Collections.singletonList(resource));
}
- */
private AccessTokenClaimsSet unwrapAccessToken(final AccessTokenResponse tokenResponse) {
final AccessToken accessToken = tokenResponse.getTokens().getAccessToken();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list