@@ -6,13 +6,11 @@ Auth Server and Middleware
6
6
Creating Your Own Auth Server and Middleware
7
7
--------------------------------------------
8
8
9
- The included swift/auth/server.py and swift/common/middleware/auth.py are good
10
- minimal examples of how to create an external auth server and proxy server auth
11
- middleware. Also, see swift/common/middleware/swauth.py for
12
- a more complete implementation. The main points are that the auth middleware
13
- can reject requests up front, before they ever get to the Swift Proxy
14
- application, and afterwards when the proxy issues callbacks to verify
15
- authorization.
9
+ The included swift/common/middleware/swauth.py is a good example of how to
10
+ create an auth subsystem with proxy server auth middleware. The main points are
11
+ that the auth middleware can reject requests up front, before they ever get to
12
+ the Swift Proxy application, and afterwards when the proxy issues callbacks to
13
+ verify authorization.
16
14
17
15
It's generally good to separate the authentication and authorization
18
16
procedures. Authentication verifies that a request actually comes from who it
@@ -29,7 +27,7 @@ specific information, it just passes it along. Convention has
29
27
environ['REMOTE_USER'] set to the authenticated user string but often more
30
28
information is needed than just that.
31
29
32
- The included DevAuth will set the REMOTE_USER to a comma separated list of
30
+ The included Swauth will set the REMOTE_USER to a comma separated list of
33
31
groups the user belongs to. The first group will be the "user's group", a group
34
32
that only the user belongs to. The second group will be the "account's group",
35
33
a group that includes all users for that auth account (different than the
@@ -39,7 +37,7 @@ will be omitted.
39
37
40
38
It is highly recommended that authentication server implementers prefix their
41
39
tokens and Swift storage accounts they create with a configurable reseller
42
- prefix (`AUTH_ ` by default with the included DevAuth ). This prefix will avoid
40
+ prefix (`AUTH_ ` by default with the included Swauth ). This prefix will avoid
43
41
conflicts with other authentication servers that might be using the same
44
42
Swift cluster. Otherwise, the Swift cluster will have to try all the resellers
45
43
until one validates a token or all fail.
@@ -48,22 +46,20 @@ A restriction with group names is that no group name should begin with a period
48
46
'.' as that is reserved for internal Swift use (such as the .r for referrer
49
47
designations as you'll see later).
50
48
51
- Example Authentication with DevAuth :
49
+ Example Authentication with Swauth :
52
50
53
- * Token AUTH_tkabcd is given to the DevAuth middleware in a request's
51
+ * Token AUTH_tkabcd is given to the Swauth middleware in a request's
54
52
X-Auth-Token header.
55
- * The DevAuth middleware makes a validate token AUTH_tkabcd call to the
56
- external DevAuth server.
57
- * The external DevAuth server validates the token AUTH_tkabcd and discovers
53
+ * The Swauth middleware validates the token AUTH_tkabcd and discovers
58
54
it matches the "tester" user within the "test" account for the storage
59
55
account "AUTH_storage_xyz".
60
- * The external DevAuth server responds with "X-Auth-Groups:
61
- test:tester,test,AUTH_storage_xyz"
56
+ * The Swauth server sets the REMOTE_USER to
57
+ " test:tester,test,AUTH_storage_xyz"
62
58
* Now this user will have full access (via authorization procedures later)
63
59
to the AUTH_storage_xyz Swift storage account and access to containers in
64
60
other storage accounts, provided the storage account begins with the same
65
61
`AUTH_ ` reseller prefix and the container has an ACL specifying at least
66
- one of those three groups returned .
62
+ one of those three groups.
67
63
68
64
Authorization is performed through callbacks by the Swift Proxy server to the
69
65
WSGI environment's swift.authorize value, if one is set. The swift.authorize
@@ -283,11 +279,9 @@ sometimes that's less important than meeting certain ACL requirements.
283
279
Integrating With repoze.what
284
280
----------------------------
285
281
286
- Here's an example of integration with repoze.what, though honestly it just does
287
- what the default swift/common/middleware/auth.py does in a slightly different
288
- way. I'm no repoze.what expert by any stretch; this is just included here to
289
- hopefully give folks a start on their own code if they want to use
290
- repoze.what::
282
+ Here's an example of integration with repoze.what, though honestly I'm no
283
+ repoze.what expert by any stretch; this is just included here to hopefully give
284
+ folks a start on their own code if they want to use repoze.what::
291
285
292
286
from time import time
293
287
0 commit comments