1
0
Files
spring-auth-demo/authorization-server/scripts/discovery.sh
Ankur Mhatre e9381dc5be 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:20:38 +05:30

31 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# What the provider advertises, and the difference between the two metadata documents.
set -u
cd "$(dirname "$0")/.."
. scripts/lib.sh
OUT=../docs/output/as-discovery.txt
mkdir -p ../docs/output
{
section "OpenID Connect discovery: GET /.well-known/openid-configuration"
echo "\$ curl -s $AS/.well-known/openid-configuration"
curl -s "$AS/.well-known/openid-configuration" | python3 -m json.tool
section "OAuth2 metadata: GET /.well-known/oauth-authorization-server"
echo "Present even with .oidc(...) switched off. The OIDC document above is the one"
echo "that additionally advertises userinfo_endpoint and id_token signing algorithms."
echo "\$ curl -s $AS/.well-known/oauth-authorization-server"
curl -s "$AS/.well-known/oauth-authorization-server" | python3 -m json.tool
section "JWK Set: GET /oauth2/jwks"
echo "Public keys only. No 'd' member - if you ever see one here, stop the server."
curl -s "$AS/oauth2/jwks" | python3 -m json.tool
section "Resolved endpoint settings, read back from AuthorizationServerSettings"
curl -s "$AS/diag/settings" | python3 -m json.tool
section "Registered clients, as the server actually holds them"
curl -s "$AS/diag/clients" | python3 -m json.tool
} > "$OUT" 2>&1
sed -i 's/[[:space:]]*$//' "$OUT"
echo "wrote $OUT"; wc -l "$OUT"