Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Update MVC to Auth 2.0 #6131

Closed
wants to merge 8 commits into from
Closed

Update MVC to Auth 2.0 #6131

wants to merge 8 commits into from

Conversation

HaoK
Copy link
Member

@HaoK HaoK commented Apr 13, 2017

No description provided.

@@ -103,7 +103,7 @@ public ChallengeResult(IList<string> authenticationSchemes, AuthenticationProper

logger.ChallengeResultExecuting(AuthenticationSchemes);

var authentication = context.HttpContext.Authentication;
var authentication = context.HttpContext;
Copy link
Member

Choose a reason for hiding this comment

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

Rename this or get rid of the variable

Copy link
Member

@rynowak rynowak left a comment

Choose a reason for hiding this comment

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

Overall seems straightforward. Lotsa small stuff

@@ -103,7 +103,7 @@ public ForbidResult(IList<string> authenticationSchemes, AuthenticationPropertie

logger.ForbidResultExecuting(AuthenticationSchemes);

var authentication = context.HttpContext.Authentication;
var authentication = context.HttpContext;
Copy link
Member

Choose a reason for hiding this comment

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

Rename this or get rid of the variable

@@ -114,7 +114,8 @@ public ForbidResult(IList<string> authenticationSchemes, AuthenticationPropertie
}
else
{
await authentication.ForbidAsync(Properties);
// TODO: switch to use sugar in: https://github.com/aspnet/HttpAbstractions/pull/815
Copy link
Member

Choose a reason for hiding this comment

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

No TODOs in code

@@ -21,6 +21,7 @@ Microsoft.AspNetCore.Mvc.RouteAttribute</Description>
<ItemGroup>
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.Abstractions\Microsoft.AspNetCore.Mvc.Abstractions.csproj" />

<PackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="$(AspNetCoreVersion)" />
Copy link
Member

Choose a reason for hiding this comment

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

Is this the right package? is there an abstractions package or something less implementationey?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I can switch this to abstractions, but this does pose the question whether AddMVC should be calling AddAuthenticationCore which does live here, otherwise the core services will be missing if no auth was added (maybe ok?)

@@ -88,7 +88,7 @@ public SignInResult(string authenticationScheme, ClaimsPrincipal principal, Auth

logger.SignInResultExecuting(AuthenticationScheme, Principal);

var authentication = context.HttpContext.Authentication;
var authentication = context.HttpContext;
Copy link
Member

Choose a reason for hiding this comment

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

rename

@@ -106,7 +106,7 @@ public SignOutResult(IList<string> authenticationSchemes, AuthenticationProperti

logger.SignOutResultExecuting(AuthenticationSchemes);

var authentication = context.HttpContext.Authentication;
var authentication = context.HttpContext;
Copy link
Member

Choose a reason for hiding this comment

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

rename

@@ -11,7 +11,7 @@
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Mvc.Formatters.Xml\Microsoft.AspNetCore.Mvc.Formatters.Xml.csproj" />
<ProjectReference Include="..\Microsoft.AspNetCore.Mvc.TestConfiguration\Microsoft.AspNetCore.Mvc.TestConfiguration.csproj" />

<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="$(AspNetCoreVersion)" />
<ProjectReference Include="..\..\..\..\Security\src\Microsoft.AspNetCore.Authentication\Microsoft.AspNetCore.Authentication.csproj" />
Copy link
Member

Choose a reason for hiding this comment

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

uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah you can ignore this, security and MVC will go in in the same push party, and I won't merge this file

return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal,
new AuthenticationProperties(), Options.AuthenticationScheme)));
new AuthenticationProperties(), Scheme.Name)));
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this test still testing something meaningful?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, its basically a Mock auth scheme for the functional auth filters test, so somewhat meaningful :)

@rynowak
Copy link
Member

rynowak commented Apr 14, 2017

This method needs to register the authorization services. If that means MVC Core has to depend on Auth Core, then so be it.

Other than that changes look good 👍

@HaoK
Copy link
Member Author

HaoK commented Apr 14, 2017

Ok, added Core back to deps, and call AddAuthenticationCore next to AddAuthorization, will merge these changes in as part of the mega security PR push sometime next week

@HaoK
Copy link
Member Author

HaoK commented Apr 20, 2017

3e8cd1e

@HaoK HaoK closed this Apr 20, 2017
@HaoK HaoK deleted the haok/auth2 branch August 7, 2017 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants