Sha256: 67a42c37129d74f47f03428cbf08e242adafc4d518a166d00147ed2e2a3badd0

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapid-rack-0.2.0 lib/rapid_rack/default_receiver.rb
rapid-rack-0.1.0 lib/rapid_rack/default_receiver.rb