Skip to content

Commit

Permalink
Fix Middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye authored and hahn-kev committed Dec 15, 2023
1 parent 7a08cab commit f4d2c9a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task InvokeAsync(IMiddlewareContext context)
return;
}

var currUserMembershipDb = projectUsers.FirstOrDefault(projectUser => user.Id == projectUser.UserId || user.Id == projectUser.User.Id);
var currUserMembershipDb = projectUsers.FirstOrDefault(projectUser => user.Id == projectUser.UserId || user.Id == projectUser.User?.Id);
if (currUserMembershipDb is null)
{
// The user was probably removed from the project and it's still in the token
Expand All @@ -66,12 +66,12 @@ public async Task InvokeAsync(IMiddlewareContext context)
private static async Task RefreshUser(IMiddlewareContext context, Guid userId)
{
var lexAuthService = context.Service<LexAuthService>();
context.ScopedContextData = context.ScopedContextData.SetItem(REFRESHED_USER_KEY, true);
context.ContextData[REFRESHED_USER_KEY] = true;
await lexAuthService.RefreshUser(userId, LexAuthConstants.ProjectsClaimType);
}

private static bool UserAlreadyRefreshed(IMiddlewareContext context)
{
return context.ScopedContextData.ContainsKey(REFRESHED_USER_KEY);
return context.ContextData.ContainsKey(REFRESHED_USER_KEY);
}
}

0 comments on commit f4d2c9a

Please sign in to comment.