Auth added to blazor
This commit is contained in:
19
Web/Pages/Login.cshtml
Normal file
19
Web/Pages/Login.cshtml
Normal file
@@ -0,0 +1,19 @@
|
||||
@page
|
||||
@model Web.Pages.Login
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
20
Web/Pages/Login.cshtml.cs
Normal file
20
Web/Pages/Login.cshtml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Web.Pages
|
||||
{
|
||||
public class Login : PageModel
|
||||
{
|
||||
// Can't be put into a razor page
|
||||
public async Task OnGet(string redirectUri)
|
||||
{
|
||||
await HttpContext.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties()
|
||||
{
|
||||
RedirectUri = redirectUri
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Web/Pages/Logout.cshtml
Normal file
19
Web/Pages/Logout.cshtml
Normal file
@@ -0,0 +1,19 @@
|
||||
@page
|
||||
@model Web.Pages.Logout
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
16
Web/Pages/Logout.cshtml.cs
Normal file
16
Web/Pages/Logout.cshtml.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace Web.Pages
|
||||
{
|
||||
public class Logout : PageModel
|
||||
{
|
||||
public async Task<IActionResult> OnGet()
|
||||
{
|
||||
await HttpContext.SignOutAsync();
|
||||
return Redirect("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user