Compare commits

..

2 Commits

Author SHA1 Message Date
Adam 2036b2afab Merge branch 'master' of http://git2.aycode.com/Adam/TourIAm 2024-05-23 10:07:56 +02:00
Adam 42dbf40f5a Authentication fix 2024-05-23 10:06:57 +02:00
3 changed files with 29 additions and 19 deletions

View File

@ -2,6 +2,7 @@
@using TIAMWebApp.Shared.Application.Interfaces
@using AyCode.Interfaces.StorageHandlers
@using Microsoft.Extensions.Localization
@using Microsoft.AspNetCore.Components.Authorization
@ -99,7 +100,15 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<AuthorizeView>
<Authorized>
<li class="nav-item">
<NavLink class="nav-link" href="login">
Test
</NavLink>
</li>
</Authorized>
</AuthorizeView>
@if(enableLogin)
{
if (!myUser && enableLogin)

View File

@ -93,7 +93,8 @@ namespace TIAMSharedUI.Shared.Components
serverResult = await UserDataService.Logout(userBasicDetail.RefreshToken);
}
await SecureStorageHandler.ClearAllSecureStorageAsync();
await AuthStateProvider.GetAuthenticationStateAsync();
var result = await AuthStateProvider.GetAuthenticationStateAsync();
sessionService.User = null;
sessionService.IsAuthenticated = false;
navigationManager.NavigateTo("/");

View File

@ -15,7 +15,6 @@ namespace TIAMWebApp.Shared.Application.Services
private readonly HttpClient _http;
public CustomAuthStateProvider(ISecureStorageHandler localStorage, HttpClient http)
{
_localStorage = localStorage;
@ -52,6 +51,7 @@ namespace TIAMWebApp.Shared.Application.Services
else
{
state = new AuthenticationState(new ClaimsPrincipal());
NotifyAuthenticationStateChanged(Task.FromResult(state));
}
return state;