Class: WardenOmniAuth::Strategy
- Inherits:
-
Warden::Strategies::Base
- Object
- Warden::Strategies::Base
- WardenOmniAuth::Strategy
- Defined in:
- lib/warden_omniauth.rb
Overview
The base omniauth warden strategy. This is inherited for each omniauth strategy
Class Attribute Summary collapse
-
.omni_name ⇒ Object
Returns the value of attribute omni_name.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.omni_name ⇒ Object
Returns the value of attribute omni_name.
52 53 54 |
# File 'lib/warden_omniauth.rb', line 52 def omni_name @omni_name end |
Class Method Details
.on_callback(&blk) ⇒ Object
48 49 50 51 |
# File 'lib/warden_omniauth.rb', line 48 def on_callback(&blk) @on_callback = blk if blk @on_callback || WardenOmniAuth.on_callback end |
Instance Method Details
#authenticate! ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/warden_omniauth.rb', line 55 def authenticate! session = env[SESSION_KEY] session[SCOPE_KEY] = scope # set the user if one exists # otherwise, redirect for authentication if user = env['omniauth.auth'] success! self.class.on_callback[user] else path_prefix = OmniAuth::Configuration.instance.path_prefix redirect! File.join(path_prefix, self.class.omni_name) end end |