1178 Commits

Author SHA1 Message Date
Monty Taylor
85822f32d4
Add tests for YamlJsonSerializer
Tests are a good thing in general. Also, found and fixed an edge-case
bug with deserialization.

Change-Id: Ic91e6242c0552d916c73237e7589388b0862013c
2016-08-04 11:15:51 -05:00
Jenkins
c528979f91 Merge "Improve authentication plugins documentation" 2016-08-02 22:43:22 +00:00
lilintan
8202c6aabc Don't include openstack/common in flake8 exclude list
The directory openstack/common was used to keep codes from
oslo-incubator, we have retired oslo-incubator, so don't use
this directory any more.

Change-Id: I8ac81a0615f9d2e35012d95ceab3c21986b256ba
2016-08-02 20:36:47 +08:00
Alvaro Lopez Garcia
82804f671d Improve authentication plugins documentation
The plugin documentation had some errors, like:

 - Erroneous Python code
 - Missing OpenID Connect plugins.
 - Not in alphabetical order.

Change-Id: I92cd40b130e55b04476b723db9bf7c309427832d
2016-08-02 08:58:06 +02:00
Jenkins
5a40432cdb Merge "Correctly report available for ADFS plugin" 2016-08-02 00:04:57 +00:00
Alvaro Lopez Garcia
31796b370f Add missing class name to tuple of public objects
The class name OidcClientCredentials is missing in the __all__ list of
public objects from keystoneauth1/identity/v3/oidc.py, therefore it
couldn't be loaded.

Change-Id: Ife9f58f14d31863904673c962c06cc1d3df4b49d
Closes-bug: #1608419
2016-08-01 11:00:22 +02:00
Jamie Lennox
2e227b9952 Correctly report available for ADFS plugin
The ADFS plugin doesn't correctly catch when lxml is not available. This
will fail when a user then tries to iterate all available plugins.

Closes-Bug: #1608169
Change-Id: Ie9d228751306e6df24b43a62392a8f903f82ab82
2016-07-30 23:53:13 -05:00
Jenkins
cbd2e4021e Merge "Fix arguments to _auth_required()" 2016-07-29 22:59:46 +00:00
OpenStack Proposal Bot
1982b23379 Updated from global requirements
Change-Id: I539591f2622259a467dc2a5733db15b75053ef91
2016-07-29 02:29:09 +00:00
Brian Haley
dacbc5ffdf Fix arguments to _auth_required()
_auth_required() already prepends the string
"An auth plugin is required to" to the message callers
pass-in.  Change get_auth_connection_params() to pass
a correct, shortened string.

Change-Id: Iab9c6d7fa92e0d5400dece2f9a18a7a5d3cad497
2016-07-28 15:15:29 -04:00
Jenkins
ad85179870 Merge "Use assertEqual() instead of assertDictEqual()" 2016-07-28 15:16:45 +00:00
wangxiyuan
313006a4d5 Fix the doc error in "using-session"
Change-Id: I75bf2d6419f99bccb40ed372bde0e86be2a47b85
2016-07-28 16:50:50 +08:00
Tang Chen
e9bbca7ac7 Use assertEqual() instead of assertDictEqual()
In unittest2, assertDictEqual() is implemented by
using != operator to compare two dicts. So is
assertEqual() in testtools. assertEqual() in
testtools is able to handle dict, list, set and so
on. So we just call assertEqual() to make the unit
tests simpler.

Change-Id: Id90d1445053f295d36d52bf95794847ed524087d
2016-07-25 20:30:57 +08:00
Jenkins
86e010cc83 Merge "Lazy load oauthlib for plugin loading" 2016-07-22 22:24:36 +00:00
Jenkins
4cc3dd0b17 Merge "Add prompt parameter to Opt" 2016-07-22 22:24:30 +00:00
Jenkins
973ef586e8 Merge "oidc: implement client_credentials grant type" 2016-07-22 19:55:13 +00:00
Jamie Lennox
6306504c58 Lazy load oauthlib for plugin loading
If oauthlib is not available the oauth plugins should not be marked as
available when iterating plugins.

Change-Id: Idabb7adf61dc5ca36fc1524af47e346f8f296245
2016-07-22 04:16:04 +10:00
Alvaro Lopez Garcia
712ee40544 oidc: add missing 'OidcAccessToken' to __all__
Change-Id: Ib0bfed8a85729dced59e64d31e85c6a41631f9b1
2016-07-20 10:03:44 +02:00
Alvaro Lopez Garcia
e5fd66ca35 oidc: implement client_credentials grant type
Change-Id: If1538726cb7e4cb87fad82c5daf50c67b161b52d
2016-07-20 09:59:05 +02:00
Jenkins
b6b2b12ef9 Merge "Fix ECP doc link in Saml2 Password class doc" 2016-07-19 21:42:45 +00:00
Roxana Gherle
67530bd1a2 Fix ECP doc link in Saml2 Password class doc
ECP doc link points to an inexistent web page. This patch
fixes it.

