コード例 #1
0
        public async Task WhenExecuteBindRequest(string userName, string password, int messageId)
        {
            var payload = LdapPacketBuilder.NewBindRequest(messageId, 3, userName, (opt) =>
            {
                opt.SetSimpleAuthentication(password);
            }).Serialize().ToArray();

            await Send(payload);
        }
コード例 #2
0
        public void When_Serialize_BindRequest()
        {
            var payload = LdapPacketBuilder.NewBindRequest(1, 3, "administrator", (opt) =>
            {
                opt.SetSimpleAuthentication("password");
            }).Serialize().ToList();
            var ldapPacket       = LdapPacket.Extract(payload);
            var bindRequest      = ldapPacket.ProtocolOperation.Operation as BindRequest;
            var simpleAuthChoice = bindRequest.Authentication as SimpleAuthChoice;

            Assert.NotNull(ldapPacket);
            Assert.Equal(1, ldapPacket.MessageId.Value);
            Assert.Equal(3, bindRequest.Version.Value);
            Assert.Equal("administrator", bindRequest.Name.Value);
            Assert.Equal("password", simpleAuthChoice.Value.Value);
        }