Paddle
A library simplifying LDAP usage in Elixir projects.
Usage
Once installed and configured, it allows you to quickly authenticate users:
iex> Paddle.authenticate("myUser", "password")
:ok
Get meaningful informations using paddle class objects:
iex> Paddle.get %Paddle.PosixAccount{uid: "myUser"}
{:ok,
[%Paddle.PosixAccount{cn: ["My User"], description: nil,
gecos: ["My User,,,,"], gidNumber: ["120"],
homeDirectory: ["/home/myuser"], host: nil, l: nil,
loginShell: ["/bin/bash"], o: nil, ou: nil, seeAlso: nil, uid: ["myUser"],
uidNumber: ["500"],
userPassword: ["{SSHA}AIzygLSXlArhAMzddUriXQxf7UlkqopP"]}]}
Or just get informations about anything:
iex> Paddle.get base: [ou: "People"], filter: [objectClass: "organizationalUnit"]
{:ok,
[%{"dn" => "ou=People,dc=test,dc=com",
"objectClass" => ["top", "organizationalUnit"], "ou" => ["People"]}]}
Add, delete, modify operations are supported. If you want to know more, just go to the documentation.
Installation
The package can be installed as:
- Add
paddleto your list of dependencies inmix.exs:
def deps do
[{:paddle, "~> 0.1.0"}]
end
- Ensure
paddleis started before your application:
def application do
[applications: [:paddle]]
end
- Add your configuration in your config files:
config :paddle, Paddle,
host: "ldap.my-organisation.org",
base: "dc=myorganisation,dc=org",
ssl: true,
port: 636
For more configurations, see the Paddle module docmumentation.
Testing
If you want to test this application, you can use the linux commands
described in the .travis.yml file in the
before_script block to start a local test LDAP server.
Keep in mind that you may need to change the .travis/ldap/slapd.conf for your system by changing some configuration paths.
If you want to add some more data to the test server, please feel free to issue a pull request.