Add WWW-Authenticate header in 401 responses.

This review come from https://review.openstack.org/#/c/41707/, due to the
inactive in that.

Add the WWW-Authenticate in header when Keystone responds with 401 status
code. The format of the header is

WWW-Authenticate: Keystone uri="http://localhost:5000/"

as indicated in

http://docs.openstack.org/developer/keystone/middlewarearchitecture.html#exchanging-user-information .

Closes-Bug: #1153719
Change-Id: Iaa2291c66a9b126982b8aad0ddbfa9468dfc5d3e
Update mailmap for Joe Gordon

Update mailmap to reflect that I am committing from a new email address.

Change-Id: Id87601ce73ada6b6ac9763f381bdc28853818428
Remove duplicated code on test_v3_auth

Try to be a bit more DRYer in the external authentication testing part.

Change-Id: I295a952fabf923d084daee14a154cb6ac5b7838b
Fix issue deleting ec2-credentials as non-admin user

The ec2tokens controller incorrectly uses the access id, not the
hashed credential id in _assert_owner, which means that non-admin
users can't delete their ec2-credentials.  Adding the hashing, as
in _get_credentials fixes the problem.  Test added demonstrating
the issue.

Change-Id: Ifb6e3e10a50541cf21d25880bd74e9aeb6df4f26
Closes-Bug: #1245435
Change sample policy files to use policy language

The sample policy files were using the old style for rules.

This changes the policy files to use the new policy language
for rules.

Change-Id: I532b941c9b14b68b449e2cd7165d01a1f1031b05
Closes-Bug: #1152662
Clean up duplicate exceptions in docs for assignment.Driver

keystone.exception.ProjectNotFound was duplicated in the
docstrings for some of the methods in assignment.Driver.

Related-Bug: #1239476
Change-Id: I2e20eff1f307fdba2dd75097302b11c1e98949e3
Enhance tests for assignment create_grant when no user or group

There were no tests that show the behavior of create_grant when
the user or group doesn't exist. Turns out the behavior is
different depending on the backend (sql vs kvs vs ldap).

Change-Id: I71c3e2b94aaa44e40c8a891b49cc2a9961cee16f
Related-Bug: #1239476
Fix KVS create_grant to not raise NotFound if no user/group

The KVS assigment backend would fail with NotFound if the user
or group didn't exist when calling create_grant while the SQL
assignment backend did not fail.

It's unreasonable to check if the user or group exists when
creating a grant, so the KVS assignment backend is changed to
not require the user or group to exist.

Closes-Bug: #1239476
Change-Id: I2d3b2fd82e7d4d33ac7158968d72cbfbe37528dc
Moves common RestfulTestCase to it's own module.

This is in preparation for larger refactorings to make the test suite
faster and easier to understand.

Change-Id: I86d5be0324cca744b3109989815ef1dc720d1f8c
Dependency cleanup

Clean up dependency usage.

a) If the class uses a dependency directly, make sure it's
included (getting from superclass isn't enough)

b) If the class doesn't use a dependency directly, make
sure it's NOT included (being a superclass isn't excuse)

Change-Id: Ifbd489f349ec019a41093a2814664e6d8c9f0069
don't rebind stdlib's os.chdir function

Change-Id: I07d5e8c58007cf716eecb922afb67abe3b53b981
Merge "Remove duplicated code on test_v3_auth"
Skip test_create_update_delete_unicode_project in _ldap_livetest

Live LDAP tests fail because this test doesn't work.

This failure occures on the same reason as it was with
test_create_unicode_user_name
(Ic01aa505d867c1de30e2a1ed7c79ff1478e213ef)

Related bug: 1172106

Change-Id: I0422d14c937030c39a17776e7d321bd629d50b31
Merge "Clean up duplicate exceptions in docs for assignment.Driver"
Duplicate delete the user_project_metadata.

When assignment backend is sql,duplicate delete the user_project_metadata
filter with project_id when delete project.No need to do this.

This patch fix the bug.

Change-Id: Ic90798737b3f7f4418ce6ffbf1d9c945449798ca
Closes-Bug: #1248037
fix unparseable JSON

- use only double quotes
- remove trailing commas for last element
- add trailing newline

Change-Id: I3f47a25cdac429d95319ca80c6622b9cb1460446
Closes-Bug: #1249117
UserAuthInfo use dependency injection

UserAuthInfo didn't use dependency injection so the managers were
created multiple times.

The dependency injection doesn't happen until after __init__(),
so users can't call methods using the dependencies in __init__().

Change-Id: I3d649ec45d5d7ade740277334c32d9f76140fb34
Change deprecated CLI arguments

According to keystoneclient/shell.py, --token and --endpoint (with
their accompanying ENV vars SERVICE_TOKEN and SERVICE_ENDPOINT)
were retained only for Essex compatibility and should have been
removed during Grizzly, replaced with --os-token (OS_SERVICE_TOKEN)
and  --os-endpoint (OS_SERVICE_ENDPOINT).

This patch updates a couple of doc references to the old options,
and the sample_data tool.

Change-Id: I87060764f40b1612e3a440c3406d094536af4c9c
Merge "Moves common RestfulTestCase to it's own module."
Merge "Change deprecated CLI arguments"