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

Auth/Identity/Templates - External login flow now needs to clear old external cookies #201

Open
HaoK opened this issue Aug 22, 2016 · 0 comments

Comments

@HaoK
Copy link
Member

HaoK commented Aug 22, 2016

Summary:

In 1.0.0 we fixed an infinite redirect issue with all remote authentication middleware (Google/Facebook/OIDC, etc) by changing the behavior of Authenticate for these middleware to forward to the auth middleware specified in SignInScheme (typically a cookie middleware). This caused a regression in identity/template challenge scenarios whenever an external cookie already exists from a previous login attempt (for example, when a user starts an external login flow and then cancels, clicks back, or some error happens).

The root cause is related to how Challenge behavior changes based on whether Authenticate returns something. If it does, Challenge becomes a Forbidden, otherwise it becomes an Unauthorized (see https://github.com/aspnet/Security/blob/d291bb7c249ae989ea848c8ff378186ae42606d1/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs#L338).

Previously, the presence of an old external cookie would not affect the flow, but now the external cookie will block logins and result in Forbidden/Access Denied responses.

As a result, the external cookie needs to be cleared at the start of the login flow.

Related issues:

Infinite redirect issues:
aspnet/Security#667
aspnet/Security#801

Resulting external login flow issue:
aspnet/Identity#915

Template fix:
aspnet/Templates@306fbc6

@HaoK HaoK added this to the 1.0.0 milestone Aug 22, 2016
@aspnet aspnet locked and limited conversation to collaborators Aug 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant