class Fog::Brightbox::OAuth2::GrantTypeStrategy

This strategy class is the basis for OAuth2 grant types

@abstract Need to implement {#authorization_body_data} to return a

Hash matching the expected parameter form for the OAuth request

@todo Strategies should be able to validate if credentials are suitable

so just client credentials cannot be used with user strategies

Public Class Methods

new(credentials) click to toggle source
# File lib/fog/brightbox/oauth2.rb, line 100
def initialize(credentials)
  @credentials = credentials
end

Public Instance Methods

authorization_body_data() click to toggle source
# File lib/fog/brightbox/oauth2.rb, line 104
def authorization_body_data
  raise "Not implemented"
end
authorization_header() click to toggle source
# File lib/fog/brightbox/oauth2.rb, line 108
def authorization_header
  header_content = "#{@credentials.client_id}:#{@credentials.client_secret}"
  "Basic #{Base64.encode64(header_content).chomp}"
end
headers() click to toggle source
# File lib/fog/brightbox/oauth2.rb, line 113
def headers
  {
    "Authorization" => authorization_header,
    "Content-Type" => "application/json"
  }
end