You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-resourceserver.adoc
+238-6
Original file line number
Diff line number
Diff line change
@@ -208,13 +208,17 @@ Methods on the `oauth2ResourceServer` DSL will also override or replace auto con
208
208
209
209
For example, the second `@Bean` Spring Boot creates is a `JwtDecoder`, which decodes `String` tokens into validated instances of `Jwt`:
210
210
211
+
212
+
.JWT Decoder
213
+
====
211
214
[source,java]
212
215
----
213
216
@Bean
214
217
public JwtDecoder jwtDecoder() {
215
218
return JwtDecoders.fromIssuerLocation(issuerUri);
216
219
}
217
220
----
221
+
====
218
222
219
223
[NOTE]
220
224
Calling `{security-api-url}org/springframework/security/oauth2/jwt/JwtDecoders.html#fromIssuerLocation-java.lang.String-[JwtDecoders#fromIssuerLocation]` is what invokes the Provider Configuration or Authorization Server Metadata endpoint in order to derive the JWK Set Uri.
@@ -223,6 +227,39 @@ If the application doesn't expose a `JwtDecoder` bean, then Spring Boot will exp
223
227
224
228
And its configuration can be overridden using `jwkSetUri()` or replaced using `decoder()`.
225
229
230
+
Or, if you're not using Spring Boot at all, then both of these components - the filter chain and a `JwtDecoder` can be specified in XML.
This is handy when deeper configuration, like <<oauth2resourceserver-jwt-validation,validation>>, <<oauth2resourceserver-jwt-claimsetmapping,mapping>>, or <<oauth2resourceserver-jwt-timeouts,request timeouts>>, is necessary.
@@ -541,6 +600,18 @@ class DirectlyConfiguredJwkSetUri : WebSecurityConfigurerAdapter() {
This is handy when deeper configuration, like <<oauth2resourceserver-opaque-authorization-extraction,authority mapping>>, <<oauth2resourceserver-opaque-jwt-introspector,JWT revocation>>, or <<oauth2resourceserver-opaque-timeouts,request timeouts>>, is necessary.
@@ -1194,7 +1341,11 @@ When this is the case, Resource Server will attempt to coerce these scopes into
1194
1341
1195
1342
This means that to protect an endpoint or method with a scope derived from an Opaque Token, the corresponding expressions should include this prefix:
1196
1343
1197
-
```java
1344
+
.Authorization Opaque Token Configuration
1345
+
====
1346
+
.Java
1347
+
[source,java,role="primary"]
1348
+
----
1198
1349
@EnableWebSecurity
1199
1350
public class MappedAuthorities extends WebSecurityConfigurerAdapter {
1200
1351
protected void configure(HttpSecurity http) {
@@ -1207,7 +1358,20 @@ public class MappedAuthorities extends WebSecurityConfigurerAdapter {
@@ -1478,7 +1654,10 @@ In each case, there are two things that need to be done and trade-offs associate
1478
1654
1479
1655
One way to differentiate tenants is by the issuer claim. Since the issuer claim accompanies signed JWTs, this can be done with the `JwtIssuerAuthenticationManagerResolver`, like so:
1480
1656
1481
-
[source,java]
1657
+
.Multitenancy Tenant by JWT Claim
1658
+
====
1659
+
.Java
1660
+
[source,java,role="primary"]
1482
1661
----
1483
1662
JwtIssuerAuthenticationManagerResolver authenticationManagerResolver = new JwtIssuerAuthenticationManagerResolver
0 commit comments