public void ProcessRequest(HttpContext context) { SetupDefaultProvider(context); PresenceChannelData channelData = new PresenceChannelData { user_id = socketID, user_info = new BasicUserInfo { name = memberName } }; var helper = new PusherAuthenticationHelper(applicationId, applicationKey, applicationSecret); string authJson = helper.CreateAuthenticatedString(socketID, channelName, channelData); context.Response.Write(authJson); }
public void AuthenticationStringIsCorrectlyFormedForPrivateChannel() { var appId = "1000"; var appKey = "myAppKey"; var appSecret = "myAppSecret"; var channelName = "private-channel"; var socketId = "socket_id"; var helper = new PusherAuthenticationHelper(appId, appKey, appSecret); var expected = helper.CreateAuthenticatedString(socketId, channelName); IPusherProvider provider = new PusherProvider(appId, appKey, appSecret); string auth = provider.Authenticate(channelName, socketId); Assert.IsNotNullOrEmpty(auth); Assert.AreEqual(expected, auth); }
public void AuthenticationStringIsCorrectlyFormedForPresenceChannel() { var appId = "1000"; var appKey = "myAppKey"; var appSecret = "myAppSecret"; var channelName = "presence-channel"; var presenceChannelData = new PresenceChannelData() { user_id = "leggetter", user_info = new { name = "Phil Leggetter", twitter = "@leggetter" } }; var socketId = "socket_id"; var helper = new PusherAuthenticationHelper(appId, appKey, appSecret); string expected = helper.CreateAuthenticatedString(socketId, channelName, presenceChannelData); IPusherProvider provider = new PusherProvider(appId, appKey, appSecret); string auth = provider.Authenticate(channelName, socketId, presenceChannelData); Assert.IsNotNullOrEmpty(auth); Assert.AreEqual(expected, auth); }
public string Authenticate(string channelName, string socketId) { return(_authHelper.CreateAuthenticatedString(socketId, channelName)); }