Esempio n. 1
0
		void replayAttackPrevention(ProtocolVersion version) {
			ServiceEndpoint ep = getServiceEndpoint(TestSupport.Scenarios.AutoApproval, version);
			Token token = new Token(ep);

			INonceStore store = new ApplicationMemoryStore();
			string serializedToken = token.Serialize(store);
			Token.Deserialize(serializedToken, store);
			Token.Deserialize(serializedToken, store);
		}
Esempio n. 2
0
        void replayAttackPrevention(ProtocolVersion version)
        {
            ServiceEndpoint ep    = getServiceEndpoint(TestSupport.Scenarios.AutoApproval, version);
            Token           token = new Token(ep);

            INonceStore store           = new ApplicationMemoryStore();
            string      serializedToken = token.Serialize(store);

            Token.Deserialize(serializedToken, store);
            Token.Deserialize(serializedToken, store);
        }
Esempio n. 3
0
		/// <summary>
		/// Tests token creation, serialization, and conditional nonce serialization.
		/// </summary>
		void tokenBasics(ProtocolVersion version) {
			ServiceEndpoint ep = getServiceEndpoint(TestSupport.Scenarios.AutoApproval, version);
			Token token = new Token(ep);
			Assert.AreSame(ep, token.Endpoint);
			Assert.IsNotNull(token.Nonce);

			INonceStore store = new ApplicationMemoryStore();
			string serializedToken = token.Serialize(store);

			Token token2 = Token.Deserialize(serializedToken, store);

			Assert.AreEqual(token.Endpoint, token2.Endpoint);
			if (ep.Protocol.Version.Major < 2) {
				Assert.AreEqual(token.Nonce, token2.Nonce);
				Assert.IsNotNull(token2.Nonce);
			} else {
				Assert.IsNull(token2.Nonce);
			}
		}
Esempio n. 4
0
        /// <summary>
        /// Tests token creation, serialization, and conditional nonce serialization.
        /// </summary>
        void tokenBasics(ProtocolVersion version)
        {
            ServiceEndpoint ep    = getServiceEndpoint(TestSupport.Scenarios.AutoApproval, version);
            Token           token = new Token(ep);

            Assert.AreSame(ep, token.Endpoint);
            Assert.IsNotNull(token.Nonce);

            INonceStore store           = new ApplicationMemoryStore();
            string      serializedToken = token.Serialize(store);

            Token token2 = Token.Deserialize(serializedToken, store);

            Assert.AreEqual(token.Endpoint, token2.Endpoint);
            if (ep.Protocol.Version.Major < 2)
            {
                Assert.AreEqual(token.Nonce, token2.Nonce);
                Assert.IsNotNull(token2.Nonce);
            }
            else
            {
                Assert.IsNull(token2.Nonce);
            }
        }