module RapidRack
  module DefaultReceiver
    def receive(env, claims)
      attrs = map_attributes(env, claims['https://aaf.edu.au/attributes'])
      store_id(env, subject(env, attrs).id)
      finish(env)
    end

    def map_attributes(_env, attrs)
      attrs
    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

module RapidRack
  module DefaultReceiver
    def receive(env, claims)
      attrs = map_attributes(env, claims['https://aaf.edu.au/attributes'])
      store_id(env, subject(env, attrs).id)
      finish(env)
    end

    def map_attributes(_env, attrs)
      attrs
    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'].destroy
      redirect_to('/')
    end
  end
end

Support destroying a user's session in Rails 5.2
Support destroying a user's session in Rails 5.2

`ActionDispatch::Request::Session.clear` stopped working on Rails 5.2.
Calling destroy has the intended behaviour.
