Class: Rack::OAuth2::Server::Token::Request
- Inherits:
-
Abstract::Request
- Object
- Request
- Abstract::Request
- Rack::OAuth2::Server::Token::Request
- Defined in:
- lib/rack/oauth2/server/token.rb
Direct Known Subclasses
AuthorizationCode::Request, ClientCredentials::Request, Password::Request, Rack::OAuth2::Server::Token::RefreshToken::Request
Instance Method Summary collapse
-
#initialize(env) ⇒ Request
constructor
A new instance of Request.
- #profile ⇒ Object
Methods inherited from Abstract::Request
#attr_missing_with_error_handling!
Constructor Details
#initialize(env) ⇒ Request
Returns a new instance of Request.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rack/oauth2/server/token.rb', line 18 def initialize(env) auth = Rack::Auth::Basic::Request.new(env) if auth.provided? && auth.basic? @client_id, @client_secret = auth.credentials super else super @client_secret = params['client_secret'] end @grant_type = params['grant_type'] end |
Instance Method Details
#profile ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rack/oauth2/server/token.rb', line 30 def profile case params['grant_type'].to_s when 'authorization_code' AuthorizationCode when 'password' Password when 'client_credentials' ClientCredentials when 'refresh_token' RefreshToken when '' attr_missing! else unsupported_grant_type!("'#{params['grant_type']}' isn't supported.") end end |