Module: AuthlogicConnect::Oauth::Variables
Instance Method Summary collapse
-
#oauth_consumer ⇒ Object
the Oauth gem consumer, whereby we can make requests to the server.
-
#oauth_provider ⇒ Object
this comes straight from either the params or session.
-
#oauth_response ⇒ Object
This should go…
-
#oauth_token ⇒ Object
the token from the response parameters.
-
#oauth_token_and_secret ⇒ Object
this is a thick method.
-
#oauth_variables ⇒ Object
this doesn’t do anything yet, just to show what variables we need from the form.
-
#oauth_version ⇒ Object
the version of oauth we’re using.
- #stored_oauth_token_and_secret ⇒ Object
-
#token_class ⇒ Object
next is “token_class”, which is found from the oauth_provider key.
Methods included from State
#allow_oauth_redirect?, #authenticating_with_oauth?, #complete_oauth?, #new_oauth_request?, #oauth_complete?, #oauth_provider?, #oauth_request?, #oauth_response?, #start_oauth?, #stored_oauth_token_and_secret?, #using_oauth?, #validate_password_with_oauth?
Instance Method Details
#oauth_consumer ⇒ Object
the Oauth gem consumer, whereby we can make requests to the server
40 41 42 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 40 def oauth_consumer token_class.consumer end |
#oauth_provider ⇒ Object
this comes straight from either the params or session. it is required for most of the other accessors in here
12 13 14 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 12 def oauth_provider from_session_or_params(:oauth_provider) end |
#oauth_response ⇒ Object
This should go…
24 25 26 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 24 def oauth_response auth_params && oauth_token end |
#oauth_token ⇒ Object
the token from the response parameters
29 30 31 32 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 29 def oauth_token return nil unless token_class oauth_version == 1.0 ? auth_params[:oauth_token] : auth_params[:code] end |
#oauth_token_and_secret ⇒ Object
this is a thick method. it gives you the final key and secret that we will store in the database
54 55 56 57 58 59 60 61 62 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 54 def oauth_token_and_secret return stored_oauth_token_and_secret if stored_oauth_token_and_secret? token_class.get_token_and_secret( :token => auth_session[:oauth_request_token], :secret => oauth_version == 1.0 ? auth_session[:oauth_request_token_secret] : oauth_token, :oauth_verifier => auth_params[:oauth_verifier], :redirect_uri => auth_callback_url ) end |
#oauth_variables ⇒ Object
this doesn’t do anything yet, just to show what variables we need from the form
6 7 8 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 6 def oauth_variables [:oauth_provider] end |
#oauth_version ⇒ Object
the version of oauth we’re using. Accessed from the OauthToken subclass
35 36 37 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 35 def oauth_version token_class.oauth_version end |
#stored_oauth_token_and_secret ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 44 def stored_oauth_token_and_secret if auth_controller? {:key => auth_params[:_key], :token => auth_params[:_token], :secret => auth_params[:_secret]} else {:key => nil, :token => nil, :secret => nil} end end |
#token_class ⇒ Object
next is “token_class”, which is found from the oauth_provider key. it is the OauthToken subclass, such as TwitterToken, which we use as the api for accessing oauth and saving the response to the database for a user.
19 20 21 |
# File 'lib/authlogic_connect/oauth/variables.rb', line 19 def token_class AuthlogicConnect.token(oauth_provider) unless oauth_provider.blank? end |