Isolate Jwt Test Support

Isolating Jwt test support inside JwtRequestPostProcessor and
JwtMutator.

Fixes gh-7641
This commit is contained in:
Josh Cummings
2019-11-22 12:38:01 -07:00
parent 8a95e5798d
commit 7cbd1665a6
8 changed files with 107 additions and 136 deletions

View File

@@ -50,14 +50,14 @@ public class OAuth2ResourceServerControllerTests {
@Test
public void indexGreetsAuthenticatedUser() {
this.rest.mutateWith(mockJwt(jwt -> jwt.subject("test-subject")))
this.rest.mutateWith(mockJwt().jwt(jwt -> jwt.subject("test-subject")))
.get().uri("/").exchange()
.expectBody(String.class).isEqualTo("Hello, test-subject!");
}
@Test
public void messageCanBeReadWithScopeMessageReadAuthority() {
this.rest.mutateWith(mockJwt(jwt -> jwt.claim("scope", "message:read")))
this.rest.mutateWith(mockJwt().jwt(jwt -> jwt.claim("scope", "message:read")))
.get().uri("/message").exchange()
.expectBody(String.class).isEqualTo("secret message");