Skip to content

Commit 13c5c6e

Browse files
bikash30851wilkinsona
authored andcommitted
Document audience support in Oauth2 resource server
See gh-35286
1 parent 7c5fd06 commit 13c5c6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,22 @@ Again, the same properties are applicable for both servlet and reactive applicat
223223

224224
Alternatively, you can define your own `OpaqueTokenIntrospector` bean for servlet applications or a `ReactiveOpaqueTokenIntrospector` for reactive applications.
225225

226+
To enable audience validation, set the `configprop:spring.security.oauth2.resourceserver.jwt.audiences[]` property in your Spring Boot application
227+
configuration file. This property specifies the expected value(s) of the aud claim in JWTs.
226228

229+
For example, to expect the JWTs to contain an aud claim with the value `my-audience`, you can add the following line to your
230+
application.properties file:
231+
232+
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
233+
----
234+
spring:
235+
security:
236+
oauth2:
237+
resourceserver:
238+
jwt:
239+
audiences:
240+
- "my-audience"
241+
----
227242

228243
[[web.security.oauth2.authorization-server]]
229244
==== Authorization Server

0 commit comments

Comments
 (0)