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.
- #new_oauth_request? ⇒ Boolean
- #oauth_provider? ⇒ Boolean
-
#oauth_request? ⇒ Boolean
1.
-
#oauth_response? ⇒ Boolean
(also: #oauth_complete?)
2.
-
#redirecting_to_oauth_server? ⇒ Boolean
both checks if it can redirect, and does the redirect.
-
#using_oauth? ⇒ Boolean
3.
- #validate_password_with_oauth? ⇒ Boolean
Instance Method Details
#allow_oauth_redirect? ⇒ Boolean
36 37 38 |
# File 'lib/authlogic_connect/oauth/state.rb', line 36 def allow_oauth_redirect? authenticating_with_oauth? && !oauth_complete? end |
#authenticating_with_oauth? ⇒ Boolean
main method we call on validation
32 33 34 |
# File 'lib/authlogic_connect/oauth/state.rb', line 32 def authenticating_with_oauth? correct_request_class? && using_oauth? end |
#new_oauth_request? ⇒ Boolean
23 24 25 |
# File 'lib/authlogic_connect/oauth/state.rb', line 23 def new_oauth_request? oauth_response.blank? end |
#oauth_provider? ⇒ Boolean
27 28 29 |
# File 'lib/authlogic_connect/oauth/state.rb', line 27 def oauth_provider? !oauth_provider.nil? && !oauth_provider.empty? 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.nil? && oauth_provider? end |
#oauth_response? ⇒ Boolean Also known as: oauth_complete?
-
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 |
#redirecting_to_oauth_server? ⇒ Boolean
both checks if it can redirect, and does the redirect. is there a more concise way to do this?
42 43 44 45 46 47 48 |
# File 'lib/authlogic_connect/oauth/state.rb', line 42 def redirecting_to_oauth_server? if allow_oauth_redirect? redirect_to_oauth return true end return false end |
#using_oauth? ⇒ Boolean
-
either to or from call
19 20 21 |
# File 'lib/authlogic_connect/oauth/state.rb', line 19 def using_oauth? oauth_request? || oauth_response? end |
#validate_password_with_oauth? ⇒ Boolean
50 51 52 |
# File 'lib/authlogic_connect/oauth/state.rb', line 50 def validate_password_with_oauth? !using_oauth? && require_password? end |