Change-Id: I70819b44329100ea569603d4ac244050b0360072
2016-07-19 10:59:09 -07:00
OpenStack Proposal Bot
abb63ce917 Updated from global requirements
Change-Id: Ic5657cff2c719ec67fab1c6b703ce07ba0b7bb2c
2016-07-19 15:14:45 +00:00
Roxana Gherle
53f1e3c7da Fix link for "extras dependencies" in extras doc
Extras documentation has a link for "extras dependencies" that
results in a "404 Not Found" error page. This patch fixes the doc
link to the correct URL from setuptools online doc.

Closes-Bug: #1604168
Change-Id: I8846f05a33eb6886004f551fc659b77cb8285de0
2016-07-18 14:53:04 -07:00
Jenkins
5c10b25444 Merge "Add additional_headers to session and adapter" 2016-07-18 21:28:41 +00:00
Jenkins
04e4cc85c2 Merge "oidc: move the get_unscoped_auth_ref into the base class" 2016-07-18 21:27:04 +00:00
Jenkins
b60c2b070a Merge "oidc: deprecate grant_type argument" 2016-07-18 21:26:58 +00:00
Jenkins
9d55700e17 Merge "oidc: add discovery document support" 2016-07-18 21:26:52 +00:00
Jenkins
8682dcfc07 Merge "Add pretty serializer for betamax fixture" 2016-07-18 20:49:41 +00:00
Jenkins
72247d5b3c Merge "Use SAML2 requests plugin" 2016-07-18 20:30:44 +00:00
Jenkins
dd226afd26 Merge "Update hacking to global-requirements value" 2016-07-18 18:57:19 +00:00
Monty Taylor
c21ce26ff3
Add pretty serializer for betamax fixture
Saving json responses all on one line escaped inside of json
cassettes is great for computers, but is impossible for humans to
read. Add a serializer that is nicely flowed yaml that emits
multi-line values as yaml blocks. Additionally, re-flow and indent
the nested json, which will stay as json.

An example of the output produced can be seen at:

  https://review.openstack.org/#/c/328338/2/shade/tests/unit/fixtures/test_create_flavor.yaml

Hook it in to the keystoneauth1 betamax fixture by default, because
why in the world would you want ugly when you can have pretty.

Change-Id: I457408fcbbdca240090228d18f0482f958a7d6e4
2016-07-18 11:38:24 -05:00
Monty Taylor
bc90281f27
Update hacking to global-requirements value
The existing version is failing open, which can cause errors to show up.
The new version doesn't fail this way.

Change-Id: I711b6aa286908040aa6ea5f93f76b8bc512d56ed
2016-07-18 11:38:24 -05:00
Jamie Lennox
701b911437 Use SAML2 requests plugin
This is a major refactoring of the SAML2 plugin to move the logic into a
standalone requests auth plugin, and then have the keystoneauth plugin
simply provide a wrapper around that.

There was really no way to migrate this and keep the existing test files
as they were because the entire structure has been changed.

This will be the recommended way to do federation plugins in future and
keep the auth logic out of keystoneauth as much as possible (as kerberos
already does).

The intention will be that later we should be able to extract the SAML
ECP requests plugin into it's own upstream module.

Change-Id: I4a7377b9350741e8f7a4ed2a49a7e2442eacdd23
2016-07-18 00:24:37 -04:00
OpenStack Proposal Bot
76bd9bb00f Updated from global requirements
Change-Id: I2e71c929a360bc7f71b4aef3587ad37461ac0255
2016-07-17 23:53:46 +00:00
Alvaro Lopez Garcia
9bf4efde46 oidc: move the get_unscoped_auth_ref into the base class
The method get_unscoped_auth_ref in each of the plugins is essentially
the same, except for the payload that will be exchanged with the server.
We can move it to the base class and implement the payload generation in
each plugin.

