Module: AuthlogicConnect::Oauth::State
- Included in:
- Variables
- Defined in:
- lib/authlogic_connect/oauth/state.rb
Overview
all these methods must return true or false
Instance Method Summary collapse
- #allow_oauth_redirect? ⇒ Boolean
-
#authenticating_with_oauth? ⇒ Boolean
main method we call on validation.
- #complete_oauth? ⇒ Boolean
- #new_oauth_request? ⇒ Boolean
- #oauth_complete? ⇒ Boolean
- #oauth_provider? ⇒ Boolean
-
#oauth_request? ⇒ Boolean
1.
-
#oauth_response? ⇒ Boolean
2.
- #start_oauth? ⇒ Boolean
- #stored_oauth_token_and_secret? ⇒ Boolean
-
#using_oauth? ⇒ Boolean
3.
- #validate_password_with_oauth? ⇒ Boolean
Instance Method Details
#allow_oauth_redirect? ⇒ Boolean
40 41 42 |
# File 'lib/authlogic_connect/oauth/state.rb', line 40 def allow_oauth_redirect? authenticating_with_oauth? && !oauth_complete? end |
#authenticating_with_oauth? ⇒ Boolean
main method we call on validation
36 37 38 |
# File 'lib/authlogic_connect/oauth/state.rb', line 36 def authenticating_with_oauth? correct_request_class? && using_oauth? end |
#complete_oauth? ⇒ Boolean
48 49 50 |
# File 'lib/authlogic_connect/oauth/state.rb', line 48 def complete_oauth? using_oauth? && !new_oauth_request? end |
#new_oauth_request? ⇒ Boolean
26 27 28 29 |
# File 'lib/authlogic_connect/oauth/state.rb', line 26 def new_oauth_request? return false if stored_oauth_token_and_secret? return oauth_response.blank? end |
#oauth_complete? ⇒ Boolean
17 18 19 |
# File 'lib/authlogic_connect/oauth/state.rb', line 17 def oauth_complete? oauth_response? || stored_oauth_token_and_secret? end |
#oauth_provider? ⇒ Boolean
31 32 33 |
# File 'lib/authlogic_connect/oauth/state.rb', line 31 def oauth_provider? !oauth_provider.blank? end |
#oauth_request? ⇒ Boolean
-
to call
checks that we just passed parameters to it, and that the parameters say ‘authentication_method’ == ‘oauth’
7 8 9 |
# File 'lib/authlogic_connect/oauth/state.rb', line 7 def oauth_request? auth_params? && oauth_provider? end |
#oauth_response? ⇒ Boolean
-
from call
checks that the correct session variables are there
13 14 15 |
# File 'lib/authlogic_connect/oauth/state.rb', line 13 def oauth_response? !oauth_response.nil? && !auth_session.nil? && auth_session[:auth_request_class] == self.class.name && auth_session[:auth_method] == "oauth" end |
#start_oauth? ⇒ Boolean
44 45 46 |
# File 'lib/authlogic_connect/oauth/state.rb', line 44 def start_oauth? authenticating_with_oauth? && !oauth_complete? end |
#stored_oauth_token_and_secret? ⇒ Boolean
56 57 58 |
# File 'lib/authlogic_connect/oauth/state.rb', line 56 def stored_oauth_token_and_secret? !is_auth_session? && auth_params && auth_params.has_key?(:_key) && auth_params.has_key?(:_token) && auth_params.has_key?(:_secret) end |
#using_oauth? ⇒ Boolean
-
either to or from call
22 23 24 |
# File 'lib/authlogic_connect/oauth/state.rb', line 22 def using_oauth? oauth_request? || oauth_response? || stored_oauth_token_and_secret? end |
#validate_password_with_oauth? ⇒ Boolean
52 53 54 |
# File 'lib/authlogic_connect/oauth/state.rb', line 52 def validate_password_with_oauth? !using_oauth? && require_password? end |