Sha256: 4e1dbcd5ec606af169844a4a745f8452a96ccd6e2642e25c85fca37c75feeb71

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

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

        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

3 entries across 3 versions & 1 rubygems

Version Path
saml-kit-0.2.2 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.1 lib/saml/kit/bindings/binding.rb
saml-kit-0.2.0 lib/saml/kit/bindings/binding.rb