Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration test for issue #2033 #15686

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ public void testGetTokenUsingClientCredentialsGrant() throws Exception {
ClientID clientID = new ClientID(consumerKey);
Secret clientSecret = new Secret(consumerSecret);
ClientAuthentication clientAuth = new ClientSecretBasic(clientID, clientSecret);
Scope scope = new Scope(OAUTH2_SCOPE_OPENID, "xyz");

// Add email, profile scopes to the request.
Scope scope = new Scope(OAuth2Constant.OAUTH2_SCOPE_OPENID, OAuth2Constant.OAUTH2_SCOPE_EMAIL,
OAuth2Constant.OAUTH2_SCOPE_PROFILE, "xyz");

URI tokenEndpoint = new URI(OAuth2Constant.ACCESS_TOKEN_ENDPOINT);
TokenRequest request = new TokenRequest(tokenEndpoint, clientAuth, clientCredentialsGrant, scope);
Expand All @@ -154,9 +157,15 @@ public void testGetTokenUsingClientCredentialsGrant() throws Exception {
Assert.assertTrue(scopesInResponse.contains("xyz"), "Requested scope is missing in the token response");

// This ensures that openid scopes are not issued for client credential grant type.
Assert.assertFalse(accessTokenResponse instanceof OIDCTokenResponse, "Client credential grant type cannot " +
"get a OIDC Token Response.");
Assert.assertFalse(scopesInResponse.contains(OAUTH2_SCOPE_OPENID), "Client credentials cannot get openid scope.");
Assert.assertFalse(accessTokenResponse instanceof OIDCTokenResponse,
"Client credential grant type cannot get a OIDC Token Response.");
Assert.assertFalse(scopesInResponse.contains(OAUTH2_SCOPE_OPENID),
"Client credentials cannot get openid scope.");

Assert.assertFalse(scopesInResponse.contains(OAuth2Constant.OAUTH2_SCOPE_EMAIL),
"Client credentials cannot get email scope.");
Assert.assertFalse(scopesInResponse.contains(OAuth2Constant.OAUTH2_SCOPE_PROFILE),
"Client credentials cannot get profile scope.");
}

@Test(groups = "wso2.is", description = "Validate access token",
Expand Down