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

@@ -90,20 +90,6 @@ public class SecurityMockServerConfigurerOpaqueTokenTests extends AbstractMockSe
.containsOnly(this.authority1, this.authority2);
}
@Test
public void mockOpaqueTokenWhenScopesThenBearerTokenAuthentication() {
this.client
.mutateWith(mockOpaqueToken().scopes("scoped", "authorities"))
.get()
.exchange()
.expectStatus().isOk();
SecurityContext context = securityContextController.removeSecurityContext();
assertThat((List<GrantedAuthority>) context.getAuthentication().getAuthorities())
.containsOnly(new SimpleGrantedAuthority("SCOPE_scoped"),
new SimpleGrantedAuthority("SCOPE_authorities"));
}
@Test
public void mockOpaqueTokenWhenAttributesThenBearerTokenAuthentication() {
String sub = new String("my-subject");

View File

@@ -89,13 +89,6 @@ public class SecurityMockMvcRequestPostProcessorsOpaqueTokenTests {
.andExpect(status().isForbidden());
}
@Test
public void opaqueTokenWhenAuthoritiesSpecifiedThenGrantsAccess() throws Exception {
this.mvc.perform(get("/admin/scopes")
.with(opaqueToken().scopes("admin", "read")))
.andExpect(content().string("[\"SCOPE_admin\",\"SCOPE_read\"]"));
}
@Test
public void opaqueTokenWhenAttributeSpecifiedThenUserHasAttribute() throws Exception {
this.mvc.perform(get("/opaque-token/iss")