public override void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra)
        {
            IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;

            IWampSessionAuthenticator authenticator = wampClient.Authenticator;

            try
            {
                authenticator.Authenticate(signature, extra);

                if (authenticator.IsAuthenticated)
                {
                    OnClientAuthenticated(wampClient, wampClient.HelloDetails);
                }
                else
                {
                    SendAbort(client,
                              new WampAuthenticationException(new AbortDetails(),
                                                              WampErrors.AuthorizationFailed));
                }
            }
            catch (WampAuthenticationException ex)
            {
                SendAbort(client, ex);
            }
        }
 private static void SendAbort(IWampSessionClient client, WampAuthenticationException ex)
 {
     using (IDisposable disposable = client as IDisposable)
     {
         client.Abort(ex.Details, ex.Reason);
     }
 }
Exemplo n.º 3
0
        public virtual void Goodbye(IWampSessionClient client, GoodbyeDetails details, string reason)
        {
            IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;

            if (!wampClient.GoodbyeSent)
            {
                wampClient.SendGoodbye(details, WampErrors.CloseNormal);
            }
        }
Exemplo n.º 4
0
        public virtual void Abort(IWampSessionClient client, AbortDetails details, string reason)
        {
            using (IDisposable disposable = client as IDisposable)
            {
                IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;

                wampClient.GoodbyeSent = true;
                wampClient.Realm.Abort(wampClient.Session, details, reason);
            }
        }
Exemplo n.º 5
0
        public virtual void Goodbye(IWampSessionClient client, GoodbyeDetails details, string reason)
        {
            using (IDisposable disposable = client as IDisposable)
            {
                client.Goodbye(details, WampErrors.CloseNormal);

                IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;
                wampClient.GoodbyeSent = true;
                wampClient.Realm.Goodbye(wampClient.Session, details, reason);
            }
        }
Exemplo n.º 6
0
        protected IWampClientProxy <TMessage> GetWampClient(IWampSessionClient client, string realm, HelloDetails details)
        {
            IWampClientProxy <TMessage> wampClient = client as IWampClientProxy <TMessage>;

            IWampBindedRealm <TMessage> bindedRealm = RealmContainer.GetRealmByName(realm);

            wampClient.HelloDetails = details;

            details.TransportDetails = wampClient.TransportDetails;

            wampClient.Realm = bindedRealm;

            return(wampClient);
        }
        public override void Hello(IWampSessionClient client, string realm, HelloDetails details)
        {
            IWampClientProxy <TMessage> wampClient = GetWampClient(client, realm, details);

            WampPendingClientDetails clientDetails = new WampPendingClientDetails()
            {
                HelloDetails = details,
                Realm        = realm,
                SessionId    = wampClient.Session
            };

            try
            {
                IWampSessionAuthenticator authenticator =
                    mSessionAuthenticatorFactory.GetSessionAuthenticator
                        (clientDetails,
                        wampClient.Authenticator);

                if (authenticator == null)
                {
                    throw new Exception("Get null authenticator.");
                }

                wampClient.Authenticator = authenticator;

                bool authenticated = authenticator.IsAuthenticated;

                if (authenticated)
                {
                    OnClientAuthenticated(wampClient, details);
                }
                else
                {
                    wampClient.Challenge(authenticator.AuthenticationMethod,
                                         authenticator.ChallengeDetails);
                }
            }
            catch (WampAuthenticationException ex)
            {
                SendAbort(client, ex);
            }
        }
 public void Goodbye(IWampSessionClient client, GoodbyeDetails details, string reason)
 {
 }
 public virtual void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra)
 {
 }
 public virtual void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
 }
 public virtual void Hello(IWampSessionClient client, string realm, HelloDetails details)
 {
 }
 public override void Hello(IWampSessionClient client, string realm, HelloDetails details)
 {
     client.Challenge(mAuthMethod, mDetails);
 }
 public override void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra)
 {
     Extra     = extra;
     Signature = signature;
 }
Exemplo n.º 14
0
 public void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 15
0
 public void Hello(IWampSessionClient client, string realm, HelloDetails details)
 {
     client.Welcome(83782, new WelcomeDetails());
 }
Exemplo n.º 16
0
 public virtual void Authenticate(IWampSessionClient client, string signature, AuthenticateExtraData extra)
 {
     // TODO: disconnect client.
 }
Exemplo n.º 17
0
        public virtual void Hello(IWampSessionClient client, string realm, HelloDetails details)
        {
            IWampClientProxy <TMessage> wampClient = GetWampClient(client, realm, details);

            OnClientJoin(wampClient, details);
        }
Exemplo n.º 18
0
 public void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
     throw new System.NotImplementedException();
 }
 public override void Abort(IWampSessionClient client, AbortDetails details, string reason)
 {
     Reason  = reason;
     Details = details;
 }
Exemplo n.º 20
0
 public void Goodbye(IWampSessionClient client, GoodbyeDetails details, string reason)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 21
0
 public virtual void Goodbye(IWampSessionClient client, GoodbyeDetails details, string reason)
 {
     mSession.Goodbye(client, details, reason);
 }