Update README
This commit is contained in:
parent
5f14f61b9f
commit
11eb7bfe79
33
README.md
33
README.md
@ -3,7 +3,7 @@
|
|||||||
Go Ldap API is an HTTP API to an LDAP backend.
|
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!
|
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:
|
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'
|
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
|
glapi -config glapi.env
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration file
|
## Configuration file
|
||||||
``̀`
|
```
|
||||||
LISTEN="127.0.0.1:8080"
|
LISTEN="127.0.0.1:8080"
|
||||||
LDAP_HOST="ldap://ldap.example.org"
|
LDAP_HOST="ldap://ldap.example.org"
|
||||||
LDAP_BASE_DN="dc=example,dc=org"
|
LDAP_BASE_DN="dc=example,dc=org"
|
||||||
LDAP_USER="cn=yo,dc=example,dc=org"
|
LDAP_USER="cn=yo,dc=example,dc=org"
|
||||||
LDAP_PASS='here_is_the_password'
|
LDAP_PASS='here_is_the_password'
|
||||||
DEBUG=false
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Querying API
|
## Querying API
|
||||||
Search LDAP entries through the whole subtree, specifying organizationalUnit, commnName, objectClass, attribute to retrieve.
|
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.
|
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
|
% 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"
|
% curl -u admin:admin "http://127.0.0.1:8080/ALL/ALL/ALL/*,+?format=ldif"
|
||||||
dn: dc=example,dc=org
|
dn: dc=example,dc=org
|
||||||
objectClass: organization
|
objectClass: organization
|
||||||
@ -165,16 +164,17 @@ subschemaSubentry: cn=Subschema
|
|||||||
hasSubordinates: FALSE
|
hasSubordinates: FALSE
|
||||||
|
|
||||||
[...]
|
[...]
|
||||||
`̀``
|
```
|
||||||
|
|
||||||
### Output format
|
### Output format
|
||||||
Default output is in json. The following formats are supported, to be specified as a "format" query parameter:
|
Default output is in json. The following formats are supported:
|
||||||
- json (default)
|
- json (default)
|
||||||
- text (ini style)
|
- text (ini style)
|
||||||
- ldif
|
- ldif
|
||||||
- textvalue (only attribute values are returned)
|
- 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"
|
% 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
|
dn=cn=yo,dc=example.org,ou=domains,dc=example,dc=org
|
||||||
@ -206,14 +206,13 @@ uid: yo
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Select attributes to get
|
### Select attributes to get
|
||||||
You can specify attributes to get by adding them in 4th position :
|
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"
|
% 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
|
cn=yo,dc=example.org,ou=domains,dc=example,dc=org
|
||||||
yo@example.org
|
yo@example.org
|
||||||
|
|
||||||
% curl -u admin:admin "http://127.0.0.1:8080/ou=domains/yo/person/mail?format=textvalue-nodn"
|
% curl -u admin:admin "http://127.0.0.1:8080/ou=domains/yo/person/mail?format=textvalue-nodn"
|
||||||
yo@example.org
|
yo@example.org
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user