Exemplo n.º 1
0
        public LdapAttribute(LdapAttributeDescription type, ReadOnlyMemory <byte>[] values)
        {
            if (values is null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            Type   = type;
            Values = values;
        }
Exemplo n.º 2
0
        internal LdapSubstringFilter(ReadOnlySpan <char> description, ReadOnlyMemory <byte>?initial, ReadOnlyMemory <byte>[] any, ReadOnlyMemory <byte>?final)
        {
            if (!initial.HasValue && !final.HasValue && any.Length == 0)
            {
                throw new ArgumentException("at least one part must be set");
            }

            Attribute  = new LdapAttributeDescription(description);
            StartsWith = initial;
            Contains   = any;
            EndsWith   = final;
        }
 internal LdapExtensibleMatchFilter(ReadOnlySpan <char> description, bool isDn, ReadOnlySpan <char> matchingRule, ReadOnlySpan <char> assertion)
 {
     if (!description.IsEmpty)
     {
         Attribute = new LdapAttributeDescription(description);
     }
     IsDnAttribute = isDn;
     if (!matchingRule.IsEmpty)
     {
         MatchingRuleId = matchingRule.Oid();
     }
     Value = assertion.LdapString();
 }
 internal LdapExtensibleMatchFilter(Asn1MatchingRuleAssertion assertion)
 {
     if (assertion.Type.HasValue)
     {
         Attribute = new LdapAttributeDescription(assertion.Type.Value.Span);
     }
     IsDnAttribute = assertion.DNAttributes.GetValueOrDefault();
     if (assertion.MatchingRule.HasValue)
     {
         //RFC 4511 4.1.8 && RFC 4520 3.4
         MatchingRuleId = assertion.MatchingRule.Value.Span.Oid();
     }
     Value = assertion.Value;
 }
Exemplo n.º 5
0
 public LdapAttributeSelection(ReadOnlySpan <char> data)
 {
     if (data.Length == 1 && data[0] == '*')
     {
         AllUserAttributes = true;
     }
     else if (data.Length == 3 && data == "1.1")
     {
         NoAttributes = true;
     }
     else
     {
         Selector = new LdapAttributeDescription(data);
     }
 }
Exemplo n.º 6
0
        internal LdapSubstringFilter(Asn1SubstringFilter filter)
        {
            Attribute = new LdapAttributeDescription(filter.Type.Span);
            var contains = new List <ReadOnlyMemory <byte> >();

            foreach (var substring in filter.Substrings)
            {
                if (substring.Initial.HasValue)
                {
                    StartsWith = substring.Initial.Value;
                }
                else if (substring.Final.HasValue)
                {
                    EndsWith = substring.Final.Value;
                }
                else if (substring.Any.HasValue)
                {
                    contains.Add(substring.Any.Value);
                }
            }
            Contains = contains;
        }
Exemplo n.º 7
0
 internal LdapAttributeAssertion(ReadOnlySpan <char> description, ReadOnlyMemory <byte> value)
 {
     Attribute = new LdapAttributeDescription(description);
     Value     = value;
 }
Exemplo n.º 8
0
 internal LdapAttributeAssertion(Asn1AttributeValueAssertion assertion)
 {
     Attribute = new LdapAttributeDescription(assertion.Description.Span);
     Value     = assertion.Value;
 }
Exemplo n.º 9
0
 internal LdapAttribute(Asn1PartialAttribute attribute)
 {
     Type   = new LdapAttributeDescription(attribute.Type.Span);
     Values = attribute.Values;
 }
Exemplo n.º 10
0
 internal LdapPresentFilter(ReadOnlySpan <char> attribute)
 {
     Attribute = new LdapAttributeDescription(attribute);
 }
Exemplo n.º 11
0
 internal LdapPresentFilter(ReadOnlyMemory <byte> attribute)
 {
     Attribute = new LdapAttributeDescription(attribute.Span);
 }