Class: SAML::Bindings::HTTPRedirect

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/bindings/http_redirect.rb

Instance Method Summary collapse

Instance Method Details

#build_request(rack_response, endpoint, saml_request, relay_state = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/saml/bindings/http_redirect.rb', line 9

def build_request(rack_response, endpoint, saml_request, relay_state=nil)
  unless relay_state.nil?
    raise ArgumentError.new("relay_state must not exceed 80 bytes") if relay_state.bytesize > 80
  end
  request = saml_request.to_xml.to_s
  deflated_saml_request = deflate(request)
  query = "SAMLRequest=#{deflated_saml_request}"
  query += "&RelayState=#{url_enc(relay_state)}" unless relay_state.nil?
  url = "#{endpoint.location}?#{query}"
  rack_response.redirect url
end

#build_response(rack_request) ⇒ Object



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

def build_response(rack_request)
  xml_str = inflate(rack_request.params["SAMLResponse"])
  xml = Core::Document.new(xml_str).root
  Core::Response.from_xml(xml)
end