Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Sep 24, 2024
1 parent 7b6c3d4 commit 6af9c70
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../../Bit.Build.props" />

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
<EnableDefaultItems>false</EnableDefaultItems>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private async void AuthenticationStateChanged(Task<AuthenticationState> task)
}

[LoggerMessage(Level = LogLevel.Information, Message = "Authentication State: {IsUserAuthenticated}, {UserId}, {UserName}, {Email}, {UserSessionId}")]
private static partial void LogAuthenticationState(ILogger logger, bool isUserAuthenticated, string userId, string userName, string? email, string? userSessionId);
private static partial void LogAuthenticationState(ILogger logger, bool isUserAuthenticated, string userId, string userName, string? email, Guid? userSessionId);

//#if (signalr == true)
private async Task ConnectSignalR()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public partial class UserSessionsSection
private bool isLoading;
private bool isWaiting;
private string? message;
private string? currentSessionId;
private Guid? currentSessionId;
private UserSessionDto? currentSession;
private ElementReference messageRef = default!;
private BitColor messageColor = BitColor.Error;
Expand Down Expand Up @@ -37,14 +37,14 @@ private async Task LoadSessions()
finally
{
isLoading = false;
otherSessions = userSessions.Where(s => s.SessionUniqueId.ToString() != currentSessionId);
currentSession = userSessions.SingleOrDefault(s => s.SessionUniqueId.ToString() == currentSessionId);
otherSessions = userSessions.Where(s => s.SessionUniqueId != currentSessionId);
currentSession = userSessions.SingleOrDefault(s => s.SessionUniqueId == currentSessionId);
}
}

private async Task RevokeSession(UserSessionDto session)
{
if (isWaiting || session.SessionUniqueId.ToString() == currentSessionId) return;
if (isWaiting || session.SessionUniqueId == currentSessionId) return;

isWaiting = true;
message = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public static string GetDisplayName(this ClaimsPrincipal claimsPrincipal)
return claimsPrincipal.GetEmail() ?? claimsPrincipal.GetUserName();
}

public static string? GetSessionId(this ClaimsPrincipal claimsPrincipal)
public static Guid? GetSessionId(this ClaimsPrincipal claimsPrincipal)
{
return claimsPrincipal.FindFirst("session-id")?.Value;
return claimsPrincipal.IsAuthenticated()
? Guid.Parse(claimsPrincipal.FindFirst("session-id")!.Value)
: null;
}
}

0 comments on commit 6af9c70

Please sign in to comment.