Added the missing account controller. (#41)
This commit is contained in:
Родитель
f8d92482a4
Коммит
096bd04080
|
@ -5,6 +5,7 @@
|
|||
The following issues were addressed with this release
|
||||
|
||||
- Added partitioning to select collections. Please note that this change is a **breaking** change. If you have an existing deployment you will need to delete all collections excepted for the *Environments* collection.
|
||||
- Added the missing account controller to enable the access denied page and sign out capability
|
||||
- Modified the processing restrictions
|
||||
- Maximum dequeue count is now configured to 3
|
||||
- Maximum number of records dequeued is now configured to 14
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CsvHelper" Version="7.1.1" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.SnapshotCollector" Version="1.2.3" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.SnapshotCollector" Version="1.3.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
|
||||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
// -----------------------------------------------------------------------
|
||||
// <copyright file="AccountController.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace Microsoft.Partner.SmartOffice.Controllers
|
||||
{
|
||||
using AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
|
||||
public class AccountController : Controller
|
||||
{
|
||||
//
|
||||
// GET: /Account/SignIn
|
||||
[HttpGet]
|
||||
public IActionResult SignIn()
|
||||
{
|
||||
return Challenge(
|
||||
new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/SignOut
|
||||
[HttpGet]
|
||||
public IActionResult SignOut()
|
||||
{
|
||||
string callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
|
||||
|
||||
return SignOut(new AuthenticationProperties { RedirectUri = callbackUrl },
|
||||
CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme);
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/SignedOut
|
||||
[HttpGet]
|
||||
public IActionResult SignedOut()
|
||||
{
|
||||
if (HttpContext.User.Identity.IsAuthenticated)
|
||||
{
|
||||
// Redirect to home page if the user is authenticated.
|
||||
return RedirectToAction(nameof(HomeController.Index), "Home");
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Account/AccessDenied
|
||||
[HttpGet]
|
||||
public IActionResult AccessDenied()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.SnapshotCollector" Version="1.2.3" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.SnapshotCollector" Version="1.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
|
||||
|
@ -33,4 +33,10 @@
|
|||
<ProjectReference Include="..\SmartOffice.Services\SmartOffice.Services.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Views\Account\AccessDenied.cshtml">
|
||||
<Pack>$(IncludeRazorContentInPack)</Pack>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
@{
|
||||
ViewData["Title"] = "Access Denied";
|
||||
}
|
||||
|
||||
<header>
|
||||
<h1 class="text-danger">Access Denied.</h1>
|
||||
<p class="text-danger">You do not have access to this resource.</p>
|
||||
</header>
|
Загрузка…
Ссылка в новой задаче