Skip to content

VoiSmart/eldap_string_filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

EldapStringFilters

An RFC4515 ldap string filter parser

Given an ldap search text filter string in RFC4515 format, parses and converts to a filter suitable to be used by Eldap.

Installation

If available in Hex, the package can be installed by adding eldap_string_filters to your list of dependencies in mix.exs:

def deps do
  [
    {:eldap_string_filters, "~> 0.1.0"}
  ]
end

Docs can be found at https://hexdocs.pm/eldap_string_filters.

Usage

iex> {:ok, filter} = EldapStringFilters.parse("(cn=Foo)")
{:ok, {:equalityMatch, {:AttributeValueAssertion, 'cn', 'Foo'}}}                                                                                                           

iex> {:ok, filter} = EldapStringFilters.parse("(&(|(ou:dn:=People)(:1.2.3.4:=Administration))(objectclass=inetorgperson)(sn=willeke))")
{:ok,
 {:and,
  [
    or: [
      extensibleMatch: {:MatchingRuleAssertion, :asn1_NOVALUE, 'ou', 'People',
       true},
      extensibleMatch: {:MatchingRuleAssertion, '1.2.3.4', :asn1_NOVALUE,
       'Administration', false}
    ],
    equalityMatch: {:AttributeValueAssertion, 'objectclass', 'inetorgperson'},
    equalityMatch: {:AttributeValueAssertion, 'sn', 'willeke'}
  ]}}

About

A parser for RFC4515 ldap string filters for eldap

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages