Beispiel #1
0
        public void Securesession_ShouldGetTheSameSession()
        {
            SecureChannel server = new SecureChannel();

            server.HttpContext         = A.Fake <IHttpContext>();
            server.HttpContext.Request = new ServiceProxyTestHelpers.FormUrlEncodedTestRequest();

            SecureChannelMessage <ClientSessionInfo> one = server.InitSession(new Instant());
            SecureChannelMessage <ClientSessionInfo> two = server.InitSession(new Instant());

            Expect.AreEqual(one.Data.SessionId, two.Data.SessionId, "Session Ids didn't match");
        }
Beispiel #2
0
        public void Securesession_StartSessionShouldCreateSecureSessionEntry()
        {
            SecureChannel server = new SecureChannel();

            server.HttpContext         = A.Fake <IHttpContext>();
            server.HttpContext.Request = new ServiceProxyTestHelpers.FormUrlEncodedTestRequest();

            SecureChannelMessage <ClientSessionInfo> message = server.InitSession(new Instant());
            ClientSessionInfo sessionInfo = message.Data;

            SecureSession created = SecureSession.OneWhere(c => c.Id == sessionInfo.SessionId);

            Expect.IsNotNull(created);
            Expect.IsNotNullOrEmpty(created.Identifier, "Identifier was null or empty");
            Expect.AreEqual(created.Identifier, sessionInfo.ClientIdentifier, "ClientIdentifiers didn't match");
            Expect.AreEqual(sessionInfo.PublicKey, created.PublicKey);
        }
Beispiel #3
0
        public void Securesession_ShouldBeAbleToSetSessionKey()
        {
            InitializeSecureChannelSchema();

            SecureChannel server = new SecureChannel();

            server.HttpContext         = A.Fake <IHttpContext>();
            server.HttpContext.Request = new ServiceProxyTestHelpers.FormUrlEncodedTestRequest();
            SecureChannelMessage <ClientSessionInfo> msg = server.InitSession(new Instant());

            AesKeyVectorPair                kvp;
            SetSessionKeyRequest            request;
            SecureServiceProxyClient <Echo> client = new SecureServiceProxyClient <Echo>("http://localhost:8080");

            client.SessionInfo = msg.Data;
            client.CreateSetSessionKeyRequest(out kvp, out request);

            server.SetSessionKey(request);
        }