Merge "prevent irregular auth_prefix config in tempauth"
This commit is contained in:
commit
d54a5a93dc
@ -77,7 +77,10 @@ class TempAuth(object):
|
|||||||
self.logger.set_statsd_prefix('tempauth.%s' % (
|
self.logger.set_statsd_prefix('tempauth.%s' % (
|
||||||
self.reseller_prefix if self.reseller_prefix else 'NONE',))
|
self.reseller_prefix if self.reseller_prefix else 'NONE',))
|
||||||
self.auth_prefix = conf.get('auth_prefix', '/auth/')
|
self.auth_prefix = conf.get('auth_prefix', '/auth/')
|
||||||
if not self.auth_prefix:
|
if not self.auth_prefix or not self.auth_prefix.strip('/'):
|
||||||
|
self.logger.warning('Rewriting invalid auth prefix "%s" to '
|
||||||
|
'"/auth/" (Non-empty auth prefix path '
|
||||||
|
'is required)' % self.auth_prefix)
|
||||||
self.auth_prefix = '/auth/'
|
self.auth_prefix = '/auth/'
|
||||||
if self.auth_prefix[0] != '/':
|
if self.auth_prefix[0] != '/':
|
||||||
self.auth_prefix = '/' + self.auth_prefix
|
self.auth_prefix = '/' + self.auth_prefix
|
||||||
|
@ -125,6 +125,8 @@ class TestAuth(unittest.TestCase):
|
|||||||
self.assertEquals(ath.auth_prefix, '/auth/')
|
self.assertEquals(ath.auth_prefix, '/auth/')
|
||||||
ath = auth.filter_factory({'auth_prefix': ''})(app)
|
ath = auth.filter_factory({'auth_prefix': ''})(app)
|
||||||
self.assertEquals(ath.auth_prefix, '/auth/')
|
self.assertEquals(ath.auth_prefix, '/auth/')
|
||||||
|
ath = auth.filter_factory({'auth_prefix': '/'})(app)
|
||||||
|
self.assertEquals(ath.auth_prefix, '/auth/')
|
||||||
ath = auth.filter_factory({'auth_prefix': '/test/'})(app)
|
ath = auth.filter_factory({'auth_prefix': '/test/'})(app)
|
||||||
self.assertEquals(ath.auth_prefix, '/test/')
|
self.assertEquals(ath.auth_prefix, '/test/')
|
||||||
ath = auth.filter_factory({'auth_prefix': '/test'})(app)
|
ath = auth.filter_factory({'auth_prefix': '/test'})(app)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user