Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Linq;
- using System.Security.Claims;
- using Microsoft.AspNetCore.SignalR;
- namespace Web.Telephony.Realtime.Services.SignalR
- {
- public class UserIdProvider : IUserIdProvider
- {
- public string GetUserId(HubConnectionContext connection)
- {
- var claimsIdentity = connection.User.Identity as ClaimsIdentity;
- var userId = claimsIdentity?.Claims?.FirstOrDefault(x => x.Type == "sub")?.Value;
- return userId;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement