Merge branch 'release/2.1' into dev
This commit is contained in:
commit
8f005c7a58
|
|
@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.HttpsPolicy;
|
using Microsoft.AspNetCore.HttpsPolicy;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
#if (OrganizationalAuth)
|
#if (OrganizationalAuth)
|
||||||
|
|
@ -54,6 +55,7 @@ namespace Company.WebApplication1
|
||||||
{
|
{
|
||||||
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
||||||
options.CheckConsentNeeded = context => true;
|
options.CheckConsentNeeded = context => true;
|
||||||
|
options.MinimumSameSitePolicy = SameSiteMode.None;
|
||||||
});
|
});
|
||||||
|
|
||||||
#if (IndividualLocalAuth)
|
#if (IndividualLocalAuth)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult SignIn()
|
public IActionResult SignIn()
|
||||||
{
|
{
|
||||||
var redirectUrl = Url.Page("/Index");
|
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
|
||||||
return Challenge(
|
return Challenge(
|
||||||
new AuthenticationProperties { RedirectUri = redirectUrl },
|
new AuthenticationProperties { RedirectUri = redirectUrl },
|
||||||
OpenIdConnectDefaults.AuthenticationScheme
|
OpenIdConnectDefaults.AuthenticationScheme
|
||||||
|
|
@ -31,12 +31,24 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult SignOut()
|
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(
|
return SignOut(
|
||||||
new AuthenticationProperties { RedirectUri = callbackUrl },
|
new AuthenticationProperties { RedirectUri = callbackUrl },
|
||||||
CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme
|
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)
|
#elseif (IndividualB2CAuth)
|
||||||
private readonly AzureAdB2COptions _options;
|
private readonly AzureAdB2COptions _options;
|
||||||
|
|
||||||
|
|
@ -48,7 +60,7 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult SignIn()
|
public IActionResult SignIn()
|
||||||
{
|
{
|
||||||
var redirectUrl = Url.Page("/Index");
|
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
|
||||||
return Challenge(
|
return Challenge(
|
||||||
new AuthenticationProperties { RedirectUri = redirectUrl },
|
new AuthenticationProperties { RedirectUri = redirectUrl },
|
||||||
OpenIdConnectDefaults.AuthenticationScheme
|
OpenIdConnectDefaults.AuthenticationScheme
|
||||||
|
|
@ -58,7 +70,7 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult ResetPassword()
|
public IActionResult ResetPassword()
|
||||||
{
|
{
|
||||||
var redirectUrl = Url.Page("/Index");
|
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
|
||||||
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
|
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
|
||||||
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.ResetPasswordPolicyId;
|
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.ResetPasswordPolicyId;
|
||||||
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
|
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
|
||||||
|
|
@ -67,7 +79,7 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult EditProfile()
|
public IActionResult EditProfile()
|
||||||
{
|
{
|
||||||
var redirectUrl = Url.Page("/Index");
|
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
|
||||||
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
|
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
|
||||||
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.EditProfilePolicyId;
|
properties.Items[AzureAdB2COptions.PolicyAuthenticationProperty] = _options.EditProfilePolicyId;
|
||||||
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
|
return Challenge(properties, OpenIdConnectDefaults.AuthenticationScheme);
|
||||||
|
|
@ -76,12 +88,23 @@ namespace Company.WebApplication1.Controllers
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult SignOut()
|
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(
|
return SignOut(
|
||||||
new AuthenticationProperties { RedirectUri = callbackUrl },
|
new AuthenticationProperties { RedirectUri = callbackUrl },
|
||||||
CookieAuthenticationDefaults.AuthenticationScheme,
|
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
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
#endif
|
#endif
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.HttpsPolicy;
|
using Microsoft.AspNetCore.HttpsPolicy;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
#if (IndividualLocalAuth)
|
#if (IndividualLocalAuth)
|
||||||
|
|
@ -74,6 +75,7 @@ namespace Company.WebApplication1
|
||||||
{
|
{
|
||||||
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
||||||
options.CheckConsentNeeded = context => true;
|
options.CheckConsentNeeded = context => true;
|
||||||
|
options.MinimumSameSitePolicy = SameSiteMode.None;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue