Simplify opaqueToken support

Remove scopes convenience method to alleviate potential confusion with
the "scope" attribute.

Issue gh-7827
Issue gh-7712
This commit is contained in:
Josh Cummings
2020-03-02 18:24:08 -07:00
parent 689fc9df0c
commit 3bc1b7a933
5 changed files with 3 additions and 48 deletions

View File

@@ -51,7 +51,7 @@ public class OAuth2ResourceServerControllerTests {
@Test
public void messageCanBeReadWithScopeMessageReadAuthority() throws Exception {
this.mvc.perform(get("/message").with(opaqueToken().scopes("message:read")))
this.mvc.perform(get("/message").with(opaqueToken().attributes(a -> a.put("scope", "message:read"))))
.andExpect(content().string(is("secret message")));
this.mvc.perform(get("/message")
@@ -77,7 +77,7 @@ public class OAuth2ResourceServerControllerTests {
public void messageCanNotBeCreatedWithScopeMessageReadAuthority() throws Exception {
this.mvc.perform(post("/message")
.content("Hello message")
.with(opaqueToken().scopes("message:read")))
.with(opaqueToken().authorities(new SimpleGrantedAuthority("SCOPE_message:read"))))
.andExpect(status().isForbidden());
}
@@ -85,7 +85,7 @@ public class OAuth2ResourceServerControllerTests {
public void messageCanBeCreatedWithScopeMessageWriteAuthority() throws Exception {
this.mvc.perform(post("/message")
.content("Hello message")
.with(opaqueToken().scopes("message:write")))
.with(opaqueToken().authorities(new SimpleGrantedAuthority("SCOPE_message:write"))))
.andExpect(status().isOk())
.andExpect(content().string(is("Message was created. Content: Hello message")));
}