Module: Passport::Oauth::Context::ClassMethods
- Defined in:
- lib/passport/oauth/protocol/context.rb
Instance Method Summary collapse
- #callback_url(options = {}) ⇒ Object
-
#consumer ⇒ Object
the Oauth gem consumer, whereby we can make requests to the server.
- #inspect ⇒ Object
- #phase ⇒ Object
- #provider ⇒ Object
- #request_secret ⇒ Object
- #request_token ⇒ Object
-
#token ⇒ Object
the token from the response parameters.
- #token_class(throw_error = true) ⇒ Object
- #token_class? ⇒ Boolean
- #verifier ⇒ Object
-
#version ⇒ Object
the version of oauth we’re using.
Instance Method Details
#callback_url(options = {}) ⇒ Object
56 57 58 59 |
# File 'lib/passport/oauth/protocol/context.rb', line 56 def callback_url( = {}) #"http://localhost:4567" Rack::Context.request.url.split("?").first end |
#consumer ⇒ Object
the Oauth gem consumer, whereby we can make requests to the server
52 53 54 |
# File 'lib/passport/oauth/protocol/context.rb', line 52 def consumer token_class.consumer end |
#inspect ⇒ Object
61 62 63 |
# File 'lib/passport/oauth/protocol/context.rb', line 61 def inspect "#<Passport::Oauth::Protocol @version='#{version}' @token='#{token.inspect}' @phase='#{phase}'>" end |
#phase ⇒ Object
36 37 38 39 40 |
# File 'lib/passport/oauth/protocol/context.rb', line 36 def phase return "request" if request? return "response" if response? return "none" end |
#provider ⇒ Object
11 12 13 |
# File 'lib/passport/oauth/protocol/context.rb', line 11 def provider find(:oauth_provider) end |
#request_secret ⇒ Object
32 33 34 |
# File 'lib/passport/oauth/protocol/context.rb', line 32 def request_secret version == 1.0 ? session_key(:oauth_request_token_secret) : params_key(:code) end |
#request_token ⇒ Object
28 29 30 |
# File 'lib/passport/oauth/protocol/context.rb', line 28 def request_token version == 1.0 ? session_key(:oauth_request_token) : nil end |
#token ⇒ Object
the token from the response parameters
24 25 26 |
# File 'lib/passport/oauth/protocol/context.rb', line 24 def token version == 1.0 ? params_key(:oauth_token) : params_key(:code) end |
#token_class(throw_error = true) ⇒ Object
15 16 17 |
# File 'lib/passport/oauth/protocol/context.rb', line 15 def token_class(throw_error = true) Passport.token(provider, throw_error) end |
#token_class? ⇒ Boolean
19 20 21 |
# File 'lib/passport/oauth/protocol/context.rb', line 19 def token_class? token_class(false).blank? end |
#verifier ⇒ Object
42 43 44 |
# File 'lib/passport/oauth/protocol/context.rb', line 42 def verifier params_key(:oauth_verifier) end |
#version ⇒ Object
the version of oauth we’re using. Accessed from the OauthToken subclass
47 48 49 |
# File 'lib/passport/oauth/protocol/context.rb', line 47 def version token_class.version end |