Auth: pass the OIDC issuer through untouched, trailing slash and all
Deploying against the real Authentik turned this up immediately: its issuer ends in a slash, OIDC requires the discovered issuer to match the configured one byte-for-byte, and trimming it made discovery fail every time. The stub in the tests happened to advertise a slashless issuer, so the whole suite passed while the only provider Petal actually talks to could not be reached. The stub now takes its issuer as a knob, and a regression test runs the flow against one that ends in a slash. Claude-Session: https://claude.ai/code/session_016y6gyuHkQXPiEuW8RGQyua
This commit is contained in:
@@ -91,7 +91,11 @@ func (o *OIDC) discover(ctx context.Context) error {
|
||||
if o.provider != nil {
|
||||
return nil
|
||||
}
|
||||
provider, err := oidc.NewProvider(ctx, strings.TrimSuffix(o.opts.IssuerURL, "/"))
|
||||
// The issuer is passed through exactly as configured, trailing slash and
|
||||
// all: OIDC requires the discovered issuer to match the requested one
|
||||
// byte-for-byte, and Authentik's ends in a slash. (go-oidc trims it itself
|
||||
// when building the .well-known URL, so a slash here costs nothing.)
|
||||
provider, err := oidc.NewProvider(ctx, o.opts.IssuerURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user