Class: Saml::Kit::Bindings::HttpRedirect

Inherits:
Binding
  • Object
show all
Includes:
Serializable
Defined in:
lib/saml/kit/bindings/http_redirect.rb

Overview

This class is responsible for serializing/deserializing SAML documents using the HTTP Redirect binding specification. docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf

Instance Attribute Summary

Attributes inherited from Binding

#binding, #location

Instance Method Summary collapse

Methods included from Serializable

#decode, #deflate, #encode, #escape, #inflate, #unescape

Methods inherited from Binding

#==, #binding?, #eql?, #hash, #inspect, #to_h, #to_s

Constructor Details

#initialize(location:) ⇒ HttpRedirect

Returns a new instance of HttpRedirect


15
16
17
# File 'lib/saml/kit/bindings/http_redirect.rb', line 15

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

Instance Method Details

#deserialize(params, configuration: Saml::Kit.configuration) ⇒ Object


27
28
29
30
31
32
# File 'lib/saml/kit/bindings/http_redirect.rb', line 27

def deserialize(params, configuration: Saml::Kit.configuration)
  parameters = normalize(params_to_hash(params))
  document = deserialize_document_from(parameters, configuration)
  ensure_valid_signature(parameters, document)
  document
end

#serialize(builder, relay_state: nil) ⇒ Object


19
20
21
22
23
24
25
# File 'lib/saml/kit/bindings/http_redirect.rb', line 19

def serialize(builder, relay_state: nil)
  builder.embed_signature = false
  builder.destination = location
  document = builder.build
  url_builder = UrlBuilder.new(configuration: builder.configuration)
  [url_builder.build(document, relay_state: relay_state), {}]
end