Add Spring Authorization Server project: OAuth2/OIDC provider, client and resource server
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.
This commit is contained in:
22
authorization-server/scripts/rs-startup-failure.sh
Executable file
22
authorization-server/scripts/rs-startup-failure.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# What happens when the resource server starts and the issuer is not reachable.
|
||||
# Worth capturing because the failure is at STARTUP, not at first request - which means
|
||||
# a provider outage during a rolling deploy takes your API down with it.
|
||||
set -u
|
||||
cd "$(dirname "$0")/.."
|
||||
. scripts/lib.sh
|
||||
OUT=../docs/output/as-rs-startup-failure.txt
|
||||
mkdir -p ../docs/output
|
||||
kill_app ResourceServerApplication 8090
|
||||
kill_app AuthServerApplication 9000
|
||||
sleep 1
|
||||
mvn -B -o -pl resource-server org.springframework.boot:spring-boot-maven-plugin:run \
|
||||
> /tmp/rs-fail.log 2>&1 || true
|
||||
{
|
||||
echo "# resource-server started with spring.security.oauth2.resourceserver.jwt.issuer-uri"
|
||||
echo "# pointing at an authorization server that is not running."
|
||||
echo
|
||||
grep -E '^Caused by|Unable to resolve the Configuration' /tmp/rs-fail.log \
|
||||
| sed 's/^Caused by: //' | head -8
|
||||
} > "$OUT"
|
||||
cat "$OUT"
|
||||
Reference in New Issue
Block a user