Sha256: fd90bfb582e24bd2c8049d81dac4ff2ca187c8963ff5490618cccd4e70bd57ac

Contents?: true

Size: 1.4 KB

Versions: 25

Compression:

Stored size: 1.4 KB

Contents

module Saml
  module Bindings
    class HTTPPost
      include Saml::Notification

      class << self
        def create_form_attributes(message, options = {})
          param = message.is_a?(Saml::ComplexTypes::StatusResponseType) ? "SAMLResponse" : "SAMLRequest"

          xml = notify('create_message', Saml::Util.sign_xml(message))

          variables        = {}
          variables[param] = Saml::Encoding.encode_64(xml)
          variables["RelayState"] = options[:relay_state] if options[:relay_state]

          {
              location:  message.destination,
              variables: variables
          }
        end

        def receive_message(request, type)
          message             = Saml::Encoding.decode_64(request.params["SAMLRequest"] || request.params["SAMLResponse"])
          notify('receive_message', message)
          request_or_response = Saml.parse_message(message, type)

          skip_signature_verification = (
            request_or_response.is_a?(Saml::AuthnRequest) &&
            !request_or_response.provider.authn_requests_signed?
          )

          verified_request_or_response = if skip_signature_verification
            request_or_response
          else
            Saml::Util.verify_xml(request_or_response, message)
          end
          verified_request_or_response.actual_destination = request.url
          verified_request_or_response
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
libsaml-3.9.0 lib/saml/bindings/http_post.rb
libsaml-3.8.0 lib/saml/bindings/http_post.rb
libsaml-3.7.0 lib/saml/bindings/http_post.rb
libsaml-3.6.0 lib/saml/bindings/http_post.rb
libsaml-3.5.0 lib/saml/bindings/http_post.rb
libsaml-3.4.0 lib/saml/bindings/http_post.rb
libsaml-3.3.0 lib/saml/bindings/http_post.rb
libsaml-3.2.3 lib/saml/bindings/http_post.rb
libsaml-3.2.2 lib/saml/bindings/http_post.rb
libsaml-3.2.1 lib/saml/bindings/http_post.rb
libsaml-3.1.2 lib/saml/bindings/http_post.rb
libsaml-3.1.1 lib/saml/bindings/http_post.rb
libsaml-3.1.0 lib/saml/bindings/http_post.rb
libsaml-3.0.9 lib/saml/bindings/http_post.rb
libsaml-2.24.3 lib/saml/bindings/http_post.rb
libsaml-2.24.2 lib/saml/bindings/http_post.rb
libsaml-3.0.8 lib/saml/bindings/http_post.rb
libsaml-3.0.7 lib/saml/bindings/http_post.rb
libsaml-3.0.6 lib/saml/bindings/http_post.rb
libsaml-3.0.5 lib/saml/bindings/http_post.rb