Skip to content

Commit

Permalink
Overload TestClient method to remove subdomain requirement
Browse files Browse the repository at this point in the history
- Remove null subdomain for tokens of the default uaa zone

Signed-off-by: Madhura Bhave <mbhave@pivotal.io>
  • Loading branch information
Chris Dutra authored and mbhave committed Jan 16, 2015
1 parent 94db319 commit 82ba1ed
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 40 deletions.
Expand Up @@ -138,7 +138,7 @@ public void setUp() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");
testUser = createUser(adminToken, "testUser", "Test", "User", "testuser@test.com", testPassword); testUser = createUser(adminToken, "testUser", "Test", "User", "testuser@test.com", testPassword);


listener = mock(new DefaultApplicationListener<AbstractUaaEvent>() {}.getClass()); listener = mock(new DefaultApplicationListener<AbstractUaaEvent>() {}.getClass());
Expand Down Expand Up @@ -219,7 +219,7 @@ public void unverifiedUserAuthenticationWhenAllowedTest() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


ScimUser molly = createUser(adminToken, "molly", "Molly", "Collywobble", "molly@example.com", "wobble"); ScimUser molly = createUser(adminToken, "molly", "Molly", "Collywobble", "molly@example.com", "wobble");


Expand All @@ -246,7 +246,7 @@ public void unverifiedUserAuthenticationWhenNotAllowedTest() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


ScimUser molly = createUser(adminToken, "molly", "Molly", "Collywobble", "molly@example.com", "wobble"); ScimUser molly = createUser(adminToken, "molly", "Molly", "Collywobble", "molly@example.com", "wobble");


Expand Down Expand Up @@ -294,7 +294,7 @@ public void findAuditHistory() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


