Skip to content

Commit 58a0805

Browse files
committed
Merge branch '6.0.x'
Closes gh-13239
2 parents 13c9d62 + 0ac554e commit 58a0805

File tree

1 file changed

+28
-1
lines changed
  • docs/modules/ROOT/pages/servlet/oauth2/resource-server

1 file changed

+28
-1
lines changed

docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,30 @@ We still specify the `issuer-uri` so that Resource Server still validates the `i
132132
[NOTE]
133133
This property can also be supplied directly on the <<oauth2resourceserver-jwt-jwkseturi-dsl,DSL>>.
134134

135+
== Supplying Audiences
136+
137+
As already seen, the <<_specifying_the_authorization_server, `issuer-uri` property validates the `iss` claim>>; this is who sent the JWT.
138+
139+
Boot also has the `audiences` property for validating the `aud` claim; this is who the JWT was sent to.
140+
141+
A resource server's audience can be indicated like so:
142+
143+
[source,yaml]
144+
----
145+
spring:
146+
security:
147+
oauth2:
148+
resourceserver:
149+
jwt:
150+
issuer-uri: https://idp.example.com
151+
audiences: https://my-resource-server.example.com
152+
----
153+
154+
[NOTE]
155+
You can also add <<oauth2resourceserver-jwt-validation-custom, the `aud` validation programmatically>>, if needed.
156+
157+
The result will be that if the JWT's `iss` claim is not `https://idp.example.com`, and its `aud` claim does not contain `https://my-resource-server.example.com` in its list, then validation will fail.
158+
135159
[[oauth2resourceserver-jwt-sansboot]]
136160
== Overriding or Replacing Boot Auto Configuration
137161

@@ -1106,7 +1130,7 @@ By default, Resource Server configures a clock skew of 60 seconds.
11061130
[[oauth2resourceserver-jwt-validation-custom]]
11071131
=== Configuring a Custom Validator
11081132

1109-
Adding a check for the `aud` claim is simple with the `OAuth2TokenValidator` API:
1133+
Adding a check for <<_supplying_audiences, the `aud` claim>> is simple with the `OAuth2TokenValidator` API:
11101134

11111135
====
11121136
.Java
@@ -1214,6 +1238,9 @@ fun jwtDecoder(): JwtDecoder {
12141238
----
12151239
====
12161240

1241+
[TIP]
1242+
As stated earlier, you can instead <<_supplying_audiences, configure `aud` validation in Boot>>.
1243+
12171244
[[oauth2resourceserver-jwt-claimsetmapping]]
12181245
== Configuring Claim Set Mapping
12191246

0 commit comments

Comments
 (0)