Implement scoped P06 authentication policy and guarded optional onboarding
All checks were successful
Authentication acceptance / acceptance (push) Successful in 1m22s
Authentication acceptance / provider-contract (push) Successful in 14s
Build and Publish Container Image / build-and-push (push) Successful in 41s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a09cbb-87c6-7900-a145-4ce53ba9f1a6
This commit is contained in:
tegwick 2026-09-14 00:00:05 +02:00
parent aa709fb854
commit e0b3c25f06
12 changed files with 1085 additions and 2 deletions

View file

@ -30,6 +30,7 @@ import (
"keycape/internal/domain"
servererrors "keycape/internal/server/errors"
"keycape/internal/server/oidc"
"keycape/internal/server/policy"
"keycape/internal/server/telemetry"
)
@ -172,6 +173,15 @@ func main() {
Issuer: issuer,
Emitter: emitter,
}
if path := os.Getenv("KEYCAPE_POLICY_PATH"); path != "" {
policies, err := policy.Open(path, clients)
if err != nil {
log.Error().Msg("authentication policy store unavailable")
os.Exit(1)
}
authorizeHandler.EffectivePolicy = policies.Effective
mux.Handle("/platform/authentication-policy", policy.Handler(policies, issuer, &privateKey.PublicKey))
}
mux.Handle("/authorize", enforcement.Middleware(authorizeHandler))
mux.Handle("/authorize/callback", authorizeHandler)
mux.Handle("/authorize/return", authorizeHandler)