Skip to content

Commit

Permalink
Fix front end authorization being non-existent
Browse files Browse the repository at this point in the history
  • Loading branch information
CorruptComputer committed Nov 9, 2024
1 parent 111a123 commit 7db5d5d
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Docs/Bones Docs/.obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"state": {
"type": "markdown",
"state": {
"file": "Development/Deployment of Frontend on Cloudflare Pages.md",
"file": "Development/Deployment of Backend on Fedora Server.md",
"mode": "source",
"source": true
},
"icon": "lucide-file",
"title": "Deployment of Frontend on Cloudflare Pages"
"title": "Deployment of Backend on Fedora Server"
}
}
]
Expand Down Expand Up @@ -166,8 +166,8 @@
},
"active": "63538227fcb0a17d",
"lastOpenFiles": [
"Development/Deployment of Backend on Fedora Server.md",
"Development/Deployment of Frontend on Cloudflare Pages.md",
"Development/Deployment of Backend on Fedora Server.md",
"Development/Feature Areas/Account Management.md",
"Development/Overview.md",
"Development/Feature Areas/Asset Management.md",
Expand Down
2 changes: 1 addition & 1 deletion Frontend/Bones.WebUI.Leaflet/Models/GridLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public abstract class GridLayer : Layer
/// <summary>
/// If set, tiles will only be loaded inside the set.
/// </summary>
public ValueTuple<LatLon, LatLon>? Bounds { get; set; }
public (LatLon, LatLon)? Bounds { get; set; }
}
4 changes: 1 addition & 3 deletions Frontend/Bones.WebUI/Components/Auth/RedirectToLogin.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<!-- Adding this here lets us use it on any page or component -->

@code {
/// <inheritdoc />
protected override void OnInitialized()
Expand All @@ -12,6 +10,6 @@
loginUrl += $"?returnUrl={Uri.EscapeDataString(baseRelativePath)}";
}

NavManager.NavigateTo(loginUrl, true);
NavManager.NavigateTo(loginUrl, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ public override async Task<AuthenticationState> GetAuthenticationStateAsync()

if (currentUser == null)
{
return new(new(new ClaimsIdentity()));
return new(new());
}

Claim[] claims = [
new(BonesClaimTypes.User.EMAIL, currentUser.Email ?? string.Empty),
new(BonesClaimTypes.User.DISPLAY_NAME, currentUser.DisplayName ?? string.Empty)
];

AuthenticationState authenticationState = new(new(new ClaimsIdentity(claims, authenticationType: nameof(BonesAuthenticationStateProvider))));

return authenticationState;

return new(new(new ClaimsIdentity(claims, authenticationType: nameof(BonesAuthenticationStateProvider))));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Frontend/Bones.WebUI/Pages/Account/ChangeEmailPage.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@attribute [Route(FrontEndUrls.Account.CHANGE_EMAIL)]
@layout MainLayout
@layout AuthenticatedLayout

<h3>ChangeEmailPage</h3>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@attribute [Route(FrontEndUrls.Account.CHANGE_PASSWORD)]
@layout MainLayout
@layout AuthenticatedLayout

<h3>ChangePasswordPage</h3>

Expand Down
1 change: 1 addition & 0 deletions Frontend/Bones.WebUI/Pages/Account/MyProfilePage.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@attribute [Route(FrontEndUrls.Account.MY_PROFILE)]
@layout AuthenticatedLayout

<h3>MyProfile</h3>

Expand Down
2 changes: 1 addition & 1 deletion Frontend/Bones.WebUI/Pages/RequiresLogin.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/RequiresLogin"
@layout MainLayout
@layout AuthenticatedLayout

<h3>RequiresLogin</h3>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@attribute [Route(FrontEndUrls.SystemAdmin.DASHBOARD)]
@layout MainLayout
@layout AuthenticatedLayout

<h3>SysAdminDashboard</h3>

Expand Down
2 changes: 1 addition & 1 deletion Frontend/Bones.WebUI/Pages/TestMapPage.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/TestMapPage"
@using Bones.WebUI.Components.Leaflet
@layout MainLayout
@layout AuthenticatedLayout

<PageTitle>Test Map Page</PageTitle>
<MudText Typo="Typo.h5">Test Map Page</MudText>
Expand Down

0 comments on commit 7db5d5d

Please sign in to comment.