diff --git a/TIAMSharedUI/Shared/Components/Navbar.razor b/TIAMSharedUI/Shared/Components/Navbar.razor
index ea807c68..d3f1d198 100644
--- a/TIAMSharedUI/Shared/Components/Navbar.razor
+++ b/TIAMSharedUI/Shared/Components/Navbar.razor
@@ -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 @@
-
+
+
+ -
+
+ Test
+
+
+
+
@if(enableLogin)
{
if (!myUser && enableLogin)
diff --git a/TIAMSharedUI/Shared/Components/Navbar.razor.cs b/TIAMSharedUI/Shared/Components/Navbar.razor.cs
index 933ea38c..2bd889a5 100644
--- a/TIAMSharedUI/Shared/Components/Navbar.razor.cs
+++ b/TIAMSharedUI/Shared/Components/Navbar.razor.cs
@@ -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("/");
diff --git a/TIAMWebApp/Shared/Services/CustomAuthStateProvider.cs b/TIAMWebApp/Shared/Services/CustomAuthStateProvider.cs
index 8fa8fb83..7db78820 100644
--- a/TIAMWebApp/Shared/Services/CustomAuthStateProvider.cs
+++ b/TIAMWebApp/Shared/Services/CustomAuthStateProvider.cs
@@ -14,7 +14,6 @@ namespace TIAMWebApp.Shared.Application.Services
private readonly ISecureStorageHandler _localStorage;
private readonly HttpClient _http;
-
public CustomAuthStateProvider(ISecureStorageHandler localStorage, HttpClient http)
{
@@ -28,30 +27,31 @@ namespace TIAMWebApp.Shared.Application.Services
AuthenticationState state = null;
if (!string.IsNullOrEmpty(userDetailsStr))
{
-
- var userBasicDetail = JsonConvert.DeserializeObject(userDetailsStr);
- //var handler = new JwtSecurityTokenHandler();
- //var jsontoken = handler.ReadToken(userBasicDetail?.AccessToken) as JwtSecurityToken;
- var token = userBasicDetail?.AccessToken;
- var identity = new ClaimsIdentity();
- _http.DefaultRequestHeaders.Authorization = null;
+ var userBasicDetail = JsonConvert.DeserializeObject(userDetailsStr);
- if (!string.IsNullOrEmpty(token))
- {
- identity = new ClaimsIdentity(ParseClaimsFromJwt(token), "jwt");
- _http.DefaultRequestHeaders.Authorization =
- new AuthenticationHeaderValue("Bearer", token.Replace("\"", ""));
- }
+ //var handler = new JwtSecurityTokenHandler();
+ //var jsontoken = handler.ReadToken(userBasicDetail?.AccessToken) as JwtSecurityToken;
+ var token = userBasicDetail?.AccessToken;
+ var identity = new ClaimsIdentity();
+ _http.DefaultRequestHeaders.Authorization = null;
- var user = new ClaimsPrincipal(identity);
- state = new AuthenticationState(user);
+ if (!string.IsNullOrEmpty(token))
+ {
+ identity = new ClaimsIdentity(ParseClaimsFromJwt(token), "jwt");
+ _http.DefaultRequestHeaders.Authorization =
+ new AuthenticationHeaderValue("Bearer", token.Replace("\"", ""));
+ }
- NotifyAuthenticationStateChanged(Task.FromResult(state));
+ var user = new ClaimsPrincipal(identity);
+ state = new AuthenticationState(user);
+
+ NotifyAuthenticationStateChanged(Task.FromResult(state));
}
else
{
state = new AuthenticationState(new ClaimsPrincipal());
+ NotifyAuthenticationStateChanged(Task.FromResult(state));
}
return state;