@@ -40,6 +40,11 @@ class TempAuth(object):
40
40
[pipeline:main]
41
41
pipeline = catch_errors cache tempauth proxy-server
42
42
43
+ Set account auto creation to true in proxy-server.conf::
44
+
45
+ [app:proxy-server]
46
+ account_autocreate = true
47
+
43
48
And add a tempauth filter section, such as::
44
49
45
50
[filter:tempauth]
@@ -94,7 +99,6 @@ def __init__(self, app, conf):
94
99
groups = values
95
100
self .users [conf_key .split ('_' , 1 )[1 ].replace ('_' , ':' )] = {
96
101
'key' : key , 'url' : url , 'groups' : values }
97
- self .created_accounts = False
98
102
99
103
def __call__ (self , env , start_response ):
100
104
"""
@@ -116,26 +120,6 @@ def __call__(self, env, start_response):
116
120
will be routed through the internal auth request handler (self.handle).
117
121
This is to handle granting tokens, etc.
118
122
"""
119
- # Ensure the accounts we handle have been created
120
- if not self .created_accounts and self .users :
121
- newenv = {'REQUEST_METHOD' : 'HEAD' , 'HTTP_USER_AGENT' : 'TempAuth' }
122
- for name in ('swift.cache' , 'HTTP_X_TRANS_ID' ):
123
- if name in env :
124
- newenv [name ] = env [name ]
125
- for key , value in self .users .iteritems ():
126
- account_id = value ['url' ].rsplit ('/' , 1 )[- 1 ]
127
- newenv ['REQUEST_METHOD' ] = 'HEAD'
128
- resp = Request .blank ('/v1/' + account_id ,
129
- environ = newenv ).get_response (self .app )
130
- if resp .status_int // 100 != 2 :
131
- newenv ['REQUEST_METHOD' ] = 'PUT'
132
- resp = Request .blank ('/v1/' + account_id ,
133
- environ = newenv ).get_response (self .app )
134
- if resp .status_int // 100 != 2 :
135
- raise Exception ('Could not create account %s for user '
136
- '%s' % (account_id , key ))
137
- self .created_accounts = True
138
-
139
123
if env .get ('PATH_INFO' , '' ).startswith (self .auth_prefix ):
140
124
return self .handle (env , start_response )
141
125
s3 = env .get ('HTTP_AUTHORIZATION' )
0 commit comments