Sha256: a13ddb9b5b1f0aea883309b1d2ce05a4db683709f5b19bea4150562c19e07621

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 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)
          if params['SAMLRequest'].present?
            params['SAMLRequest']
          elsif params['SAMLResponse'].present?
            params['SAMLResponse']
          else
            raise ArgumentError.new("SAMLRequest or SAMLResponse parameter is required.")
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saml-kit-0.2.7 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.6 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.5 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.4 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.3 lib/saml/kit/bindings/binding.rb