Skip to content

fix: oidc server error to http status mapping#865

Draft
grvijayan wants to merge 5 commits intomainfrom
fix-server-error-http-status-mapping
Draft

fix: oidc server error to http status mapping#865
grvijayan wants to merge 5 commits intomainfrom
fix-server-error-http-status-mapping

Conversation

@grvijayan
Copy link
Copy Markdown
Contributor

Definition of Ready

  • I am happy with the code
  • Short description of the feature/issue is added in the pr description
  • PR is linked to the corresponding user story
  • Acceptance criteria are met
  • All open todos and follow ups are defined in a new ticket and justified
  • Deviations from the acceptance criteria and design are agreed with the PO and documented.
  • No debug or dead code
  • My code has no repetitions
  • Critical parts are tested automatically
  • Where possible E2E tests are implemented
  • Documentation/examples are up-to-date
  • All non-functional requirements are met
  • Functionality of the acceptance criteria is checked manually on the dev system.

@muhlemmer muhlemmer self-requested a review April 2, 2026 16:44
Comment on lines +225 to +257
func mapVerifierError(err error, description string) error {
oidcErr := new(Error)
if ok := errors.As(err, &oidcErr); ok {
return err
}
switch {
case errors.Is(err, ErrParse):
err = ErrInvalidRequest().WithParent(err).WithDescription("%s", description)
case errors.Is(err, ErrIssuerInvalid),
errors.Is(err, ErrSubjectMissing),
errors.Is(err, ErrAudience),
errors.Is(err, ErrAzpMissing),
errors.Is(err, ErrAzpInvalid),
errors.Is(err, ErrSignatureMissing),
errors.Is(err, ErrSignatureMultiple),
errors.Is(err, ErrSignatureUnsupportedAlg),
errors.Is(err, ErrSignatureInvalidPayload),
errors.Is(err, ErrSignatureInvalid),
errors.Is(err, ErrExpired),
errors.Is(err, ErrIatMissing),
errors.Is(err, ErrIatInFuture),
errors.Is(err, ErrIatToOld),
errors.Is(err, ErrNonceInvalid),
errors.Is(err, ErrAcrInvalid),
errors.Is(err, ErrAuthTimeNotPresent),
errors.Is(err, ErrAuthTimeToOld),
errors.Is(err, ErrAtHash):
err = ErrInvalidGrant().WithParent(err).WithDescription("%s", description)
case errors.Is(err, ErrDiscoveryFailed):
err = ErrServerError().WithParent(err).WithDescription("%s", description)
}
return err
}
Copy link
Copy Markdown
Collaborator

@muhlemmer muhlemmer Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can inline this code into DefaultToServerError. There's another errors.As asserting the type Error type there, we can remove that.

I think we also need to add default to the case switch which still creates a server error as default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants