Skip to content

Commit 812a48e

Browse files
committed
Merge pull request #35286 from bikash30851
* gh-35286: Polish "Document audience support in Oauth2 resource server" Document audience support in Oauth2 resource server Closes gh-35286
2 parents 7c5fd06 + f452a86 commit 812a48e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/spring-security.adoc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,21 @@ For JWT configuration, a JWK Set URI or OIDC Issuer URI needs to be specified, a
201201
NOTE: If the authorization server does not support a JWK Set URI, you can configure the resource server with the Public Key used for verifying the signature of the JWT.
202202
This can be done using the configprop:spring.security.oauth2.resourceserver.jwt.public-key-location[] property, where the value needs to point to a file containing the public key in the PEM-encoded x509 format.
203203

204-
The same properties are applicable for both servlet and reactive applications.
204+
The configprop:spring.security.oauth2.resourceserver.jwt.audiences[] property can be used to specifify the expected values of the aud claim in JWTs.
205+
For example, to require JWTs to contain an aud claim with the value `my-audience`:
206+
207+
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
208+
----
209+
spring:
210+
security:
211+
oauth2:
212+
resourceserver:
213+
jwt:
214+
audiences:
215+
- "my-audience"
216+
----
205217

218+
The same properties are applicable for both servlet and reactive applications.
206219
Alternatively, you can define your own `JwtDecoder` bean for servlet applications or a `ReactiveJwtDecoder` for reactive applications.
207220

208221
In cases where opaque tokens are used instead of JWTs, you can configure the following properties to validate tokens through introspection:
@@ -220,7 +233,6 @@ In cases where opaque tokens are used instead of JWTs, you can configure the fol
220233
----
221234

222235
Again, the same properties are applicable for both servlet and reactive applications.
223-
224236
Alternatively, you can define your own `OpaqueTokenIntrospector` bean for servlet applications or a `ReactiveOpaqueTokenIntrospector` for reactive applications.
225237

226238

0 commit comments

Comments
 (0)