ScimUser jacob = createUser(adminToken, "jacob", "Jacob", "Gyllenhammer", "jacob@gyllenhammer.non", null); ScimUser jacob = createUser(adminToken, "jacob", "Jacob", "Gyllenhammer", "jacob@gyllenhammer.non", null);
String jacobId = jacob.getId(); String jacobId = jacob.getId();
Expand Down Expand Up @@ -422,7 +422,7 @@ public void userChangeInvalidPasswordTest() throws Exception {


@Test @Test
public void loginServerPasswordChange() throws Exception { public void loginServerPasswordChange() throws Exception {
String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login");


PasswordResetEndpoints.PasswordChange pwch = new PasswordResetEndpoints.PasswordChange(); PasswordResetEndpoints.PasswordChange pwch = new PasswordResetEndpoints.PasswordChange();
pwch.setUsername(testUser.getUserName()); pwch.setUsername(testUser.getUserName());
Expand Down Expand Up @@ -460,7 +460,7 @@ public void loginServerPasswordChange() throws Exception {


@Test @Test
public void loginServerInvalidPasswordChange() throws Exception { public void loginServerInvalidPasswordChange() throws Exception {
String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login");


PasswordResetEndpoints.PasswordChange pwch = new PasswordResetEndpoints.PasswordChange(); PasswordResetEndpoints.PasswordChange pwch = new PasswordResetEndpoints.PasswordChange();
pwch.setUsername(testUser.getUserName()); pwch.setUsername(testUser.getUserName());
Expand All @@ -486,7 +486,7 @@ public void loginServerInvalidPasswordChange() throws Exception {
@Test @Test
public void clientAuthenticationSuccess() throws Exception { public void clientAuthenticationSuccess() throws Exception {
ArgumentCaptor<AbstractUaaEvent> captor = ArgumentCaptor.forClass(AbstractUaaEvent.class); ArgumentCaptor<AbstractUaaEvent> captor = ArgumentCaptor.forClass(AbstractUaaEvent.class);
testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login", null); testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login");
verify(listener, times(2)).onApplicationEvent(captor.capture()); verify(listener, times(2)).onApplicationEvent(captor.capture());
ClientAuthenticationSuccessEvent event = (ClientAuthenticationSuccessEvent)captor.getAllValues().get(0); ClientAuthenticationSuccessEvent event = (ClientAuthenticationSuccessEvent)captor.getAllValues().get(0);
assertEquals("login", event.getClientId()); assertEquals("login", event.getClientId());
Expand Down Expand Up @@ -552,7 +552,7 @@ public void testUserCreatedEvent() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


String username = "jacob"+new RandomValueStringGenerator().generate(), firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non"; String username = "jacob"+new RandomValueStringGenerator().generate(), firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non";
ScimUser user = new ScimUser(); ScimUser user = new ScimUser();
Expand Down Expand Up @@ -586,7 +586,7 @@ public void testUserCreatedEventDuringLoginServerAuthorize() throws Exception {
String loginToken = testClient.getClientCredentialsOAuthAccessToken( String loginToken = testClient.getClientCredentialsOAuthAccessToken(
"login", "login",
"loginsecret", "loginsecret",
"oauth.login", null); "oauth.login");
MockHttpServletRequestBuilder userPost = post("/oauth/authorize") MockHttpServletRequestBuilder userPost = post("/oauth/authorize")
.accept(MediaType.APPLICATION_JSON_VALUE) .accept(MediaType.APPLICATION_JSON_VALUE)
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON)
Expand Down Expand Up @@ -622,7 +622,7 @@ public void testUserModifiedAndDeleteEvent() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


String username = "jacob"+new RandomValueStringGenerator().generate(), firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non"; String username = "jacob"+new RandomValueStringGenerator().generate(), firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non";
String modifiedFirstName = firstName+lastName; String modifiedFirstName = firstName+lastName;
Expand Down Expand Up @@ -683,7 +683,7 @@ public void testUserVerifiedEvent() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


String username = "jacob", firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non"; String username = "jacob", firstName = "Jacob", lastName = "Gyllenhammar", email = "jacob@gyllenhammar.non";
ScimUser user = new ScimUser(); ScimUser user = new ScimUser();
Expand Down Expand Up @@ -720,7 +720,7 @@ public void testUserVerifiedEvent() throws Exception {


@Test @Test
public void passwordResetRequestEvent() throws Exception { public void passwordResetRequestEvent() throws Exception {
String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login");


testListener.clearEvents(); testListener.clearEvents();
MockHttpServletRequestBuilder changePasswordPost = post("/password_resets") MockHttpServletRequestBuilder changePasswordPost = post("/password_resets")
Expand All @@ -744,7 +744,7 @@ public void testGroupEvents() throws Exception {
String adminToken = testClient.getClientCredentialsOAuthAccessToken( String adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"uaa.admin,scim.write", null); "uaa.admin,scim.write");


ScimUser jacob = createUser(adminToken, "jacob", "Jacob", "Gyllenhammer", "jacob@gyllenhammer.non", null); ScimUser jacob = createUser(adminToken, "jacob", "Jacob", "Gyllenhammer", "jacob@gyllenhammer.non", null);
ScimUser emily = createUser(adminToken, "emily", "Emily", "Gyllenhammer", "emily@gyllenhammer.non", null); ScimUser emily = createUser(adminToken, "emily", "Emily", "Gyllenhammer", "emily@gyllenhammer.non", null);
Expand Down
Expand Up @@ -110,7 +110,7 @@ public static void setUp() throws Exception {
adminToken = testClient.getClientCredentialsOAuthAccessToken( adminToken = testClient.getClientCredentialsOAuthAccessToken(
testAccounts.getAdminClientId(), testAccounts.getAdminClientId(),
testAccounts.getAdminClientSecret(), testAccounts.getAdminClientSecret(),
"clients.admin clients.read clients.write clients.secret", null); "clients.admin clients.read clients.write clients.secret");


applicationEventPublisher = mock(ApplicationEventPublisher.class); applicationEventPublisher = mock(ApplicationEventPublisher.class);
ClientAdminEventPublisher eventPublisher = (ClientAdminEventPublisher)webApplicationContext.getBean("clientAdminEventPublisher"); ClientAdminEventPublisher eventPublisher = (ClientAdminEventPublisher)webApplicationContext.getBean("clientAdminEventPublisher");
Expand Down Expand Up @@ -706,7 +706,7 @@ public void testFailedSecretChangeEvent() throws Exception {
.content(toString(client)); .content(toString(client));
mockMvc.perform(createClientPost).andExpect(status().isCreated()); mockMvc.perform(createClientPost).andExpect(status().isCreated());


String clientSecretToken = testClient.getClientCredentialsOAuthAccessToken(client.getClientId(), client.getClientSecret(), "clients.secret", null); String clientSecretToken = testClient.getClientCredentialsOAuthAccessToken(client.getClientId(), client.getClientSecret(), "clients.secret");


SecretChangeRequest request = new SecretChangeRequest(client.getClientId(), "invalidsecret", "newsecret"); SecretChangeRequest request = new SecretChangeRequest(client.getClientId(), "invalidsecret", "newsecret");
MockHttpServletRequestBuilder modifyClientsPost = put("/oauth/clients/" + client.getClientId() + "/secret") MockHttpServletRequestBuilder modifyClientsPost = put("/oauth/clients/" + client.getClientId() + "/secret")
Expand Down Expand Up @@ -892,7 +892,7 @@ public void testClientsAdminPermissions() throws Exception {
String token = testClient.getClientCredentialsOAuthAccessToken( String token = testClient.getClientCredentialsOAuthAccessToken(
adminsClient.getClientId(), adminsClient.getClientId(),
"secret", "secret",
"clients.admin", null); "clients.admin");


MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients/tx/modify") MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients/tx/modify")
.header("Authorization", "Bearer " + token) .header("Authorization", "Bearer " + token)
Expand All @@ -917,7 +917,7 @@ public void testNonClientsAdminPermissions() throws Exception {
String token = testClient.getClientCredentialsOAuthAccessToken( String token = testClient.getClientCredentialsOAuthAccessToken(
adminsClient.getClientId(), adminsClient.getClientId(),
"secret", "secret",
"clients.write", null); "clients.write");


MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients/tx/modify") MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients/tx/modify")
.header("Authorization", "Bearer " + token) .header("Authorization", "Bearer " + token)
Expand All @@ -943,7 +943,7 @@ public void testCreateAsAdminPermissions() throws Exception {
String token = testClient.getClientCredentialsOAuthAccessToken( String token = testClient.getClientCredentialsOAuthAccessToken(
adminsClient.getClientId(), adminsClient.getClientId(),
"secret", "secret",
"clients.admin", null); "clients.admin");


MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients") MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients")
.header("Authorization", "Bearer " + token) .header("Authorization", "Bearer " + token)
Expand All @@ -968,7 +968,7 @@ public void testCreateAsReadPermissions() throws Exception {
String token = testClient.getClientCredentialsOAuthAccessToken( String token = testClient.getClientCredentialsOAuthAccessToken(
adminsClient.getClientId(), adminsClient.getClientId(),
"secret", "secret",
"clients.read", null); "clients.read");


MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients") MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients")
.header("Authorization", "Bearer " + token) .header("Authorization", "Bearer " + token)
Expand All @@ -993,7 +993,7 @@ public void testCreateAsWritePermissions() throws Exception {
String token = testClient.getClientCredentialsOAuthAccessToken( String token = testClient.getClientCredentialsOAuthAccessToken(
adminsClient.getClientId(), adminsClient.getClientId(),
"secret", "secret",
"clients.write", null); "clients.write");


MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients") MockHttpServletRequestBuilder modifyClientsPost = post("/oauth/clients")
.header("Authorization", "Bearer " + token) .header("Authorization", "Bearer " + token)
Expand Down
Expand Up @@ -58,7 +58,7 @@ public static void setUp() throws Exception {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).addFilter(springSecurityFilterChain) mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).addFilter(springSecurityFilterChain)
.build(); .build();
testClient = new TestClient(mockMvc); testClient = new TestClient(mockMvc);
loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", null, null); loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", null);
} }


@AfterClass @AfterClass
Expand Down Expand Up @@ -93,7 +93,7 @@ public void testGenerateCodeWithInvalidScope() throws Exception {
Timestamp ts = new Timestamp(System.currentTimeMillis() + 60000); Timestamp ts = new Timestamp(System.currentTimeMillis() + 60000);
ExpiringCode code = new ExpiringCode(null, ts, "{}"); ExpiringCode code = new ExpiringCode(null, ts, "{}");
TestClient testClient = new TestClient(mockMvc); TestClient testClient = new TestClient(mockMvc);
String loginToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.read", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.read");


String requestBody = new ObjectMapper().writeValueAsString(code); String requestBody = new ObjectMapper().writeValueAsString(code);
MockHttpServletRequestBuilder post = post("/Codes") MockHttpServletRequestBuilder post = post("/Codes")
Expand Down
Expand Up @@ -735,7 +735,7 @@ public void testLoginAuthenticationFilter() throws Exception {
String userId = "testuser" + new RandomValueStringGenerator().generate(); String userId = "testuser" + new RandomValueStringGenerator().generate();
String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three"; String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three";
ScimUser developer = setUpUser(userId, userScopes); ScimUser developer = setUpUser(userId, userScopes);
String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "");


//the login server is matched by providing //the login server is matched by providing
//1. Bearer token (will be authenticated for oauth.login scope) //1. Bearer token (will be authenticated for oauth.login scope)
Expand Down Expand Up @@ -941,7 +941,7 @@ public void testOtherOauthResourceLoginAuthenticationFilter() throws Exception {
String userId = "testuser" + new RandomValueStringGenerator().generate(); String userId = "testuser" + new RandomValueStringGenerator().generate();
String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three"; String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three";
ScimUser developer = setUpUser(userId, userScopes); ScimUser developer = setUpUser(userId, userScopes);
String loginToken = testClient.getClientCredentialsOAuthAccessToken(oauthClientId, SECRET, "", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken(oauthClientId, SECRET, "");


//failure - success only if token has oauth.login //failure - success only if token has oauth.login
mockMvc.perform(post("/oauth/token") mockMvc.perform(post("/oauth/token")
Expand Down Expand Up @@ -1114,7 +1114,7 @@ public void testOtherClientAuthenticationMethods() throws Exception {
String userId = "testuser" + new RandomValueStringGenerator().generate(); String userId = "testuser" + new RandomValueStringGenerator().generate();
String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three"; String userScopes = "space.1.developer,space.2.developer,org.1.reader,org.2.reader,org.12345.admin,scope.one,scope.two,scope.three";
ScimUser developer = setUpUser(userId, userScopes); ScimUser developer = setUpUser(userId, userScopes);
String loginToken = testClient.getClientCredentialsOAuthAccessToken(oauthClientId, SECRET, "", null); String loginToken = testClient.getClientCredentialsOAuthAccessToken(oauthClientId, SECRET, "");


//success - regular password grant but client is authenticated using POST parameters //success - regular password grant but client is authenticated using POST parameters
mockMvc.perform(post("/oauth/token") mockMvc.perform(post("/oauth/token")
Expand Down
Expand Up @@ -75,11 +75,11 @@ public static void setUp() throws Exception {
identityAdminToken = testClient.getClientCredentialsOAuthAccessToken( identityAdminToken = testClient.getClientCredentialsOAuthAccessToken(
"identity", "identity",
"identitysecret", "identitysecret",
"zones.create", null); "zones.create");
adminToken = testClient.getClientCredentialsOAuthAccessToken( adminToken = testClient.getClientCredentialsOAuthAccessToken(
"admin", "admin",
"adminsecret", "adminsecret",
"uaa.admin", null); "uaa.admin");


} }


Expand Down Expand Up @@ -395,28 +395,28 @@ public void testCreateAndListUsersInOtherZoneIsUnauthorized() throws Exception {
String subdomain = generator.generate(); String subdomain = generator.generate();
createOtherIdentityZone(subdomain); createOtherIdentityZone(subdomain);


String zoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.write,scim.read", null); String defaultZoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.write,scim.read");


ScimUser user = getScimUser(); ScimUser user = getScimUser();


byte[] requestBody = new ObjectMapper().writeValueAsBytes(user); byte[] requestBody = new ObjectMapper().writeValueAsBytes(user);
MockHttpServletRequestBuilder post = post("/Users") MockHttpServletRequestBuilder post = post("/Users")
.with(new SetServerNameRequestPostProcessor(subdomain + ".localhost")) .with(new SetServerNameRequestPostProcessor(subdomain + ".localhost"))
.header("Authorization", "Bearer " + zoneAdminToken) .header("Authorization", "Bearer " + defaultZoneAdminToken)
.contentType(APPLICATION_JSON) .contentType(APPLICATION_JSON)
.content(requestBody); .content(requestBody);


mockMvc.perform(post).andExpect(status().isUnauthorized()); mockMvc.perform(post).andExpect(status().isUnauthorized());


MockHttpServletRequestBuilder get = get("/Users").header("Authorization", "Bearer " + zoneAdminToken); MockHttpServletRequestBuilder get = get("/Users").header("Authorization", "Bearer " + defaultZoneAdminToken);
if (subdomain != null && !subdomain.equals("")) get.with(new SetServerNameRequestPostProcessor(subdomain + ".localhost")); if (subdomain != null && !subdomain.equals("")) get.with(new SetServerNameRequestPostProcessor(subdomain + ".localhost"));


mockMvc.perform(get).andExpect(status().isUnauthorized()).andReturn(); mockMvc.perform(get).andExpect(status().isUnauthorized()).andReturn();
} }


@Test @Test
public void testModifyandDeleteUserInOtherZoneIsUnauthorized() throws Exception { public void testModifyandDeleteUserInOtherZoneIsUnauthorized() throws Exception {
String defaultZoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.write", null); String defaultZoneAdminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "scim.write");
ScimUser user = createUser(defaultZoneAdminToken, null); ScimUser user = createUser(defaultZoneAdminToken, null);


String subdomain = generator.generate(); String subdomain = generator.generate();
Expand Down Expand Up @@ -447,7 +447,7 @@ public void testModifyandDeleteUserInOtherZoneIsUnauthorized() throws Exception


private IdentityZone createOtherIdentityZone(String subdomain) throws Exception { private IdentityZone createOtherIdentityZone(String subdomain) throws Exception {


String identityToken = testClient.getClientCredentialsOAuthAccessToken("identity", "identitysecret", "zones.create", null); String identityToken = testClient.getClientCredentialsOAuthAccessToken("identity", "identitysecret", "zones.create");


IdentityZone identityZone = MultitenancyFixture.identityZone(subdomain, subdomain); IdentityZone identityZone = MultitenancyFixture.identityZone(subdomain, subdomain);
IdentityZoneCreationRequest creationRequest = new IdentityZoneCreationRequest(); IdentityZoneCreationRequest creationRequest = new IdentityZoneCreationRequest();
Expand Down
Expand Up @@ -58,7 +58,7 @@ public void setUp() throws Exception {
.build(); .build();


TestClient testClient = new TestClient(mockMvc); TestClient testClient = new TestClient(mockMvc);
loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login", null); loginToken = testClient.getClientCredentialsOAuthAccessToken("login", "loginsecret", "oauth.login");
} }


@After @After
Expand Down
Expand Up @@ -107,12 +107,12 @@ public void setUp() throws Exception {


TestClient testClient = new TestClient(mockMvc); TestClient testClient = new TestClient(mockMvc);
String adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", String adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret",
"clients.read clients.write clients.secret", null); "clients.read clients.write clients.secret");
String clientId = generator.generate().toLowerCase(); String clientId = generator.generate().toLowerCase();
String clientSecret = generator.generate().toLowerCase(); String clientSecret = generator.generate().toLowerCase();
createScimClient(adminToken, clientId, clientSecret); createScimClient(adminToken, clientId, clientSecret);
scimReadToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.read password.write", null); scimReadToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.read password.write");
scimWriteToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.write password.write", null); scimWriteToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.write password.write");


defaultExternalMembers = new LinkedList<>(originalDefaultExternalMembers); defaultExternalMembers = new LinkedList<>(originalDefaultExternalMembers);
databaseExternalMembers = new LinkedList<>(originalDatabaseExternalMembers); databaseExternalMembers = new LinkedList<>(originalDatabaseExternalMembers);
Expand Down
Expand Up @@ -57,12 +57,12 @@ public void setUp() throws Exception {


TestClient testClient = new TestClient(mockMvc); TestClient testClient = new TestClient(mockMvc);
String adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", String adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret",
"clients.read clients.write clients.secret", null); "clients.read clients.write clients.secret");
String clientId = generator.generate().toLowerCase(); String clientId = generator.generate().toLowerCase();
String clientSecret = generator.generate().toLowerCase(); String clientSecret = generator.generate().toLowerCase();
createScimClient(adminToken, clientId, clientSecret); createScimClient(adminToken, clientId, clientSecret);
scimReadWriteToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.read scim.write password.write", null); scimReadWriteToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.read scim.write password.write");
scimCreateToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.create", null); scimCreateToken = testClient.getClientCredentialsOAuthAccessToken(clientId, clientSecret,"scim.create");
} }


@After @After
Expand Down
Expand Up @@ -76,7 +76,7 @@ public static void setUp() throws Exception {


testClient = new TestClient(mockMvc); testClient = new TestClient(mockMvc);


adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "clients.read clients.write clients.secret scim.read scim.write", null); adminToken = testClient.getClientCredentialsOAuthAccessToken("admin", "adminsecret", "clients.read clients.write clients.secret scim.read scim.write");


createScimClient(adminToken, clientId, clientSecret); createScimClient(adminToken, clientId, clientSecret);
scimLookupIdUserToken = testClient.getUserOAuthAccessToken(clientId, clientSecret, username, password, "scim.userids"); scimLookupIdUserToken = testClient.getUserOAuthAccessToken(clientId, clientSecret, username, password, "scim.userids");
Expand Down

0 comments on commit 82ba1ed

Please sign in to comment.