@@ -71,7 +71,23 @@ server to use it other than setting ``AUTH_REQUIRED`` to ``True``.
7171 or password so it is strongly advised to only use Basic Auth over
7272 HTTPS.
7373
74- .. warning :: add example
74+ **Example **
75+
76+ .. code :: python
77+
78+ AUTH_REQUIRED = True
79+ SECRET_KEY = ' something-secret'
80+ AUTH_PROVIDER = ' basic'
81+ SIGNUP_ENABLED = True
82+ ALLOWED_EMAIL_DOMAINS = [' example.com' ]
83+
84+ Users sign up via the web UI or using the CLI::
85+
86+ $ alerta signup --name "Joe Bloggs" --email joe@example.com --password secret
87+
88+ Then login to receive a JWT token::
89+
90+ $ alerta login --username joe@example.com --password secret
7591
7692.. _ldap_auth :
7793
@@ -99,25 +115,34 @@ that multiple LDAP domains can be supported.
99115
100116**Example **
101117
118+ **Example using LDAP_DOMAINS (simple bind) **
119+
102120.. code :: python
103121
104122 AUTH_PROVIDER = ' ldap'
105- LDAP_URL = ' ldap://localhost :389' # replace with your LDAP server
123+ LDAP_URL = ' ldap://ldap.example.com :389'
106124 LDAP_DOMAINS = {
107- ' my-domain.com' : ' uid=%s ,ou=users,dc=my-domain,dc=com'
108- }
109- LDAP_DOMAINS_BASEDN = {
110- ' my-domain.com' : ' dc=my-domain,dc=com'
111- }
112- LDAP_DOMAINS_GROUP = {
113- ' my-domain.com' : ' (&(memberUid={username} )(objectClass=groupOfUniqueNames))'
114- # OR
115- ' my-domain.com' : ' (&(member={userdn} )(objectClass=groupOfUniqueNames))'
116- # OR
117- ' my-domain.com' : ' (&(member={email} )(objectClass=groupOfUniqueNames))'
125+ ' example.com' : ' uid=%s ,ou=users,dc=example,dc=com'
118126 }
119127
120- .. warning :: improve example
128+ **Example using LDAP search (bind + search) **
129+
130+ .. code :: python
131+
132+ AUTH_PROVIDER = ' ldap'
133+ LDAP_URL = ' ldaps://ldap.example.com:636'
134+ LDAP_BIND_USERNAME = ' cn=readonly,dc=example,dc=com'
135+ LDAP_BIND_PASSWORD = ' readonly-password'
136+ LDAP_USER_BASEDN = ' ou=users,dc=example,dc=com'
137+ LDAP_USER_FILTER = ' (uid={username} )'
138+ LDAP_GROUP_BASEDN = ' ou=groups,dc=example,dc=com'
139+ LDAP_GROUP_FILTER = ' (&(member={userdn} )(objectClass=groupOfNames))'
140+ LDAP_GROUP_NAME_ATTR = ' cn'
141+ LDAP_DEFAULT_DOMAIN = ' example.com'
142+ ALLOWED_LDAP_GROUPS = [' alerta-users' , ' alerta-admins' ]
143+
144+ .. note :: The ``LDAP_GROUP_FILTER`` supports ``{username}``, ``{userdn}``
145+ and ``{email} `` placeholders for group membership lookups.
121146
122147A typical user called ``user1 ``, for the example above, would login
123148using an email address of ``user1@my-domain.com `` even if that
0 commit comments