public void AssociateDiffieHellmanOverHttps() { Protocol protocol = Protocol.V20; OpenIdCoordinator coordinator = new OpenIdCoordinator( rp => { // We have to formulate the associate request manually, // since the DNOI RP won't voluntarily use DH on HTTPS. AssociateDiffieHellmanRequest request = new AssociateDiffieHellmanRequest(protocol.Version, new Uri("https://Provider")); request.AssociationType = protocol.Args.SignatureAlgorithm.HMAC_SHA256; request.SessionType = protocol.Args.SessionType.DH_SHA256; request.InitializeRequest(); var response = rp.Channel.Request <AssociateSuccessfulResponse>(request); Assert.IsNotNull(response); Assert.AreEqual(request.AssociationType, response.AssociationType); Assert.AreEqual(request.SessionType, response.SessionType); }, AutoProvider); coordinator.Run(); }
public async Task OPRejectsMismatchingAssociationAndSessionTypes() { Protocol protocol = Protocol.V20; this.RegisterAutoProvider(); var rp = this.CreateRelyingParty(); // We have to formulate the associate request manually, // since the DNOI RP won't voluntarily mismatch the association and session types. var request = new AssociateDiffieHellmanRequest(protocol.Version, OPUri); request.AssociationType = protocol.Args.SignatureAlgorithm.HMAC_SHA256; request.SessionType = protocol.Args.SessionType.DH_SHA1; request.InitializeRequest(); var response = await rp.Channel.RequestAsync <AssociateUnsuccessfulResponse>(request, CancellationToken.None); Assert.IsNotNull(response); Assert.AreEqual(protocol.Args.SignatureAlgorithm.HMAC_SHA1, response.AssociationType); Assert.AreEqual(protocol.Args.SessionType.DH_SHA1, response.SessionType); }
public async Task AssociateDiffieHellmanOverHttps() { Protocol protocol = Protocol.V20; this.RegisterAutoProvider(); var rp = this.CreateRelyingParty(); // We have to formulate the associate request manually, // since the DNOI RP won't voluntarily use DH on HTTPS. var request = new AssociateDiffieHellmanRequest(protocol.Version, OPUri) { AssociationType = protocol.Args.SignatureAlgorithm.HMAC_SHA256, SessionType = protocol.Args.SessionType.DH_SHA256 }; request.InitializeRequest(); var response = await rp.Channel.RequestAsync <AssociateSuccessfulResponse>(request, CancellationToken.None); Assert.IsNotNull(response); Assert.AreEqual(request.AssociationType, response.AssociationType); Assert.AreEqual(request.SessionType, response.SessionType); }