22
33``` json
44{
5- "account_mapping" : [
6- { "username" : " user-raw" , "password" : " password" , "permissions" : [" +" ]},
7- {
8- "username" : " user-hashlib" ,
9- "password" : " <hashlib>:sha256:salt:291e247d155354e48fec2b579637782446821935fc96a5a08a0b7885179c408b" ,
10- "permissions" : [" +^/$" ]
11- },
12- {
13- "username" : " user-digest" ,
14- "password" : " <digest>:ASGI-WebDAV:c1d34f1e0f457c4de05b7468d5165567" ,
15- "permissions" : [" +^/$" ]
16- },
17- {
18- "username" : " user-ldap" ,
19- "password" : " <ldap>#1#ldaps://your.ldap.server.com#SIMPLE#uid=user-ldap,cn=users,dc=your.ldap.server.com" ,
20- "permissions" : [" +^/$" ]
21- },
22- {
23- "username" : " *" ,
24- "password" : " <ldap>#2#ldaps://your.ldap.server.com#cert_policy=try#uid={username},cn=users,dc=your.ldap.server.com" ,
25- "permissions" : [" +^/$" ]
26- }
27- ]
5+ "account_mapping" : [
6+ { "username" : " user-raw" , "password" : " password" , "permissions" : [" +" ] },
7+ {
8+ "username" : " user-hashlib" ,
9+ "password" : " <hashlib>:sha256:salt:291e247d155354e48fec2b579637782446821935fc96a5a08a0b7885179c408b" ,
10+ "permissions" : [" +^/$" ]
11+ },
12+ {
13+ "username" : " user-digest" ,
14+ "password" : " <digest>:ASGI-WebDAV:c1d34f1e0f457c4de05b7468d5165567" ,
15+ "permissions" : [" +^/$" ]
16+ },
17+ {
18+ "username" : " user-ldap" ,
19+ "password" : " <ldap>#1#ldaps://your.ldap.server.com#SIMPLE#uid=user-ldap,cn=users,dc=your.ldap.server.com" ,
20+ "permissions" : [" +^/$" ]
21+ },
22+ {
23+ "username" : " *ldap " ,
24+ "password" : " <ldap>#2#ldaps://your.ldap.server.com#cert_policy=try#uid={username},cn=users,dc=your.ldap.server.com" ,
25+ "permissions" : [" +^/$" ]
26+ }
27+ ]
2828}
2929```
3030
@@ -37,6 +37,7 @@ user `user-raw`'s password is real password
3737` password ` 's format is ` "<hashlib>:{algorithm}:{salt}:{hashed-password}" `
3838
3939### {algorithm}
40+
4041A list of supported ` {algorithms} ` can be found at [ Python's docs] ( https://docs.python.org/3.10/library/hashlib.html )
4142
4243The commonly used algorithms:
@@ -48,9 +49,11 @@ The commonly used algorithms:
4849- blake2s (optimized for 8- to 32-bit platforms)
4950
5051### {salt}
52+
5153` {salt} ` can be any string
5254
5355### {hashed-password}
56+
5457` {hashed-password} ` 's format is ` ALGORITHM(bytes("{salt}:{password}")).hexdigest() `
5558
5659example:
@@ -59,23 +62,26 @@ example:
5962- {salt}: ` salt `
6063- {password}: ` password `
6164
62- ```
65+ ``` text
6366>>> import hashlib
6467>>> hashlib.new("sha256", "{}:{}".format("salt", "password").encode("utf-8")).hexdigest()
6568'291e247d155354e48fec2b579637782446821935fc96a5a08a0b7885179c408b'
6669```
6770
6871### Ref
6972
70- - https://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions
73+ - < https://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions >
7174
7275## HTTP Digest Mode
76+
7377` password ` 's format is ` <digest>:{realm}:{HA1} `
7478
7579### {realm}
80+
7681` ASGI-WebDAV `
7782
7883### {HA1}
84+
7985` {HA1} ` 's format is ` md5(bytes("{username}:{realm}:{password}")).hexdigest() `
8086
8187example:
@@ -84,26 +90,30 @@ example:
8490- {realm}: ` ASGI-WebDAV `
8591- {password}: ` password `
8692
87- ```
93+ ``` text
8894>>> import hashlib
8995>>> hashlib.new("md5", "{}:{}:{}".format("user-digest", "ASGI-WebDAV", "password").encode("utf-8")).hexdigest()
9096'c1d34f1e0f457c4de05b7468d5165567'
9197```
9298
9399### Ref
100+
94101- [ RFC2617] ( https://datatracker.ietf.org/doc/html/rfc2617 )
95102
96- ## LDAP Mode (experimental)
97- ` password ` 's format is ` "<ldap>#1#{ldap-uri}#{mechanism}#{ldap-user}" `
103+ ## LDAP(v1) (experimental)
104+
105+ ### password format
106+
107+ ``` text
108+ "<ldap>#1#{ldap-uri}#{mechanism}#{ldap-user}"
109+ ```
98110
99111### {ldap-uri}
100112
101113Example:
102114
103115` ldap://your.ldap.server.com ` ` ldaps://your.tls.ldap.server.com `
104116
105- #### Ref
106-
107117- [ Official Website] ( https://ldap.com/ldap-urls/ )
108118- [ RFC4516] ( https://docs.ldap.com/specs/rfc4516.txt )
109119
@@ -119,9 +129,22 @@ Example:
119129
120130` uid=you-name,cn=users,dc=ldap,dc=server,dc=com `
121131
122- ## LDAP fallback
123- Use ` "*" ` as ` username ` to use it as fallback for any user not explicitly set in the configuration file.
124- ` password ` 's format is ` "<ldap_users>#ldaps://{ldap-uri}#{params}#{user-dn-pattern}" ` .
132+ ## LDAP(v2)
133+
134+ ### username
135+
136+ Use ` "*" ` as ` username `
137+
138+ ### password format
139+
140+ ``` text
141+ "<ldap_users>#ldaps://{ldap-uri}#{params}#{user-dn-pattern}"
142+ ```
143+
144+ ### permissions
145+
146+ WARNING:
147+ ` permissions ` will be automatically applied to all ldap accounts.
125148
126149### {ldap-uri}
127150
@@ -140,8 +163,8 @@ This is a query string specifying additional optional settings. Only one is supp
140163
141164` cert_policy ` indicates the policy about server verification. The allowed values are:
142165
143- * ` try ` or ` demand ` : The server cert will be verified, and if it fais, an error will be raised. This is the default.
144- * ` never ` or ` allow ` : The server cert will be used without any verification.
166+ - ` try ` or ` demand ` : The server cert will be verified, and if it fais, an error will be raised. This is the default.
167+ - ` never ` or ` allow ` : The server cert will be used without any verification.
145168
146169Example:
147170
@@ -151,7 +174,6 @@ Example:
151174
152175- [ RFC1866] ( https://datatracker.ietf.org/doc/html/rfc1866 )
153176
154-
155177### {user-dn-pattern}
156178
157179Specify the user DN pattern, with a ` username ` substitution field. Example:
@@ -161,8 +183,9 @@ Specify the user DN pattern, with a `username` substitution field. Example:
161183## Compatibility
162184
163185| | HTTP Basic auth | HTTP Digest auth |
164- | ------------------ | ----------------- | ------------------ |
186+ | ---------------- | --------------- | ---------------- |
165187| Raw Mode | Y | Y |
166188| hashlib Mode | Y | N |
167189| HTTP Digest Mode | Y | Y |
168- | LDAP Mode | Y | N |
190+ | LDAP(v1) | Y | N |
191+ | LDAP(v2) | Y | N |
0 commit comments