Esempio n. 1
0
        public SignalRConnectionInfo GetClientConnectionInfo(string userId, string idToken, string[] claimTypeList)
        {
            IEnumerable <Claim> customerClaims = null;

            if (idToken != null && claimTypeList != null && claimTypeList.Length > 0)
            {
                var jwtToken = new JwtSecurityTokenHandler().ReadJwtToken(idToken);
                customerClaims = from claim in jwtToken.Claims
                                 where claimTypeList.Contains(claim.Type)
                                 select claim;
            }

            var serviceManager = serviceManagerStore.GetOrAddByConnectionString(connectionString).ServiceManager;

            return(new SignalRConnectionInfo
            {
                Url = serviceManager.GetClientEndpoint(hubName),
                AccessToken = serviceManager.GenerateClientAccessToken(
                    hubName, userId, BuildJwtClaims(customerClaims, AzureSignalRUserPrefix).ToList())
            });
        }
Esempio n. 2
0
        public SignalRConnectionInfo GetClientConnectionInfo(string userId, string idToken, string[] claimTypeList)
        {
            var customerClaims = GetCustomClaims(idToken, claimTypeList);
            var serviceManager = serviceManagerStore.GetOrAddByConnectionString(connectionString).ServiceManager;

            return(new SignalRConnectionInfo
            {
                Url = serviceManager.GetClientEndpoint(HubName),
                AccessToken = serviceManager.GenerateClientAccessToken(
                    HubName, userId, BuildJwtClaims(customerClaims, AzureSignalRUserPrefix).ToList())
            });
        }