Class: Fog::Brightbox::OAuth2::GrantTypeStrategy Abstract
- Inherits:
-
Object
- Object
- Fog::Brightbox::OAuth2::GrantTypeStrategy
- Defined in:
- lib/fog/brightbox/oauth2.rb
Overview
This class is 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
This strategy class is the basis for OAuth2 grant types
Direct Known Subclasses
ClientCredentialsStrategy, RefreshTokenStrategy, UserCredentialsStrategy
Instance Method Summary collapse
- #authorization_body_data ⇒ Object
- #authorization_header ⇒ Object
- #headers ⇒ Object
-
#initialize(credentials) ⇒ GrantTypeStrategy
constructor
A new instance of GrantTypeStrategy.
Constructor Details
#initialize(credentials) ⇒ GrantTypeStrategy
Returns a new instance of GrantTypeStrategy.
131 132 133 |
# File 'lib/fog/brightbox/oauth2.rb', line 131 def initialize(credentials) @credentials = credentials end |
Instance Method Details
#authorization_body_data ⇒ Object
135 136 137 |
# File 'lib/fog/brightbox/oauth2.rb', line 135 def raise "Not implemented" end |
#authorization_header ⇒ Object
139 140 141 142 |
# File 'lib/fog/brightbox/oauth2.rb', line 139 def header_content = "#{@credentials.client_id}:#{@credentials.client_secret}" "Basic #{Base64.encode64(header_content).chomp}" end |
#headers ⇒ Object
144 145 146 147 148 149 |
# File 'lib/fog/brightbox/oauth2.rb', line 144 def headers { "Authorization" => , "Content-Type" => "application/json" } end |