Exemple #1
0
		internal override bool TryRequireSsl(out Identifier secureIdentifier) {
			// We take special care to make our wrapped identifier secure, but still
			// return a mocked (secure) identifier.
			Identifier secureWrappedIdentifier;
			bool result = wrappedIdentifier.TryRequireSsl(out secureWrappedIdentifier);
			secureIdentifier = new MockIdentifier(secureWrappedIdentifier, endpoints);
			return result;
		}
Exemple #2
0
        internal override bool TryRequireSsl(out Identifier secureIdentifier)
        {
            // We take special care to make our wrapped identifier secure, but still
            // return a mocked (secure) identifier.
            Identifier secureWrappedIdentifier;
            bool       result = wrappedIdentifier.TryRequireSsl(out secureWrappedIdentifier);

            secureIdentifier = new MockIdentifier(secureWrappedIdentifier, endpoints);
            return(result);
        }
 public void CreateRequestStripsFragment()
 {
     var consumer = TestSupport.CreateRelyingParty(null);
     UriBuilder userSuppliedIdentifier = new UriBuilder((Uri)TestSupport.GetIdentityUrl(TestSupport.Scenarios.AutoApproval, ProtocolVersion.V20));
     userSuppliedIdentifier.Fragment = "c";
     Identifier mockIdentifer = new MockIdentifier(userSuppliedIdentifier.Uri,
         TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, ProtocolVersion.V20).Discover());
     Assert.IsTrue(mockIdentifer.ToString().EndsWith("#c"), "Test broken");
     IAuthenticationRequest request = consumer.CreateRequest(mockIdentifer, TestSupport.Realm, TestSupport.ReturnTo);
     Assert.AreEqual(0, new Uri(request.ClaimedIdentifier).Fragment.Length);
 }
        public void UnsolicitedAssertionWithRequireSslWithSecureIdentityButInsecureProviderEndpoint()
        {
            MockHttpRequest.Reset();
            Mocks.MockHttpRequest.RegisterMockRPDiscovery();
            TestSupport.Scenarios scenario = TestSupport.Scenarios.AutoApproval;
            ProtocolVersion version = ProtocolVersion.V20;
            ServiceEndpoint providerEndpoint = TestSupport.GetServiceEndpoint(scenario, version, 10, false);
            Identifier claimedId = new MockIdentifier(TestSupport.GetIdentityUrl(scenario, version, true),
                new ServiceEndpoint[] { providerEndpoint });
            Identifier localId = TestSupport.GetDelegateUrl(scenario, true);

            OpenIdProvider op = TestSupport.CreateProvider(null, false);
            IResponse assertion = op.PrepareUnsolicitedAssertion(TestSupport.Realm, claimedId, localId);

            var opAuthWebResponse = (Response)assertion;
            var opAuthResponse = (DotNetOpenId.Provider.EncodableResponse)opAuthWebResponse.EncodableMessage;
            var rp = TestSupport.CreateRelyingParty(TestSupport.RelyingPartyStore, opAuthResponse.RedirectUrl,
                opAuthResponse.EncodedFields.ToNameValueCollection());
            rp.Settings.RequireSsl = true;

            Assert.AreEqual(AuthenticationStatus.Failed, rp.Response.Status);
            Assert.IsNull(rp.Response.ClaimedIdentifier);
        }