Skip to content

Commit

Permalink
Added user state to socket interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Feb 3, 2023
1 parent 967365a commit 981104d
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -21,13 +21,17 @@ public class DefaultSocketSessionInterceptor : ISocketSessionInterceptor
CancellationToken cancellationToken = default)
{
var context = session.Connection.HttpContext;
var userState = new UserState(context.User);

requestBuilder.TrySetServices(session.Connection.RequestServices);
requestBuilder.TryAddGlobalState(nameof(CancellationToken), session.Connection.RequestAborted);
requestBuilder.TryAddGlobalState(nameof(HttpContext), context);
requestBuilder.TryAddGlobalState(nameof(ClaimsPrincipal), context.User);
requestBuilder.TryAddGlobalState(nameof(ISocketSession), session);
requestBuilder.TryAddGlobalState(OperationSessionId, operationSessionId);

requestBuilder.TryAddGlobalState(nameof(ClaimsPrincipal), userState.User);
requestBuilder.TryAddGlobalState(WellKnownContextData.UserState, userState);

if (context.IsTracingEnabled())
{
requestBuilder.TryAddGlobalState(EnableTracing, true);
Expand Down

0 comments on commit 981104d

Please sign in to comment.