-
Notifications
You must be signed in to change notification settings - Fork 596
Move Active Authentication Mode into AutomaticAuthenticationHandler #164
Conversation
@@ -60,6 +60,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Authorizat | |||
EndProject | |||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Authorization", "src\Microsoft.AspNet.Authorization\Microsoft.AspNet.Authorization.kproj", "{6AB3E514-5894-4131-9399-DC7D5284ADDB}" | |||
EndProject | |||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Framework.WebEncoders", "..\HttpAbstractions\src\Microsoft.Framework.WebEncoders\Microsoft.Framework.WebEncoders.kproj", "{DD2CE416-765E-4000-A03E-C2FF165DA1B6}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you didn't mean to check in this relative reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll revert the global.json and revert all the sln changes as part of the final squash/merge, they won't make it back to dev
Updated PR, moved ShouldConvertChallengeToForbidden to AutomaticHandler, added a test for cookie/bearer to ensure they don't touch 401's if they weren't authenticated. |
@@ -334,7 +314,7 @@ protected virtual Task ApplyResponseGrantAsync() | |||
|
|||
public virtual void SignIn(ISignInContext context) | |||
{ | |||
SignInIdentityContext = new SignInIdentityContext(context.Principal, new AuthenticationProperties(context.Properties)); | |||
SignInContext = new SignInContext(context.Principal, new AuthenticationProperties(context.Properties)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't SignIn and SignOut also check for an AuthScheme match before doing anything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests verifying that exceptions are thrown (rather than sign in/sign out happening) when wrong auth type is specified
Also fix up 401-403 logic
Add some unit tests
now correctly checks for auth scheme
Merged 775eb5e |
@@ -566,7 +566,7 @@ public override Task<bool> InvokeAsync() | |||
{ | |||
if (ticket.Principal != null) | |||
{ | |||
Request.HttpContext.Response.SignIn(ticket.Properties, ticket.Principal.Identities); | |||
Request.HttpContext.Response.SignIn(ticket.AuthenticationScheme, ticket.Principal, ticket.Properties); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An invalid scheme is used here and makes the OIDC client middleware totally buggy because it cannot delegate the principal persistence to the cookie middleware.
Use Option.SignInScheme
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks, saved me from having to track this down today!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AutomaticAuthenticationHandler
which derives fromAuthenticationHandler<AutomaticAuthenticationOptions>
cc @lodejard @Praburaj @blowdart @Tratcher