Change-Id: I4abb414fc3709ab6eb433641269137d1dbb77e6a
2016-07-14 11:15:27 +02:00
Alvaro Lopez Garcia
885aff00ac oidc: deprecate grant_type argument
The OpenID Connect grant type is something implicit to our plugins,
so there is no need to pass it as a keyword argument, we can define
this as a class argument. Moreover, it makes no sense to pass a
grant_type that is different to the grant type that is being
implemented. This change deprecates the keyword argument (showing a
warning to the users if they're passing it) and checking if the
grant_type is different to the one defined by the plugin itself.

Change-Id: I4fffc2c651487d3240bbc8458ad728b06b0ffa64
2016-07-14 11:08:29 +02:00
Alvaro Lopez Garcia
00746ea636 oidc: add discovery document support
The OpenID Connect specifies that all providers must return a JSON
discovery document [1] in a well-known location. We can let the user
pass this document instead of the individual endpoints (i.e. token and
authorization endpoint). Moreover, we can also check if the requested
grant_type (implicit to the used plugin, and one of client_credentials,
password, authorization_code) is supported by the provider before
starting the auth flow.

[1] https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata

Fixes-bug: #1583682
Change-Id: I24b7960b25ddcff45552c0ab5541d92122d1d560
2016-07-14 10:19:10 +02:00
Jamie Lennox
1045a147dd Add additional_headers to session and adapter
Allow clients and services to set additional_headers that will be sent
with all requests made by the session.

Change-Id: Idbd2e5159de5790c7db65c806b964f220bb6628e
2016-07-13 17:09:46 +10:00
Yatin Kumbhare
88d4fdb14a Add Python 3.5 classifier and venv
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.

Change-Id: I277c17f774e880b6d2c7c73a8410f1cd1167f055
2016-07-12 21:05:25 +05:30
Jenkins
6b7db34f68 Merge "remove unused LOG" 2016-07-10 23:37:55 +00:00
ji-xuepeng
f2cc77cba0 remove unused LOG
This is to remove unused LOG to keep code clean.

Change-Id: Iaf511b4d61590a9e014ab6a37a2c2b91c3916238
2016-07-10 13:29:53 +08:00
OpenStack Proposal Bot
391499fd68 Updated from global requirements
Change-Id: Iba5f1c439d90d2089a8441d5a9ce9d85b838422a
2016-07-09 19:21:13 +00:00
OpenStack Proposal Bot
eff0936543 Updated from global requirements
Change-Id: Ibfc7c70e7807de35e013b6494afd41bec0ee40ce
2016-07-09 03:11:39 +00:00
Jenkins
702f32a34b Merge "Add create_plugin to loader" 2016-07-08 22:19:33 +00:00
Jamie Lennox
71d2e1ad77 Add prompt parameter to Opt
The prompt parameter is supposed to provide both an indication to
loaders that it is ok to prompt the user for input for an option and
also an appropriate message that can be used.

It would be up to the loader whether it wanted to use that message or
something it generated.

This will allow os-client-config and openstackclient better control over
the loading of sensitive authentication options.

Related-Bug: #1519202
Change-Id: I7c39f25b78404950af6f6eaf21739be1c1ef9c6a
2016-07-07 10:20:21 +10:00
Jenkins
01d040b2be Merge "Auth plugin for X.509 tokenless authentication" 2016-07-06 03:53:26 +00:00
chioleong
e203d61092 Auth plugin for X.509 tokenless authentication
An auth plugin that allows service clients to be authenticated
with the X.509 tokenless authentication. Please find typical configured
options in authentication-plugins.rst

implements bp keystone-tokenless-authz-with-x509-ssl-client-cert

Change-Id: Ie0298f0ef7f3891cfc81072ab9ef9e501773fe5f
2016-07-05 17:11:36 -07:00
Jenkins
b2c8e247cd Merge "oidc: fix OpenID scope management" 2016-07-04 16:05:25 +00:00
Alvaro Lopez Garcia
68a7962488 oidc: fix OpenID scope management
The OpenID scope is something common to all the OpenID grant types,
therefore we move the OIDC scope parameter 'scope' from the OidcPassword
class into the base _OidcBase class, moving the option as well into the
corresponding loader.

Moreover, OpenID scopes are not handled properly, as the loaders have
the option defined as "openid-scope" whereas the class constructor
argument is named "openid".

Lastly, OpenID states that the OpenID scope MUST contain "openid" at
least, so we should include this in our defaults argument.

Closes-Bug: #1594272
Closes-Bug: #1597334
Change-Id: I9a242ae93a61737d032c19830c5d89ef6237f875
2016-07-04 11:08:55 +02:00
Jamie Lennox
784ac090ee Add create_plugin to loader
Add a create_plugin function to loaders. This can be used to create a
plugin based on options with more control than simply specifying a
plugin_class as a property.

The plugin_class property is no longer an abstractproperty however an
implementer must still provide either the plugin_class property or
implement the create_plugin function to succeed.

Change-Id: Iea2ff93cfc3c814c78f6d9cd7e0069bab7e0180b
Closes-Bug: #1595400
2016-07-01 09:32:05 +10:00