Sha256: 504018400c8a9bea9ccae6f02472b29e43be63ec9c644317b49c3fb33b0db2b1

Contents?: true

Size: 1.19 KB

Versions: 19

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module Saml
  module Kit
    module Bindings
      # This class is responsible for
      # serializing/deserializing SAML
      # documents using the HTTP Post
      # binding specification.
      # https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf
      # {include:file:spec/saml/kit/bindings/http_post_spec.rb}
      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.destination = location
          document = builder.build
          xml = document.to_xml
          saml_params = {
            document.query_string_parameter => Base64.strict_encode64(xml),
          }
          saml_params['RelayState'] = relay_state if relay_state.present?
          [location, saml_params]
        end

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
saml-kit-1.3.0 lib/saml/kit/bindings/http_post.rb
saml-kit-1.2.0 lib/saml/kit/bindings/http_post.rb
saml-kit-1.1.0 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.31 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.30 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.29 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.28 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.27 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.26 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.25 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.24 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.23 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.22 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.21 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.20 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.19 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.18 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.17 lib/saml/kit/bindings/http_post.rb
saml-kit-1.0.16 lib/saml/kit/bindings/http_post.rb