Skip to content

Commit 967a45d

Browse files
committed
fix: Conformance tests & proper handling of iss not supported
1 parent cea90b1 commit 967a45d

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

auth/authorization_code.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,19 @@ func (h *AuthorizationCodeHandler) getAuthorizationCode(ctx context.Context, cfg
565565
//
566566
// [RFC 9207]: https://www.rfc-editor.org/rfc/rfc9207
567567
func validateIssuerResponse(iss, expectedIssuer string, issParameterSupported bool) error {
568-
if iss != "" {
568+
if issParameterSupported {
569+
if iss == "" {
570+
return fmt.Errorf("authorization server advertises RFC 9207 iss parameter support but none was received in the authorization response")
571+
}
569572
if iss != expectedIssuer {
570573
return fmt.Errorf("authorization response issuer %q does not match expected issuer %q", iss, expectedIssuer)
571574
}
572-
} else if issParameterSupported {
573-
return fmt.Errorf("authorization server advertises RFC 9207 iss parameter support but none was received in the authorization response")
575+
} else {
576+
if iss != "" {
577+
return fmt.Errorf("authorization server does not advertise RFC 9207 iss parameter support but iss was received in the authorization response")
578+
}
574579
}
580+
575581
return nil
576582
}
577583

conformance/everything-client/client_private.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ func init() {
4040
"auth/token-endpoint-auth-basic",
4141
"auth/token-endpoint-auth-post",
4242
"auth/token-endpoint-auth-none",
43+
"auth/iss-supported",
44+
"auth/iss-not-advertised",
45+
"auth/iss-supported-missing",
46+
"auth/iss-wrong-issuer",
47+
"auth/iss-unexpected",
4348
}
4449
for _, scenario := range authScenarios {
4550
registerScenario(scenario, runAuthClient)

0 commit comments

Comments
 (0)