Module: ShibRack::DefaultReceiver
- Defined in:
- lib/shib_rack/default_receiver.rb
Overview
Mixin providing the default implementation of a subject receiver
Instance Method Summary collapse
- #finish(_env) ⇒ Object
- #logout(env) ⇒ Object
- #map_attributes(_env) ⇒ Object
- #receive(env) ⇒ Object
- #redirect_to(url) ⇒ Object
- #store_id(env, id) ⇒ Object
Instance Method Details
#finish(_env) ⇒ Object
20 21 22 |
# File 'lib/shib_rack/default_receiver.rb', line 20 def finish(_env) redirect_to('/') end |
#logout(env) ⇒ Object
28 29 30 31 |
# File 'lib/shib_rack/default_receiver.rb', line 28 def logout(env) env['rack.session'].clear redirect_to('/') end |
#map_attributes(_env) ⇒ Object
12 13 14 |
# File 'lib/shib_rack/default_receiver.rb', line 12 def map_attributes(_env) {} end |
#receive(env) ⇒ Object
6 7 8 9 10 |
# File 'lib/shib_rack/default_receiver.rb', line 6 def receive(env) attrs = map_attributes(env) store_id(env, subject(env, attrs).id) finish(env) end |
#redirect_to(url) ⇒ Object
24 25 26 |
# File 'lib/shib_rack/default_receiver.rb', line 24 def redirect_to(url) [302, { 'location' => url }, []] end |
#store_id(env, id) ⇒ Object
16 17 18 |
# File 'lib/shib_rack/default_receiver.rb', line 16 def store_id(env, id) env['rack.session']['subject_id'] = id end |