本文整理汇总了Python中sahara.utils.openstack.base.retrieve_auth_url函数的典型用法代码示例。如果您正苦于以下问题:Python retrieve_auth_url函数的具体用法?Python retrieve_auth_url怎么用?Python retrieve_auth_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了retrieve_auth_url函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _client
def _client(username, password=None, token=None, tenant_name=None,
tenant_id=None, trust_id=None, domain_name=None):
if trust_id and not CONF.use_identity_api_v3:
raise Exception("Trusts aren't implemented in keystone api"
" less than v3")
auth_url = base.retrieve_auth_url(
endpoint_type=CONF.keystone.endpoint_type)
client_kwargs = {'username': username,
'password': password,
'token': token,
'tenant_name': tenant_name,
'tenant_id': tenant_id,
'trust_id': trust_id,
'user_domain_name': domain_name,
'auth_url': auth_url,
'cacert': CONF.keystone.ca_file,
'insecure': CONF.keystone.api_insecure
}
if CONF.use_identity_api_v3:
keystone = keystone_client_v3.Client(**client_kwargs)
keystone.management_url = auth_url
else:
keystone = keystone_client.Client(**client_kwargs)
return keystone
开发者ID:uladz,项目名称:sahara,代码行数:29,代码来源:keystone.py
示例2: token_auth
def token_auth(token, project_id=None, project_name=None,
project_domain_name='Default'):
'''Return a token auth plugin object.
:param token: the token to use for authentication.
:param project_id: the project(ex. tenant) id to scope the auth.
:returns: a token auth plugin object.
'''
token_kwargs = dict(
auth_url=base.retrieve_auth_url(),
token=token
)
if CONF.use_identity_api_v3:
token_kwargs.update(dict(
project_id=project_id,
project_name=project_name,
project_domain_name=project_domain_name,
))
auth = keystone_identity.v3.Token(**token_kwargs)
else:
token_kwargs.update(dict(
tenant_id=project_id,
tenant_name=project_name,
))
auth = keystone_identity.v2.Token(**token_kwargs)
return auth
开发者ID:uladz,项目名称:sahara,代码行数:28,代码来源:keystone.py
示例3: validate_config
def validate_config():
if CONF.use_barbican_key_manager:
# NOTE (elmiko) there is no need to set the api_class as castellan
# uses barbican by default.
castellan.set_defaults(CONF, auth_endpoint=utils.retrieve_auth_url())
else:
castellan.set_defaults(CONF, api_class='sahara.service.castellan.'
'sahara_key_manager.SaharaKeyManager')
开发者ID:Imperat,项目名称:sahara,代码行数:8,代码来源:config.py
示例4: client
def client():
ctx = context.ctx()
args = {
'username': ctx.username,
'project_name': ctx.tenant_name,
'project_id': ctx.tenant_id,
'input_auth_token': ctx.auth_token,
'auth_url': base.retrieve_auth_url(),
'service_catalog_url': base.url_for(ctx.service_catalog, 'share'),
'ca_cert': CONF.manila.ca_file,
'insecure': CONF.manila.api_insecure
}
return manila_client.Client(CONF.manila.api_version, **args)
开发者ID:rsaha,项目名称:sahara,代码行数:13,代码来源:manila.py
示例5: _admin_client
def _admin_client(project_name=None, trust_id=None):
if not CONF.use_identity_api_v3:
raise Exception('Trusts aren\'t implemented in keystone api'
' less than v3')
auth_url = base.retrieve_auth_url()
keystone = keystone_client_v3.Client(username=CONF.os_admin_username,
password=CONF.os_admin_password,
project_name=project_name,
auth_url=auth_url,
trust_id=trust_id)
keystone.management_url = auth_url
return keystone
开发者ID:qinweiwei,项目名称:sahara,代码行数:13,代码来源:keystone.py
示例6: client
def client():
ctx = context.current()
auth_url = base.retrieve_auth_url()
compute_url = base.url_for(ctx.service_catalog, 'compute')
nova = nova_client.Client(username=ctx.username,
api_key=None,
project_id=ctx.tenant_id,
auth_url=auth_url)
nova.client.auth_token = ctx.token
nova.client.management_url = compute_url
nova.images = images.SaharaImageManager(nova)
return nova
开发者ID:AspirinSJL,项目名称:sahara,代码行数:14,代码来源:nova.py
示例7: client
def client():
ctx = context.current()
auth_url = base.retrieve_auth_url()
if CONF.use_identity_api_v3:
keystone = keystone_client_v3.Client(username=ctx.username,
token=ctx.token,
tenant_id=ctx.tenant_id,
auth_url=auth_url)
keystone.management_url = auth_url
else:
keystone = keystone_client.Client(username=ctx.username,
token=ctx.token,
tenant_id=ctx.tenant_id,
auth_url=auth_url)
return keystone
开发者ID:qinweiwei,项目名称:sahara,代码行数:17,代码来源:keystone.py
示例8: _password_auth
def _password_auth(username, password,
project_name=None, user_domain_name=None,
project_domain_name=None, trust_id=None):
'''Return a password auth plugin object.
:param username: the user to authenticate as.
:param password: the user's password.
:param project_name: the project(ex. tenant) name to scope the auth.
:param user_domain_name: the domain the user belongs to.
:param project_domain_name: the domain the project belongs to.
:param trust_id: a trust id to scope the auth.
:returns: a password auth plugin object.
'''
passwd_kwargs = dict(
auth_url=base.retrieve_auth_url(CONF.keystone.endpoint_type),
username=username,
password=password
)
if CONF.use_identity_api_v3:
passwd_kwargs.update(dict(
project_name=project_name,
user_domain_name=user_domain_name,
project_domain_name=project_domain_name,
trust_id=trust_id
))
auth = keystone_identity.v3.Password(**passwd_kwargs)
else:
passwd_kwargs.update(dict(
tenant_name=project_name,
trust_id=trust_id
))
auth = keystone_identity.v2.Password(**passwd_kwargs)
return auth
开发者ID:uladz,项目名称:sahara,代码行数:39,代码来源:keystone.py
示例9: _session
def _session(username, password, project_name, user_domain_name=None,
project_domain_name=None):
passwd_kwargs = dict(
auth_url=base.retrieve_auth_url(),
username=CONF.keystone_authtoken.admin_user,
password=CONF.keystone_authtoken.admin_password
)
if CONF.use_identity_api_v3:
passwd_kwargs.update(dict(
project_name=project_name,
user_domain_name=user_domain_name,
project_domain_name=project_domain_name
))
auth = keystone_identity.v3.Password(**passwd_kwargs)
else:
passwd_kwargs.update(dict(
tenant_name=project_name
))
auth = keystone_identity.v2.Password(**passwd_kwargs)
return keystone_session.Session(auth=auth)
开发者ID:rsaha,项目名称:sahara,代码行数:22,代码来源:keystone.py
示例10: retrieve_auth_url
def retrieve_auth_url(endpoint_type="publicURL"):
"""This function returns auth url v2.0 api.
Hadoop Swift library doesn't support keystone v3 api.
"""
auth_url = clients_base.retrieve_auth_url(endpoint_type=endpoint_type)
info = urlparse.urlparse(auth_url)
if CONF.use_domain_for_proxy_users:
url = 'v3/auth'
else:
url = 'v2.0'
if info.port:
returned_url = '{scheme}://{hostname}:{port}/{url}/'
return returned_url.format(scheme=info.scheme,
hostname=info.hostname,
port=info.port,
url=url)
else:
return '{scheme}://{hostname}/{url}/'.format(scheme=info.scheme,
hostname=info.hostname,
url=url)
开发者ID:Akanksha08,项目名称:sahara,代码行数:23,代码来源:utils.py
示例11: _assert
def _assert(uri):
mock_url_for.return_value = uri
self.assertEqual(correct, base.retrieve_auth_url())
开发者ID:rsaha,项目名称:sahara,代码行数:3,代码来源:test_base.py
示例12: _assert
def _assert(uri):
self.setup_context(auth_uri=uri)
self.assertEqual(correct, base.retrieve_auth_url())
开发者ID:AllenFromMinneapolis,项目名称:sahara,代码行数:3,代码来源:test_base.py
示例13: _assert
def _assert(uri):
self.override_config('auth_url', uri, 'trustee')
self.assertEqual(correct, base.retrieve_auth_url())
开发者ID:openstack,项目名称:sahara,代码行数:3,代码来源:test_base.py
注:本文中的sahara.utils.openstack.base.retrieve_auth_url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论