25 Commits

Author SHA1 Message Date
Jamie Lennox
588aaa3eaa Add issued handlers to auth_ref and fixtures
issued_at is a standard part of V2 and V3 tokens so add it to
AccessInfo in a similar way to expiry. Also it should be included when
generating tokens so include it in fixtures.

Change-Id: I0d62d8ce6472466886751e10e98046b8e398e079
2014-06-19 10:46:27 +10:00
Jamie Lennox
0aa9df3b76 Add role ids to the AccessInfo
Role Names are already there, add ids as well.

Change-Id: Ie6f14a60b182ec2f4ab97c6ced564e63a2f5169a
2014-06-19 10:46:07 +10:00
Jamie Lennox
d69461b18f Create a test token generator and use it
All the clients are currently storing samples of keystone tokens so that
they can use them in testing. This is bad as they are often out of date
or contain data that they shouldn't.

Create a V2 Token generator and make use of that for generating tokens
within our tests.

Change-Id: I72928692142c967d13391752ba57b3bdf7c1feab
blueprint: share-tokens
2014-04-03 11:20:33 +10:00
Jamie Lennox
a1278112ca Fix role_names call from V3 AccessInfo
This was probably initially written against an incorrect test token.

Change-Id: I3e1eb0cb207864dbadb01a477b180058902bb0cd
Closes-Bug: #1282410
2014-02-20 16:53:33 +10:00
Ilya Kharin
9ccc2029f9 Return role names by AccessInfo.role_names
A new method was introduced on AccessInfo class. The method role_names
returns a list of role names of a user associated to the authorization
request.

bp keystoneclient-auth-ref-get-roles

DocImpact

Change-Id: I0862aaaa27193119dc83ef38100c88b48a1d24a4
2014-01-28 11:58:06 +04:00
Jamie Lennox
d4c06d3035 Properly handle Regions in keystoneclient
Region name is taken as a parameter but is ignored in all communication
with the service catalog. Currently region can be stored in the token
data and then requests to url functions will return the appropriate
region. This is the wrong approach because there is nothing specific to
the token (or auth_data) that is region specific. Instead region
information should be held by the client.

Closes-Bug: 1147530
Closes-Bug: 1255992
Change-Id: I812aa89c8b4af28e294e63926a7f88e8246fffc5
2013-12-04 06:57:32 -06:00
Steven Hardy
5b7a460bc3 Allow v2 client authentication with trust_id
It should be possible to authenticate against the v2 tokens
API with a trust_id, because it suports rescoping an existing
token to a trust, this patch adds client support for this.

Note with the current keystone code it's necessary to pass the
trustor tenant ID when rescoping with a trust where
impersonation==True, e.g:

c = client_v2.Client(username=TRUSTEE_USERNAME,
                     password=TRUSTEE_USERNAME,
                     tenant_name=TRUSTEE_TENANT_NAME,
                     auth_url=OS_AUTH_URL_V2)
c.authenticate(trust_id=trust_i.id, tenant_id=TRUSTOR_TENANT_ID)

Change-Id: I177c41af298b7437e2c6fb437aa9ce9a09773b9d
Closes-Bug: #1231483
2013-09-26 15:33:00 +01:00
ZhiQiang Fan
893c87b662 Remove duplicate method in AccessInfo
Closes-Bug: #1217777

Method has_service_catalog is duplicate in AccessInfo, remove the
first one because this class is used as a base class.

Change-Id: Id5f6f0cfe223bd4f31b7c01a6bc1e750ad5a7cd8
2013-08-29 00:04:13 +08:00
Jamie Lennox
90d161fc3a Add domain attributes to accessinfo
user_domain_id and project_domain_id are already available, so simply
add an equivalent user_domain_name and project_domain_name if available.

The use of 'default' for v2 tokens is inspired from the default behaviour of
similar functions and what is used in auth_token middleware.

Change-Id: Ia9b345529072ab893d04c7a38fb7ba3acdc28227
2013-08-26 03:21:27 -07:00
Jamie Lennox
b43349a1ad Support older token formats for projects in accessinfo
Older token formats get decoded as a v2 token so we should support
reading project information from these tokens.

Change-Id: I31473a00b294bd0d7b535cfab8d2eaf09db97ff5
2013-08-26 03:20:23 -07:00
Steven Hardy
2c5ac69c8a Initial Trusts support
Implements client support for the basic trusts API operations,
note this does not include support for the roles subpath operations,
support for those can be added in a subsequent patch.

