Skip to content

Commit

Permalink
Authorization Live test fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
maibin committed Dec 20, 2016
1 parent 122561f commit 70e63a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
18 changes: 16 additions & 2 deletions spring-security-oauth-server/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,19 @@ INSERT INTO oauth_client_details
web_server_redirect_uri, authorities, access_token_validity,
refresh_token_validity, additional_information, autoapprove)
VALUES
("fooClientIdPassword", "secret", "foo, read, write",
"password, authorization_code, refresh_token", null, null, 36000, 36000, null, true);
("fooClientIdPassword", "secret", "foo,read,write",
"password,authorization_code,refresh_token", null, null, 36000, 36000, null, true);
INSERT INTO oauth_client_details
(client_id, client_secret, scope, authorized_grant_types,
web_server_redirect_uri, authorities, access_token_validity,
refresh_token_validity, additional_information, autoapprove)
VALUES
("sampleClientId", "secret", "read,write,foo,bar",
"implicit", null, null, 36000, 36000, null, false);
INSERT INTO oauth_client_details
(client_id, client_secret, scope, authorized_grant_types,
web_server_redirect_uri, authorities, access_token_validity,
refresh_token_validity, additional_information, autoapprove)
VALUES
("barClientIdPassword", "secret", "bar,read,write",
"password,authorization_code,refresh_token", null, null, 36000, 36000, null, true);
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() {
assertEquals(403, barResponse.getStatusCode());
}

@Test
public void accessDynamicClient() {
final String accessToken = obtainAccessToken("dynamicClientId", "user", "pass");

final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8082/spring-security-oauth-resource/foos/1");
assertEquals(200, fooResponse.getStatusCode());
assertNotNull(fooResponse.jsonPath().get("name"));
}

@Test
public void givenUser_whenUseBarClient_thenOkForBarResourceReadOnly() {
final String accessToken = obtainAccessToken("barClientIdPassword", "john", "123");
Expand Down

0 comments on commit 70e63a9

Please sign in to comment.