public void MissingSignedParameter() {
			var cryptoStore = new MemoryCryptoKeyStore();
			byte[] associationSecret = Convert.FromBase64String("rsSwv1zPWfjPRQU80hciu8FPDC+GONAMJQ/AvSo1a2M=");
			string handle = "{634477555066085461}{TTYcIg==}{32}";
			cryptoStore.StoreKey(ProviderAssociationKeyStorage.PrivateAssociationBucket, handle, new CryptoKey(associationSecret, DateTime.UtcNow.AddDays(1)));

			var signer = new ProviderSigningBindingElement(new ProviderAssociationKeyStorage(cryptoStore), new ProviderSecuritySettings());
			var testChannel = new TestChannel(new OpenIdProviderMessageFactory());
			signer.Channel = testChannel;

			var buggyRPMessage = new Dictionary<string, string>() {
				{ "openid.assoc_handle", "{634477555066085461}{TTYcIg==}{32}" },
				{ "openid.claimed_id", "https://openid.stackexchange.com/user/f5e91123-e5b4-43c5-871f-5f276c75d31a" },
				{ "openid.identity", "https://openid.stackexchange.com/user/f5e91123-e5b4-43c5-871f-5f276c75d31a" },
				{ "openid.mode", "check_authentication" },
				{ "openid.op_endpoint", "https://openid.stackexchange.com/openid/provider" },
				{ "openid.response_nonce", "2011-08-01T00:32:10Zvdyt3efw" },
				{ "openid.return_to", "http://openid-consumer.appspot.com/finish?session_id=1543025&janrain_nonce=2011-08-01T00%3A32%3A09ZIPGz7D" },
				{ "openid.sig", "b0Rll6Kt1KKBWWBEg/qBvW3sQYtmhOUmpI0/UREBVZ0=" },
				{ "openid.signed", "claimed_id,identity,assoc_handle,op_endpoint,return_to,response_nonce,ns.sreg,sreg.email,sreg.fullname" },
				{ "openid.sreg.email", "*****@*****.**" },
				{ "openid.sreg.fullname", "Kevin K Montrose" },
			};
			var message = (CheckAuthenticationRequest)testChannel.Receive(buggyRPMessage, new MessageReceivingEndpoint(OPUri, HttpDeliveryMethods.PostRequest));
			var originalResponse = new IndirectSignedResponse(message, signer.Channel);
			signer.ProcessIncomingMessage(originalResponse);
		}
Beispiel #2
0
        public void BindingElementsOrdering()
        {
            IChannelBindingElement transformA = new MockTransformationBindingElement("a");
            IChannelBindingElement transformB = new MockTransformationBindingElement("b");
            IChannelBindingElement sign = new MockSigningBindingElement();
            IChannelBindingElement replay = new MockReplayProtectionBindingElement();
            IChannelBindingElement expire = new StandardExpirationBindingElement();

            Channel channel = new TestChannel(
                new TestMessageFactory(),
                sign,
                replay,
                expire,
                transformB,
                transformA);

            Assert.AreEqual(5, channel.BindingElements.Count);
            Assert.AreSame(transformB, channel.BindingElements[0]);
            Assert.AreSame(transformA, channel.BindingElements[1]);
            Assert.AreSame(replay, channel.BindingElements[2]);
            Assert.AreSame(expire, channel.BindingElements[3]);
            Assert.AreSame(sign, channel.BindingElements[4]);
        }
Beispiel #3
0
 public void TooManyBindingElementsProvidingSameProtection()
 {
     Channel channel = new TestChannel(
         new TestMessageFactory(),
         new MockSigningBindingElement(),
         new MockSigningBindingElement());
     Channel_Accessor accessor = Channel_Accessor.AttachShadow(channel);
     accessor.ProcessOutgoingMessage(new TestSignedDirectedMessage());
 }
Beispiel #4
0
		public void TooManyBindingElementsProvidingSameProtection() {
			Channel channel = new TestChannel(
				new TestMessageFactory(),
				new MockSigningBindingElement(),
				new MockSigningBindingElement());
			channel.ProcessOutgoingMessageTestHook(new TestSignedDirectedMessage());
		}
Beispiel #5
0
		public async Task TooManyBindingElementsProvidingSameProtection() {
			Channel channel = new TestChannel(
				new TestMessageFactory(),
				new IChannelBindingElement[] { new MockSigningBindingElement(), new MockSigningBindingElement() },
				new DefaultOpenIdHostFactories());
			await channel.ProcessOutgoingMessageTestHookAsync(new TestSignedDirectedMessage());
		}