Module: AuthlogicConnect::Oauth::Process
- Includes:
- Variables
- Included in:
- Session::InstanceMethods, User::InstanceMethods
- Defined in:
- lib/authlogic_connect/oauth/process.rb
Instance Method Summary collapse
-
#authenticate_with_oauth ⇒ Object
Step 4: on callback, run this method.
-
#cleanup_oauth_session ⇒ Object
Step last, after the response having lots of trouble testing logging and out multiple times, so there needs to be a solid way to know when a user has messed up loggin in.
-
#redirect_to_oauth ⇒ Object
Step 3: if new_oauth_request?, redirect to oauth provider.
- #restore_attributes ⇒ Object
-
#save_auth_session_token(request) ⇒ Object
Step 3b (if version 1.0 of oauth).
-
#save_oauth_session ⇒ Object
Step 3a: save our passed-parameters into the session, so we can retrieve them after the redirect calls back.
-
#validate_by_oauth ⇒ Object
Step 2: after save is called, it runs this method for validation.
Methods included from Variables
#oauth_consumer, #oauth_provider, #oauth_response, #oauth_token, #oauth_token_and_secret, #oauth_variables, #oauth_version, #token_class
Methods included from State
#allow_oauth_redirect?, #authenticating_with_oauth?, #new_oauth_request?, #oauth_provider?, #oauth_request?, #oauth_response?, #redirecting_to_oauth_server?, #using_oauth?, #validate_password_with_oauth?
Instance Method Details
#authenticate_with_oauth ⇒ Object
Step 4: on callback, run this method
49 50 51 |
# File 'lib/authlogic_connect/oauth/process.rb', line 49 def authenticate_with_oauth # implemented in User and Session Oauth modules end |
#cleanup_oauth_session ⇒ Object
Step last, after the response having lots of trouble testing logging and out multiple times, so there needs to be a solid way to know when a user has messed up loggin in.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/authlogic_connect/oauth/process.rb', line 56 def cleanup_oauth_session [:auth_request_class, :authentication_type, :auth_method, :auth_attributes, :oauth_provider, :auth_callback_method, :oauth_request_token, :oauth_request_token_secret ].each {|key| auth_session.delete(key)} end |
#redirect_to_oauth ⇒ Object
Step 3: if new_oauth_request?, redirect to oauth provider
15 16 17 18 19 20 21 |
# File 'lib/authlogic_connect/oauth/process.rb', line 15 def redirect_to_oauth save_oauth_session = token_class.(auth_callback_url) do |request_token| save_auth_session_token(request_token) # only for oauth version 1 end auth_controller.redirect_to end |
#restore_attributes ⇒ Object
45 46 |
# File 'lib/authlogic_connect/oauth/process.rb', line 45 def restore_attributes end |
#save_auth_session_token(request) ⇒ Object
Step 3b (if version 1.0 of oauth)
39 40 41 42 43 |
# File 'lib/authlogic_connect/oauth/process.rb', line 39 def save_auth_session_token(request) # store token and secret auth_session[:oauth_request_token] = request.token auth_session[:oauth_request_token_secret] = request.secret end |
#save_oauth_session ⇒ Object
Step 3a: save our passed-parameters into the session, so we can retrieve them after the redirect calls back
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/authlogic_connect/oauth/process.rb', line 25 def save_oauth_session # Store the class which is redirecting, so we can ensure other classes # don't get confused and attempt to use the response auth_session[:auth_request_class] = self.class.name auth_session[:authentication_type] = auth_params[:authentication_type] auth_session[:oauth_provider] = auth_params[:oauth_provider] auth_session[:auth_method] = "oauth" # Tell our rack callback filter what method the current request is using auth_session[:auth_callback_method] = auth_controller.request.method end |
#validate_by_oauth ⇒ Object
Step 2: after save is called, it runs this method for validation
6 7 8 9 10 11 12 |
# File 'lib/authlogic_connect/oauth/process.rb', line 6 def validate_by_oauth validate_email_field = false unless new_oauth_request? # shouldn't be validating if it's redirecting... restore_attributes complete_oauth_transaction end end |