I have some services on ServiceStack and use SignalR in this project.
And now I would like to protect the hub connection (access only for authenticated users), but I use ServiceStack platform authentication .. (not asp.net authentication) and ServiceStack sessions (write AuthUserId ih this session and authentication flag).
So, when a user tries to connect to a hub, authentication needs to be verified ...
(yes, I can request cookies from the hub (for example, the OnConnected method), but SignalR authenticates in the authorization attribute - and I have to do this in this class (not in the hub)
( http://www.asp.net/signalr/overview/signalr-20/security/hub-authorization )
So I am creating a class
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] public class AuthorizeMyAttribute : AuthorizeAttribute { protected override bool UserAuthorized(System.Security.Principal.IPrincipal user) {
What can I do for this? Thanks!
source share