Module: Sinatra::GoogleAuth::Helpers
- Defined in:
- lib/sinatra/google-auth.rb
Instance Method Summary collapse
Instance Method Details
#authenticate ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sinatra/google-auth.rb', line 25 def authenticate unless session["user"] session['google-auth-redirect'] = request.path if settings.absolute_redirect? redirect "/auth/google_apps" else redirect to "/auth/google_apps" end end end |
#handle_authentication_callback ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sinatra/google-auth.rb', line 36 def handle_authentication_callback unless session["user"] user_info = request.env["omniauth.auth"].info on_user(user_info) if respond_to? :on_user session["user"] = Array(user_info.email).first.downcase end url = session['google-auth-redirect'] || to("/") redirect url end |