Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to signin page after failed OIDC login #202

Conversation

DasSkelett
Copy link
Member

Problem

When you want to sign-in to wg-access-server using an OIDC provider, but then abort the process (or it otherwise fails), you end up with a nil AuthSession.Identity.
This makes the ClaimsMiddleware fail, and users see an Internal Server Error. The logs say authz middleware failure: User is not logged in since #194, before they were missing completely.

Changes

Now the AuthMiddleware explicitly checks for the identity not being nil. If it is, it redirects to /signin, the user logging in successfully this time is our best bet at resolving whatever is wrong.

While this is the only possible error case of ClaimsMiddleware right now and can no longer be triggered with the above change, for future-proofing we also redirect to /signin when ClaimsMiddleware encounters errors.

Closes #179 again
Closes #201 probably

@DasSkelett DasSkelett added bug Something isn't working go Pull requests that update Go code labels Jun 15, 2022
@DasSkelett DasSkelett requested a review from awlx June 15, 2022 19:22
@mergeable
Copy link

mergeable bot commented Jun 15, 2022

Thanks for creating a pull request! A maintainer will review your changes shortly. Please don't be discouraged if it takes a while.

Copy link
Member

@awlx awlx left a comment

Choose a reason for hiding this comment

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

Awesome!

@DasSkelett DasSkelett merged commit 36cce5e into freifunkMUC:master Jun 15, 2022
@DasSkelett DasSkelett deleted the fix/missing-identity-after-oidc-failure branch June 15, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5xx after failed auth "internal server error" but nothing in logs or traces
2 participants