Skip to content

Commit e6db56a

Browse files
therepanicjgrandja
authored andcommitted
Add a minimal authorization server configuration
Closes gh-18144 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
1 parent b7fb289 commit e6db56a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/modules/ROOT/pages/servlet/oauth2/authorization-server/configuration-model.adoc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
9595

9696
The main intent of `OAuth2AuthorizationServerConfiguration` is to provide a convenient method to apply the minimal default configuration for an OAuth2 authorization server. However, in most cases, customizing the configuration will be required.
9797

98+
The following example shows how you can wire an authorization server with nothing more than an `HttpSecurity` builder while still re-using Spring Boot’s defaults for users and static resources:
99+
100+
[source,java]
101+
----
102+
@Bean
103+
SecurityFilterChain springSecurity(HttpSecurity http) {
104+
http
105+
.authorizeHttpRequests(requests -> requests
106+
.anyRequest().authenticated()
107+
)
108+
.authorizationServer(auth -> auth
109+
.oidc(Customizer.withDefaults())
110+
)
111+
.formLogin(Customizer.withDefaults());
112+
return http.build();
113+
}
114+
----
115+
98116
[[oauth2AuthorizationServer-customizing-the-configuration]]
99117
== Customizing the configuration
100118

0 commit comments

Comments
 (0)