Three modules on Spring Boot 4.1.1 with Spring Authorization Server 7.1.1: the provider
itself, a relying party, and an API that trusts its tokens. Client registration, PKCE,
a custom consent page and token customisation, with profiles that make each failure
reproducible.
Every claim is backed by captured output in docs/output/as-*.txt, regenerated by
authorization-server/scripts/run-all.sh. Notable findings, verified against the jars:
- OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(HttpSecurity) was deleted
in 7.0, and both configuration classes moved into spring-security-config
- ClientSettings.requireProofKey flipped from false to true, on the authorization server
(1.5.8 -> 7.1.1) and on the OAuth2 client (6.5.1 -> 7.1.1)
- requireProofKey(false) does not make PKCE optional for a public client; the code
verifier is that client's only authentication at the token endpoint
- MediaTypeRequestMatcher(TEXT_HTML) matches Accept: */*, so the token endpoint answers
API callers with 302 -> /login unless setIgnoredMediaTypes(ALL) is called
Also renames the repository to spring-auth-demo and cross-links the new chapter set from
the existing documentation.
41 lines
1.8 KiB
Plaintext
41 lines
1.8 KiB
Plaintext
// The configuration every Spring Authorization Server tutorial written before
|
|
// September 2025 tells you to write. It compiled against 1.5.8 and does not compile
|
|
// against 7.1.1. Kept out of the build on purpose - scripts/compile-legacy.sh runs
|
|
// javac against it and captures the real compiler output into
|
|
// docs/output/as-legacy-compile-failure.txt.
|
|
//
|
|
// Three separate breakages in nine lines:
|
|
// 1. the *Configuration class moved out of the SAS jar into spring-security-config
|
|
// 2. the *Configurer class moved AND changed package shape
|
|
// 3. applyDefaultSecurity(HttpSecurity) was deleted outright
|
|
package com.ankurm.authserver.legacy;
|
|
|
|
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration;
|
|
import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.core.Ordered;
|
|
import org.springframework.core.annotation.Order;
|
|
import org.springframework.security.config.Customizer;
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
import org.springframework.security.web.SecurityFilterChain;
|
|
|
|
@Configuration
|
|
public class LegacySasConfig {
|
|
|
|
@Bean
|
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
|
public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http)
|
|
throws Exception {
|
|
|
|
// The 1.x one-liner.
|
|
OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http);
|
|
|
|
http.getConfigurer(OAuth2AuthorizationServerConfigurer.class)
|
|
.oidc(Customizer.withDefaults());
|
|
|
|
return http.build();
|
|
}
|
|
}
|