more pep8
This commit is contained in:
parent
33bddf30e1
commit
0559081967
|
@ -17,6 +17,7 @@ SERVICES:
|
|||
* Echo - A sample service that responds by returning call details
|
||||
|
||||
Also included:
|
||||
|
||||
* Auth_Basic - Stub for WSGI middleware that will be used to handle basic auth
|
||||
* Auth_OpenID - Stub for WSGI middleware that will be used to handle openid auth protocol
|
||||
* RemoteAuth - WSGI middleware that can be used in services (like Swift, Nova, and Glance) when Auth middleware is running remotely
|
||||
|
|
|
@ -57,10 +57,14 @@ class EchoApp(object):
|
|||
return HTTPUnauthorized(self.envr, start_response)
|
||||
|
||||
print ' Received:'
|
||||
if 'HTTP_X_IDENTITY_STATUS' in self.envr: print ' Auth Status:', self.envr['HTTP_X_IDENTITY_STATUS']
|
||||
if 'HTTP_X_AUTHORIZATION' in self.envr: print ' Identity :', self.envr['HTTP_X_AUTHORIZATION']
|
||||
if 'HTTP_X_TENANT' in self.envr: print ' Tenant :', self.envr['HTTP_X_TENANT']
|
||||
if 'HTTP_X_GROUP' in self.envr: print ' Group :', self.envr['HTTP_X_GROUP']
|
||||
if 'HTTP_X_IDENTITY_STATUS' in self.envr:
|
||||
print ' Auth Status:', self.envr['HTTP_X_IDENTITY_STATUS']
|
||||
if 'HTTP_X_AUTHORIZATION' in self.envr:
|
||||
print ' Identity :', self.envr['HTTP_X_AUTHORIZATION']
|
||||
if 'HTTP_X_TENANT' in self.envr:
|
||||
print ' Tenant :', self.envr['HTTP_X_TENANT']
|
||||
if 'HTTP_X_GROUP' in self.envr:
|
||||
print ' Group :', self.envr['HTTP_X_GROUP']
|
||||
|
||||
accept = self.envr.get("HTTP_ACCEPT", "application/json")
|
||||
if accept == "application/xml":
|
||||
|
|
|
@ -106,7 +106,8 @@ class AuthProtocol(object):
|
|||
self.auth_host = conf.get('auth_host')
|
||||
self.auth_port = int(conf.get('auth_port'))
|
||||
self.auth_protocol = conf.get('auth_protocol', 'https')
|
||||
self.auth_location = "%s://%s:%s" % (self.auth_protocol, self.auth_host,
|
||||
self.auth_location = "%s://%s:%s" % (self.auth_protocol,
|
||||
self.auth_host,
|
||||
self.auth_port)
|
||||
|
||||
# Credentials used to verify this component with the Auth service since
|
||||
|
@ -201,12 +202,12 @@ class AuthProtocol(object):
|
|||
else:
|
||||
# Valid token. Get user data and put it in to the call
|
||||
# so the downstream service can use iot
|
||||
dict_response = json.loads(data)
|
||||
token_info = json.loads(data)
|
||||
#TODO(Ziad): make this more robust
|
||||
user = dict_response['auth']['user']['username']
|
||||
tenant = dict_response['auth']['user']['tenantId']
|
||||
group = '%s/%s' % (dict_response['auth']['user']['groups']['group'][0]['id'],
|
||||
dict_response['auth']['user']['groups']['group'][0]['tenantId'])
|
||||
user = token_info['auth']['user']['username']
|
||||
tenant = token_info['auth']['user']['tenantId']
|
||||
first_group = token_info['auth']['user']['groups']['group'][0]
|
||||
group = '%s/%s' % (first_group['id'], first_group['tenantId'])
|
||||
|
||||
# TODO(Ziad): add additional details we may need,
|
||||
# like tenant and group info
|
||||
|
|
|
@ -229,6 +229,7 @@ def delete_token(token_id):
|
|||
## Tenant Operations
|
||||
##
|
||||
|
||||
|
||||
@bottle.route('/v1.0/tenants', method='POST')
|
||||
@wrap_error
|
||||
def create_tenant():
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import os
|
||||
import sys
|
||||
# Need to access identity module
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.abspath( __file__ ), '..', '..', '..', '..', 'keystone')))
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.abspath(__file__),
|
||||
'..', '..', '..', '..', 'keystone')))
|
||||
from keystone import identity
|
||||
import unittest
|
||||
from webtest import TestApp
|
||||
|
@ -970,6 +971,5 @@ class delete_tenant_test(tenant_test):
|
|||
self.assertEqual(204, int(resp['status']))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue