示例#1
0
        private static void InnerAction(object clientProxy,
                                        Func <IWampAuthorizer, bool> authorizationCheck,
                                        Action action,
                                        Action <WampException> reportError)
        {
            IWampClientProperties wampClientProxy = clientProxy as IWampClientProxy;
            IWampAuthorizer       authorizer      = wampClientProxy.Authorizer;

            try
            {
                bool isAuthorized = authorizationCheck(authorizer);

                if (isAuthorized)
                {
                    action();
                }
                else
                {
                    reportError(new WampException(WampErrors.NotAuthorized));
                }
            }
            catch (WampException ex)
            {
                reportError(ex);
            }
        }
 public void SetAuthorizer(IWampAuthorizer authorizer)
 {
     base.Authorizer = authorizer;
 }
 public AnonymousWampSessionAuthenticator()
 {
     _authorizer = AnonymousAuthorizer.Instance;
 }
示例#4
0
 public TicketSessionAuthenticator(string authenticationId, string ticket, IWampAuthorizer authorizer)
 {
     AuthenticationId = authenticationId;
     _mTicket         = ticket;
     _authorizer      = authorizer;
 }
 public AnonymousWampSessionAuthenticator()
 {
     _authorizer = new AnonymousWampAuthorizer();
 }