# frozen_string_literal: true module ShibRack # Mixin providing the default implementation of a subject receiver module DefaultReceiver def receive(env) attrs = map_attributes(env) store_id(env, subject(env, attrs).id) finish(env) end def map_attributes(_env) {} end def store_id(env, id) env['rack.session']['subject_id'] = id end def finish(_env) redirect_to('/') end def redirect_to(url) [302, { 'Location' => url }, []] end def logout(env) env['rack.session'].clear redirect_to('/') end end end