Class: Rack::OAuth2Utils::OAuthRequest
- Inherits:
-
Request
- Object
- Request
- Rack::OAuth2Utils::OAuthRequest
- Defined in:
- lib/rack-oauth2_utils/oauth_request.rb
Constant Summary collapse
- AUTHORIZATION_KEYS =
%w{HTTP_AUTHORIZATION X-HTTP_AUTHORIZATION X_HTTP_AUTHORIZATION}
Instance Method Summary collapse
-
#access_token ⇒ Object
If OAuth, returns access token.
-
#authorization_header ⇒ Object
Returns authorization header.
- #authorization_param ⇒ Object
-
#oauth? ⇒ Boolean
True if authentication scheme is OAuth.
Instance Method Details
#access_token ⇒ Object
If OAuth, returns access token.
35 36 37 |
# File 'lib/rack-oauth2_utils/oauth_request.rb', line 35 def access_token @access_token ||= oauth? end |
#authorization_header ⇒ Object
Returns authorization header.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rack-oauth2_utils/oauth_request.rb', line 13 def @authorization_header ||= ( h = AUTHORIZATION_KEYS.inject(nil) { |auth, key| auth || @env[key] } if h && h[/^oauth/i] h.gsub(/\n/, "").split[1] else nil end ) end |
#authorization_param ⇒ Object
24 25 26 |
# File 'lib/rack-oauth2_utils/oauth_request.rb', line 24 def @authorization_param ||= self.GET['access_token'] end |
#oauth? ⇒ Boolean
True if authentication scheme is OAuth.
29 30 31 |
# File 'lib/rack-oauth2_utils/oauth_request.rb', line 29 def oauth? || end |