From 11eb7bfe7953c57b6011500f239eca40d9035cb0 Mon Sep 17 00:00:00 2001 From: yo Date: Sat, 8 Oct 2022 19:05:54 +0200 Subject: [PATCH] Update README --- README.md | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9477d1b..703d64b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Go Ldap API is an HTTP API to an LDAP backend. Only supporting read at the moment, maybe one day it will write, and break LDAP backends with ease and joy! -## Usage +## Usage Start glapi with parameters on command line: ``` glapi -ldap-host ldap://ldap.example.org -ldap-base-dn dc=example,dc=org -ldap-user cn=yo,dc=example,dc=org -ldap-pass 'here_is_the_password' @@ -14,20 +14,19 @@ or point it to a configuration file : glapi -config glapi.env ``` -## Configuration file -``̀` +## Configuration file +``` LISTEN="127.0.0.1:8080" LDAP_HOST="ldap://ldap.example.org" LDAP_BASE_DN="dc=example,dc=org" LDAP_USER="cn=yo,dc=example,dc=org" LDAP_PASS='here_is_the_password' -DEBUG=false ``` -## Querying API -Search LDAP entries through the whole subtree, specifying organizationalUnit, commnName, objectClass, attribute to retrieve. -Each one of these parameters can be replaced by "ALL" to act like a wildcard. -``̀` +## Querying API +Search LDAP entries through the whole subtree, specifying organizationalUnit, commnName, objectClass, attribute to retrieve. +Each of these parameters can be replaced by "ALL" to act like a wildcard. +``` % curl -u admin:admin http://127.0.0.1:8080/ou=domains/yo/person | jq [ { @@ -128,8 +127,8 @@ userPassword: {SSHA}edited [...] ``` -Get operational attributes with "*,+" in attribute : -``̀` +Add operational attributes with "*,+": +``` % curl -u admin:admin "http://127.0.0.1:8080/ALL/ALL/ALL/*,+?format=ldif" dn: dc=example,dc=org objectClass: organization @@ -165,16 +164,17 @@ subschemaSubentry: cn=Subschema hasSubordinates: FALSE [...] -`̀`` +``` -### Output format -Default output is in json. The following formats are supported, to be specified as a "format" query parameter: +### Output format +Default output is in json. The following formats are supported: - json (default) - text (ini style) - ldif - textvalue (only attribute values are returned) -- textvalue-nodn ((only attribute values, no dn added, no linefeed between entries. To be used by Rspamd multimap module) +- textvalue-nodn (only attribute values, no dn, no linefeed between entries. Made for Rspamd multimap module) +Specify with "format" query parameter: ``` % curl -u admin:admin "http://127.0.0.1:8080/ou=domains/yo/person?format=text" dn=cn=yo,dc=example.org,ou=domains,dc=example,dc=org @@ -206,14 +206,13 @@ uid: yo ``` -### Select attributes to get -You can specify attributes to get by adding them in 4th position : -̀``` +### Select attributes to get +You can select attributes to get by adding them in 4th position : +``` % curl -u admin:admin "http://127.0.0.1:8080/ou=domains/yo/person/mail?format=textvalue" cn=yo,dc=example.org,ou=domains,dc=example,dc=org yo@example.org % curl -u admin:admin "http://127.0.0.1:8080/ou=domains/yo/person/mail?format=textvalue-nodn" yo@example.org - ```