1
0
Files
spring-auth-demo/authorization-server/scripts/settings-defaults.sh
Ankur Mhatre 38c0a5f358 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.
2026-08-24 08:12:36 +05:30

61 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Compiles one tiny program twice - once against Spring Authorization Server 1.5.8, once
# against 7.1.1 - and prints the defaults each version hands you. This is how the
# requireProofKey change was found; no documentation was involved.
set -u
cd "$(dirname "$0")/.."
OUT=../docs/output/as-settings-defaults.txt
mkdir -p ../docs/output
WORK=$(mktemp -d); trap 'rm -rf "$WORK"' EXIT
mkdir -p "$WORK/old"
fetch() { # group artifact version
curl -sL -o "$WORK/old/$2-$3.jar" \
"https://repo1.maven.org/maven2/$1/$2/$3/$2-$3.jar"
}
for a in spring-security-oauth2-authorization-server:1.5.8 spring-security-oauth2-core:6.5.1 \
spring-security-oauth2-jose:6.5.1 spring-security-core:6.5.1 \
spring-security-oauth2-client:6.5.1 spring-security-web:6.5.1; do
fetch org/springframework/security "${a%%:*}" "${a##*:}"
done
for a in spring-core:6.2.7 spring-jcl:6.2.7; do
fetch org/springframework "${a%%:*}" "${a##*:}"
done
mvn -B -q -pl auth-server dependency:build-classpath \
-Dmdep.outputFile=/tmp/as-cp.txt -DincludeScope=compile >/dev/null 2>&1
CP_NEW=$(cat /tmp/as-cp.txt)
CP_OLD=$(ls "$WORK"/old/*.jar | tr '\n' ':')
{
echo "# Defaults of ClientSettings.builder().build() and TokenSettings.builder().build(),"
echo "# read out of the jars themselves rather than from documentation."
echo "# Source: tools/SettingsDefaults.java"
echo
echo "=== Spring Authorization Server 1.5.8 (last release of the standalone project) ==="
javac -nowarn -cp "$CP_OLD" -d "$WORK/out-old" tools/SettingsDefaults.java \
&& java -cp "$CP_OLD:$WORK/out-old" SettingsDefaults
echo
echo "=== Spring Authorization Server 7.1.1 (inside Spring Security, Boot 4.1.1 BOM) ==="
javac -nowarn -cp "$CP_NEW" -d "$WORK/out-new" tools/SettingsDefaults.java \
&& java -cp "$CP_NEW:$WORK/out-new" SettingsDefaults
echo
echo "# The same question on the CLIENT side. Source: tools/ClientPkceDefault.java"
mvn -B -q -pl oidc-client dependency:build-classpath \
-Dmdep.outputFile=/tmp/cl-cp.txt -DincludeScope=compile >/dev/null 2>&1
CP_CLIENT=$(cat /tmp/cl-cp.txt)
echo
echo "=== spring-security-oauth2-client 6.5.1 ==="
javac -nowarn -cp "$CP_OLD" -d "$WORK/co" tools/ClientPkceDefault.java \
&& java -cp "$CP_OLD:$WORK/co" ClientPkceDefault
echo
echo "=== spring-security-oauth2-client 7.1.1 (Boot 4.1.1 BOM) ==="
javac -nowarn -cp "$CP_CLIENT" -d "$WORK/cn" tools/ClientPkceDefault.java \
&& java -cp "$CP_CLIENT:$WORK/cn" ClientPkceDefault
echo
echo "# Both sides flipped in the 7.x line. Spring-to-Spring therefore still works;"
echo "# a 7.1 authorization server in front of a 6.x or hand-rolled client does not."
} > "$OUT" 2>&1
cat "$OUT"