New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenStack: Add the ability to use a service token #113

Merged
merged 1 commit into from Sep 5, 2014
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+19 −0
Diff settings

Always

Just for now

@@ -12,6 +12,12 @@ def headers
if self.anonymous?
# do nothing

elsif session_data.has_key? :service_token
# service_token is the token that one would bootstrap OpenStack
# with during the installation process. This token can be used
# directly and does not require authentication beforehand.
h['X-Auth-Token'] = session_data[:service_token]

elsif keystone_v2_style_session_data?
h['X-Auth-Token'] = session_data[:body][:access][:token][:id]

@@ -66,6 +66,19 @@ def session(api_version=:v2)

describe '#headers' do

it 'must know to extract a service token if provided' do
session_data = {
:base_url => 'http://example.com',
:service_token => 'sometokenipickedupfromsomewhere'
}
headers = { 'X-Auth-Token' => session_data[:service_token] }

request = create_request(session_data)

request.headers.must_equal headers
end


it 'must know to extract token from a Keystone v2 auth info' do
session_data = get_session_data(:v2)
headers = { 'X-Auth-Token' => session_data[:body][:access][:token][:id] }
ProTip! Use n and p to navigate between commits in a pull request.