Sha256: 32636f465995a36fc8fd9346ae2f8d18f2de332a88c2e705da438cae1c094ee9

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

module Saml
  module Kit
    module Bindings
      class Binding
        attr_reader :binding, :location

        def initialize(binding:, location:)
          @binding = binding
          @location = location
        end

        def binding?(other)
          binding == other
        end

        def serialize(builder, relay_state: nil)
          []
        end

        def deserialize(params)
          raise ArgumentError.new("Unsupported binding")
        end

        def to_h
          { binding: binding, location: location }
        end

        def ==(other)
          self.to_s == other.to_s
        end

        def eql?(other)
          self == other
        end

        def hash
          to_s.hash
        end

        def to_s
          "#{location}#{binding}"
        end

        def inspect
          to_h.inspect
        end

        protected

        def saml_param_from(params)
          parameters = {
            SAMLRequest: params[:SAMLRequest] || params['SAMLRequest'],
            SAMLResponse: params[:SAMLResponse] || params['SAMLResponse'],
          }
          if parameters[:SAMLRequest].present?
            parameters[:SAMLRequest]
          elsif parameters[:SAMLResponse].present?
            parameters[:SAMLResponse]
          else
            raise ArgumentError.new("SAMLRequest or SAMLResponse parameter is required.")
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saml-kit-0.2.17 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.16 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.15 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.14 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.13 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.12 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.11 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.10 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.9 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.8 lib/saml/kit/bindings/binding.rb