Class: Saml::Bindings::HTTPArtifact
- Inherits:
-
Object
- Object
- Saml::Bindings::HTTPArtifact
- Defined in:
- lib/saml/bindings/http_artifact.rb
Class Method Summary collapse
- .create_response_xml(artifact_response) ⇒ Object
- .create_url(location, artifact, options = {}) ⇒ Object
- .receive_message(request) ⇒ Object
- .resolve(request, location) ⇒ Object
Class Method Details
.create_response_xml(artifact_response) ⇒ Object
7 8 9 |
# File 'lib/saml/bindings/http_artifact.rb', line 7 def create_response_xml(artifact_response) Saml::Util.sign_xml(artifact_response, :soap) end |
.create_url(location, artifact, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/saml/bindings/http_artifact.rb', line 11 def create_url(location, artifact, = {}) uri = URI.parse(location) query = [uri.query, "SAMLart=#{CGI.escape(artifact.to_s)}"] query << "RelayState=#{CGI.escape([:relay_state])}" if [:relay_state] uri.query = query.compact.join("&") uri.to_s end |
.receive_message(request) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/saml/bindings/http_artifact.rb', line 21 def (request) raw_xml = request.body.dup.read artifact_resolve = Saml::ArtifactResolve.parse(raw_xml, single: true) Saml::Util.verify_xml(artifact_resolve, raw_xml) end |
.resolve(request, location) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/saml/bindings/http_artifact.rb', line 28 def resolve(request, location) artifact = request.params["SAMLart"] artifact_resolve = Saml::ArtifactResolve.new(artifact: artifact, destination: location) response = Saml::Util.post(location, Saml::Util.sign_xml(artifact_resolve, :soap)) if response.code == 200 artifact_response = Saml::ArtifactResponse.parse(response.body, single: true) verified_artifact_response = Saml::Util.verify_xml(artifact_response, response.body) verified_artifact_response.response if artifact_response.success? end end |