Added automatic token refresh feature and login page
This commit is contained in:
@@ -6,11 +6,9 @@
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<AuthorizedView Permissions="@permissions">
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
</AuthorizedView>
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@page "/"
|
||||
@using HopFrame.Security.Claims
|
||||
@using HopFrame.Web.Components
|
||||
|
||||
<AuthorizedView RedirectIfUnauthorized="login"/>
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using FrontendTest;
|
||||
using FrontendTest.Components;
|
||||
using HopFrame.Security.Authentication;
|
||||
using HopFrame.Web;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddDbContext<DatabaseContext>();
|
||||
builder.Services.AddHopFrameAuthentication<DatabaseContext>();
|
||||
builder.Services.AddHopFrameServices<DatabaseContext>();
|
||||
|
||||
// Add services to the container.
|
||||
@@ -27,6 +25,8 @@ app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseAntiforgery();
|
||||
app.UseAuthorization();
|
||||
app.UseAuthentication();
|
||||
app.UseMiddleware<AuthMiddleware>();
|
||||
|
||||
app.MapRazorComponents<App>()
|
||||
.AddHopFramePages()
|
||||
|
||||
Reference in New Issue
Block a user