Minor updates to CookieAuthenticationHandler and its tests
1. Remove unnecessary variable declaration. 2. Update test name to a more accurate description.
This commit is contained in:
parent
4600451dc6
commit
26a7c7016d
|
|
@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http.Authentication;
|
using Microsoft.AspNetCore.Http.Authentication;
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.AspNetCore.Http.Features.Authentication;
|
using Microsoft.AspNetCore.Http.Features.Authentication;
|
||||||
using Microsoft.Extensions.Primitives;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Authentication.Cookies
|
namespace Microsoft.AspNetCore.Authentication.Cookies
|
||||||
|
|
@ -314,8 +313,6 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
|
||||||
|
|
||||||
if (shouldRedirectToReturnUrl && Response.StatusCode == 200)
|
if (shouldRedirectToReturnUrl && Response.StatusCode == 200)
|
||||||
{
|
{
|
||||||
CookieRedirectContext redirectContext = null;
|
|
||||||
|
|
||||||
// set redirect uri in order:
|
// set redirect uri in order:
|
||||||
// 1. properties.RedirectUri
|
// 1. properties.RedirectUri
|
||||||
// 2. query parameter ReturnUrlParameter
|
// 2. query parameter ReturnUrlParameter
|
||||||
|
|
@ -331,8 +328,8 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
|
||||||
|
|
||||||
if (redirectUri != null)
|
if (redirectUri != null)
|
||||||
{
|
{
|
||||||
redirectContext = new CookieRedirectContext(Context, Options, redirectUri, properties);
|
await Options.Events.RedirectToReturnUrl(
|
||||||
await Options.Events.RedirectToReturnUrl(redirectContext);
|
new CookieRedirectContext(Context, Options, redirectUri, properties));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1100,7 +1100,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task AbsoluteRedirectUriIsRejected()
|
public async Task AbsoluteRedirectUriInQueryStringIsRejected()
|
||||||
{
|
{
|
||||||
var options = new CookieAuthenticationOptions
|
var options = new CookieAuthenticationOptions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue