public void CreateFiltersDelegatingIdentifiers() { Identifier id = GetMockIdentifier(ProtocolVersion.V20, false, true); var rp = CreateRelyingParty(); // First verify that delegating identifiers work Assert.IsTrue(AuthenticationRequest.Create(id, rp, this.realm, this.returnTo, false).Any(), "The delegating identifier should have not generated any results."); // Now disable them and try again. rp.SecuritySettings.RejectDelegatingIdentifiers = true; Assert.IsFalse(AuthenticationRequest.Create(id, rp, this.realm, this.returnTo, false).Any(), "The delegating identifier should have not generated any results."); }
public void DualIdentifierUsedOnlyAsOPIdentifierForAuthRequest() { var rp = this.CreateRelyingParty(true); var results = AuthenticationRequest.Create(GetMockDualIdentifier(), rp, this.realm, this.returnTo, false).ToList(); Assert.AreEqual(1, results.Count); Assert.IsTrue(results[0].IsDirectedIdentity); // Also test when dual identiifer support is turned on. rp.SecuritySettings.AllowDualPurposeIdentifiers = true; results = AuthenticationRequest.Create(GetMockDualIdentifier(), rp, this.realm, this.returnTo, false).ToList(); Assert.AreEqual(1, results.Count); Assert.IsTrue(results[0].IsDirectedIdentity); }
private async Task LoginIfNotGuest(GreetingsResponse greetings) { var singleNode = _clientOptions.ConnectionOptions.Nodes.Single(); if (string.IsNullOrEmpty(singleNode.Uri.UserName)) { _clientOptions.LogWriter?.WriteLine("Guest mode, no authentication attempt."); return; } var authenticateRequest = AuthenticationRequest.Create(greetings, singleNode.Uri); await SendRequestWithEmptyResponse(authenticateRequest).ConfigureAwait(false); _clientOptions.LogWriter?.WriteLine($"Authentication request send: {authenticateRequest}"); }
private async Task LoginIfNotGuest(GreetingsResponse greetings) { if (!_clientOptions.ConnectionOptions.Nodes.Any()) { throw new ClientSetupException("There are zero configured nodes, you should provide one"); } var singleNode = _clientOptions.ConnectionOptions.Nodes.Single(); if (string.IsNullOrEmpty(singleNode.Uri.UserName)) { _clientOptions.LogWriter?.WriteLine("Guest mode, no authentication attempt."); return; } var authenticateRequest = AuthenticationRequest.Create(greetings, singleNode.Uri); await SendRequestWithEmptyResponse(authenticateRequest).ConfigureAwait(false); _clientOptions.LogWriter?.WriteLine($"Authentication request send: {authenticateRequest}"); }
public void CreatAuthPacket() { var greetings = Encoding.UTF8.GetBytes("Tarantool 1.6.8 (Binary) e8a5ec82-2fd5-4798-aafa-ac41acabc727 DCHe8DF5IQKb8ZphIRjOxQlMiLjooLtazaUh+SPzXi0="); var uriBuilder = new UriBuilder { Password = "******", UserName = "******" }; var packet = AuthenticationRequest.Create(new GreetingsResponse(greetings), uriBuilder); var msgPackContext = new MsgPackContext(); TarantoolConvertersRegistrator.Register(msgPackContext); var serialzied = MsgPackSerializer.Serialize(packet, msgPackContext); var expected = new byte[] { 0x82, 0x23, 0xa4, 0x74, 0x65, 0x73, 0x74, 0x21, 0x92, 0xa9, 0x63, 0x68, 0x61, 0x70, 0x2d, 0x73, 0x68, 0x61, 0x31, 0xc4, 0x14, 0xd4, 0xe2, 0x10, 0x62, 0x8a, 0xa8, 0xba, 0xb3, 0xa5, 0x25, 0xb0, 0x02, 0x72, 0xd9, 0x13, 0xd7, 0x4f, 0x64, 0x9d, 0x0c, }; serialzied.ShouldBe(expected); }