Class: Fog::Brightbox::OAuth2::UserCredentialsStrategy

Inherits:
GrantTypeStrategy show all
Defined in:
lib/fog/brightbox/oauth2.rb

Overview

This passes user details through so the returned token carries the privileges of the user not account limited by the client

Instance Method Summary collapse

Methods inherited from GrantTypeStrategy

#authorization_header, #initialize

Constructor Details

This class inherits a constructor from Fog::Brightbox::OAuth2::GrantTypeStrategy

Instance Method Details

#authorization_body_dataObject



169
170
171
172
173
174
175
# File 'lib/fog/brightbox/oauth2.rb', line 169

def authorization_body_data
  {
    "grant_type" => "password",
    "username"   => @credentials.username,
    "password"   => @credentials.password
  }
end

#headersObject



177
178
179
180
181
182
183
184
185
186
# File 'lib/fog/brightbox/oauth2.rb', line 177

def headers
  {
    "Authorization" => authorization_header,
    "Content-Type" => "application/json"
  }.tap do |headers|
    if @credentials.one_time_password
      headers[TWO_FACTOR_HEADER] = @credentials.one_time_password
    end
  end
end