Change-Id: I0c6ba12bad5cc8f3f10697d2a3dcf4f3be8c7ece
blueprint: delegation-impersonation-support
2013-08-20 23:16:46 +01:00
Jenkins
fd8f05350b Merge "Use ServiceCatalog.factory, the object has no __init__" 2013-07-21 22:51:02 +00:00
Dirk Mueller
f2ad113d1c Fix and enable gating on H402
Docstring summaries need punctuation.

Change-Id: I1b740c13d5fedf9a625ca0807c908f651ee08406
2013-07-12 09:36:07 +02:00
Sascha Peilicke
a6312d52b7 Use ServiceCatalog.factory, the object has no __init__
Fixes LP bug #1199281

Change-Id: Iba4b3fd8ad2e6fe054ed705d8990c13dc5a13430
2013-07-09 11:09:08 +02:00
Dirk Mueller
fe8f9023ac Fix and enable H401
Remove leading spaces from doc comments.

Change-Id: I75b055c0d64dda478c63839d44158e301900107f
2013-06-27 01:28:30 +02:00
lin-hua-cheng
2239c3b27c Implements v3 auth client.
Added support for domain scoping.

Enhancement on AccessInfo to support reading v2/v3 token information.

Enhancement on ServiceCatalog for reading/filtering v2/v3 service
catalog information.

Change-Id: Ibb678b9933d3673e37d0fba857a152a3c5d2b4f4
2013-06-20 23:28:31 -07:00
Julien Danjou
a56ce5817f Use AuthRef for some client fields
This tackles some TODO items left over.

Change-Id: Ib062744acbf56f05d09857d244b78b35c0ef4d39
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-06-11 10:00:13 +02:00
Dolph Mathews
abcf9db625 Fix line continuations (flake8 E125, E126)
- E125: continuation line does not distinguish itself from next logical
  line
- E126: continuation line over-indented for hanging indent

Change-Id: I626a6d5d57db927e8b239f90569b5601c772f28b
2013-06-03 08:04:07 -05:00
Jenkins
1cbda90717 Merge "Fix STALE_TOKEN_DURATION usage" 2013-01-26 17:32:13 +00:00
Jenkins
9392732a3f Merge "Factorize endpoint retrieval in access" 2013-01-24 22:16:12 +00:00
Julien Danjou
7afcea1e66 Fix STALE_TOKEN_DURATION usage
Change-Id: I9856684d93d8b45310e599863553a020180aa509
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-01-24 18:48:22 +01:00
Julien Danjou
1f8a263fc4 Factorize endpoint retrieval in access
Change-Id: Iaace7020696b238e7829dbcae60f0bc7c74a79e4
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-01-24 12:27:11 +01:00
Julien Danjou
ca348fe951 Remove useless code
- There's no need to call parent init function since that's the default
  behaviour.
- The token attribute is nor used nor updated anywhere.

Change-Id: Ib0b2729a396a2d761931ce0e178c49c49814eb21
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-01-23 15:15:30 +01:00
Guang Yee
5939541bc7 bug-1040361: use keyring to store tokens
User can optionally turn off keyring by specifying the --no-cache option.
It can also be disabled with environment variable OS-NO-CACHE.

Change-Id: I8935260bf7fd6befa14798da9b4d02c81e65c417
2012-12-04 09:18:20 -08:00
Joe Heck
f1cc3cfc42 removing repeat attempt at authorization in client
blueprint solidify-python-api

* extended and updated documentation strings
* updated README.rst with latest options
* made debug a pass-through value, optionally set on client (instead of
  just being pulled from environment variable)
* adding AccessInfo object and associated tests
  (access.AccessInfo meant to be a cacheable object external to client
  and ultimately to replace service_catalog and it's existing functionality)
* extending authtoken to support lists of endpoints
* maintaining a single entity for client.management_url with first from
  list of possible endpoints
* create project_name and project_id synonyms to match tenant_name and
  tenant_id
* replacing authenticate call to a pure method, not overloading the
  resource/manager path that confuses base URL concepts.
* throw AuthorizationFailure if client attempts to access keystone
  resources before it has a management url
* special case listing tenant using auth_url for unscoped tokens authorized
  through client
* special case listing tokens.authenticate for Dashboard to allow unscoped
  tokens to hand back parity information to dashboard

Change-Id: I4bb3a1b6a5ce2c4b3fbcebeb59116286cac8b2e3
2012-11-09 00:02:41 +00:00