Sha256: 4c48db4c9a1babea274e1c31f6ce24599ebe97185ddb2804568db07280d4159f

Contents?: true

Size: 804 Bytes

Versions: 2

Compression:

Stored size: 804 Bytes

Contents

module Saml
  module Kit
    module Bindings
      class HttpPost < Binding
        include Serializable

        def initialize(location:)
          super(binding: Saml::Kit::Bindings::HTTP_POST, location: location)
        end

        def serialize(builder, relay_state: nil)
          builder.sign = true
          builder.destination = location
          document = builder.build
          saml_params = {
            document.query_string_parameter => Base64.strict_encode64(document.to_xml),
          }
          saml_params['RelayState'] = relay_state if relay_state.present?
          [location, saml_params]
        end

        def deserialize(params)
          xml = decode(saml_param_from(params))
          Saml::Kit::Document.to_saml_document(xml)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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