This commit is contained in:
Javier Calvarro Nelson 2018-02-09 14:08:01 -08:00
Родитель 6bb798d2b7
Коммит 025d366b83
1 изменённых файлов: 31 добавлений и 8 удалений

Просмотреть файл

@ -21,7 +21,7 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult SignIn()
{
var redirectUrl = Url.Page("/Index");
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
return Challenge(
new AuthenticationProperties { RedirectUri = redirectUrl },
OpenIdConnectDefaults.AuthenticationScheme
@ -31,12 +31,24 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult SignOut()
{
var callbackUrl = Url.Page("/Account/SignedOut", pageHandler: null, values: null, protocol: Request.Scheme);
var callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
return SignOut(
new AuthenticationProperties { RedirectUri = callbackUrl },
CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme
);
}
[HttpGet]
public IActionResult SignedOut()
{
if (User.Identity.IsAuthenticated)
{
// Redirect to home page if the user is authenticated.
return RedirectToAction(nameof(HomeController.Index), "Home");
}
return View();
}
#elseif (IndividualB2CAuth)
private readonly AzureAdB2COptions _options;
@ -48,7 +60,7 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult SignIn()
{
var redirectUrl = Url.Page("/Index");
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
return Challenge(
new AuthenticationProperties { RedirectUri = redirectUrl },
OpenIdConnectDefaults.AuthenticationScheme
@ -58,7 +70,7 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult ResetPassword()
{
var redirectUrl = Url.Page("/Index");
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.ResetPasswordPolicyId;
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
@ -67,7 +79,7 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult EditProfile()
{
var redirectUrl = Url.Page("/Index");
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.EditProfilePolicyId;
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
@ -76,12 +88,23 @@ namespace Company.WebApplication1.Controllers
[HttpGet]
public IActionResult SignOut()
{
var callbackUrl = Url.Page("/Account/SignedOut", pageHandler: null, values: null, protocol: Request.Scheme);
var callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
return SignOut(
new AuthenticationProperties { RedirectUri = callbackUrl },
CookieAuthenticationDefaults.AuthenticationScheme,
OpenIdConnectDefaults.AuthenticationScheme
);
OpenIdConnectDefaults.AuthenticationScheme);
}
[HttpGet]
public IActionResult SignedOut()
{
if (User.Identity.IsAuthenticated)
{
// Redirect to home page if the user is authenticated.
return RedirectToAction(nameof(HomeController.Index), "Home");
}
return View();
}
#endif