Skip to content

Commit 0ac554e

Browse files
committed
Merge branch '5.8.x' into 6.0.x
Closes gh-13238
2 parents f9b6d17 + 8ccc03f commit 0ac554e

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

@@ -1061,7 +1085,7 @@ By default, Resource Server configures a clock skew of 60 seconds.
10611085
[[oauth2resourceserver-jwt-validation-custom]]
10621086
=== Configuring a Custom Validator
10631087

1064-
Adding a check for the `aud` claim is simple with the `OAuth2TokenValidator` API:
1088+
Adding a check for <<_supplying_audiences, the `aud` claim>> is simple with the `OAuth2TokenValidator` API:
10651089

10661090
====
10671091
.Java
@@ -1169,6 +1193,9 @@ fun jwtDecoder(): JwtDecoder {
11691193
----
11701194
====
11711195

1196+
[TIP]
1197+
As stated earlier, you can instead <<_supplying_audiences, configure `aud` validation in Boot>>.
1198+
11721199
[[oauth2resourceserver-jwt-claimsetmapping]]
11731200
== Configuring Claim Set Mapping
11741201

0 commit comments

Comments
 (0)