Sha256: 81071f2f639cbd4095a3e8e02fa77a1d01263bc24422c25661b7b1f95a3303d4

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

module Rack
  class Saml
    require 'rack/saml/response/abstract_response'
    autoload "OneloginResponse", 'rack/saml/response/onelogin_response'
    autoload "OpensamlResponse", 'rack/saml/response/opensaml_response'

    class ResponseHandler
      attr_reader :response

      # Rack::Saml::ResponseHandler
      # request: Rack current request instance
      # config: config/saml.yml 
      # metadata: specified idp entity in the config/metadata.yml
      def initialize(request, config, metadata)
        @response = (eval "Rack::Saml::#{config['assertion_handler'].to_s.capitalize}Response").new(request, config, metadata)
      end

      def extract_attrs(env, session, attribute_map)
        if session.env.empty?
          attribute_map.each do |attr_name, env_name|
            attribute = @response.attributes[attr_name]
            if !attribute.nil?
              session.env[env_name] = attribute
            end
          end
          if !@response.config['shib_app_id'].nil?
            session.env['Shib-Application-ID'] = @response.config['shib_app_id']
          end
          session.env['Shib-Session-ID'] = session.get_sid('saml_res')
        end
        session.env.each do |k, v|
          env[k] = v
        end
      end

      def self.extract_attrs(env, session)
        session.env.each do |k, v|
          env[k] = v
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rack-saml-0.2.4 lib/rack/saml/response_handler.rb
rack-saml-0.2.3 lib/rack/saml/response_handler.rb
rack-saml-0.2.2 lib/rack/saml/response_handler.rb
rack-saml-0.2.1 lib/rack/saml/response_handler.rb
rack-saml-0.1.5 lib/rack/saml/response_handler.rb
rack-saml-0.1.4 lib/rack/saml/response_handler.rb
rack-saml-0.1.3 lib/rack/saml/response_handler.rb
rack-saml-0.1.2 lib/rack/saml/response_handler.rb
rack-saml-0.1.1 lib/rack/saml/response_handler.rb
rack-saml-0.1.0 lib/rack/saml/response_handler.rb
rack-saml-0.0.7 lib/rack/saml/response_handler.rb
rack-saml-0.0.6 lib/rack/saml/response_handler.rb