1
0
mirror of synced 2026-08-04 17:27:13 +00:00

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
@@ -203,7 +203,7 @@ Any headers or claims can be configured with their corresponding methods:
[source,java]
----
client
.mutateWith(jwt(jwt -> jwt.header("kid", "one")
.mutateWith(mockJwt().jwt(jwt -> jwt.header("kid", "one")
.claim("iss", "https://idp.example.org")))
.get().uri("/endpoint").exchange();
----
@@ -211,7 +211,7 @@ client
[source,java]
----
client
.mutateWith(jwt(jwt -> jwt.claims(claims -> claims.remove("scope"))))
.mutateWith(mockJwt().jwt(jwt -> jwt.claims(claims -> claims.remove("scope"))))
.get().uri("/endpoint").exchange();
----
@@ -244,7 +244,7 @@ Jwt jwt = Jwt.withTokenValue("token")
.claim("scope", "read");
client
.mutateWith(jwt(jwt))
.mutateWith(mockJwt().jwt(jwt))
.get().uri("/endpoint").exchange();
----
@@ -335,14 +335,14 @@ Any headers or claims can be configured with their corresponding methods:
----
mvc
.perform(get("/endpoint")
.with(jwt(jwt -> jwt.header("kid", "one").claim("iss", "https://idp.example.org"))));
.with(jwt().jwt(jwt -> jwt.header("kid", "one").claim("iss", "https://idp.example.org"))));
----
[source,java]
----
mvc
.perform(get("/endpoint")
.with(jwt(jwt -> jwt.claims(claims -> claims.remove("scope")))));
.with(jwt().jwt(jwt -> jwt.claims(claims -> claims.remove("scope")))));
----
The `scope` and `scp` claims are processed the same way here as they are in a normal bearer token request.
@@ -375,7 +375,7 @@ Jwt jwt = Jwt.withTokenValue("token")
mvc
.perform(get("/endpoint")
.with(jwt(jwt)));
.with(jwt().jwt(jwt)));
----
===== `authentication()` `RequestPostProcessor`