Class: Saml::Bindings::HTTPRedirect
- Inherits:
-
Object
- Object
- Saml::Bindings::HTTPRedirect
- Includes:
- Notification
- Defined in:
- lib/saml/bindings/http_redirect.rb
Instance Attribute Summary collapse
-
#relay_state ⇒ Object
Returns the value of attribute relay_state.
-
#request_or_response ⇒ Object
Returns the value of attribute request_or_response.
-
#signature ⇒ Object
Returns the value of attribute signature.
-
#signature_algorithm ⇒ Object
Returns the value of attribute signature_algorithm.
Class Method Summary collapse
- .create_url(request_or_response, options = {}) ⇒ Object
- .receive_message(http_request, options = {}) ⇒ Object
Instance Method Summary collapse
- #create_url ⇒ Object
-
#initialize(request_or_response, options = {}) ⇒ HTTPRedirect
constructor
A new instance of HTTPRedirect.
- #verify_signature(query) ⇒ Object
Methods included from Notification
Constructor Details
#initialize(request_or_response, options = {}) ⇒ HTTPRedirect
Returns a new instance of HTTPRedirect.
43 44 45 46 47 48 |
# File 'lib/saml/bindings/http_redirect.rb', line 43 def initialize(request_or_response, = {}) @request_or_response = request_or_response @signature_algorithm = [:signature_algorithm] @relay_state = [:relay_state] @signature = [:signature] end |
Instance Attribute Details
#relay_state ⇒ Object
Returns the value of attribute relay_state.
41 42 43 |
# File 'lib/saml/bindings/http_redirect.rb', line 41 def relay_state @relay_state end |
#request_or_response ⇒ Object
Returns the value of attribute request_or_response.
41 42 43 |
# File 'lib/saml/bindings/http_redirect.rb', line 41 def request_or_response @request_or_response end |
#signature ⇒ Object
Returns the value of attribute signature.
41 42 43 |
# File 'lib/saml/bindings/http_redirect.rb', line 41 def signature @signature end |
#signature_algorithm ⇒ Object
Returns the value of attribute signature_algorithm.
41 42 43 |
# File 'lib/saml/bindings/http_redirect.rb', line 41 def signature_algorithm @signature_algorithm end |
Class Method Details
.create_url(request_or_response, options = {}) ⇒ Object
7 8 9 10 |
# File 'lib/saml/bindings/http_redirect.rb', line 7 def create_url(request_or_response, = {}) [:signature_algorithm] ||= 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' new(request_or_response, ).create_url end |
.receive_message(http_request, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/saml/bindings/http_redirect.rb', line 12 def (http_request, = {}) [:signature] = Saml::Encoding.decode_64(http_request.params["Signature"] || "") [:signature_algorithm] = http_request.params["SigAlg"] [:relay_state] = http_request.params["RelayState"] request_or_response = parse_request_or_response(.delete(:type), http_request.params) redirect_binding = new(request_or_response, ) query_string = URI.parse(http_request.url).query redirect_binding.verify_signature(query_string) if request_or_response.provider.authn_requests_signed? request_or_response.actual_destination = http_request.url request_or_response end |
Instance Method Details
#create_url ⇒ Object
56 57 58 |
# File 'lib/saml/bindings/http_redirect.rb', line 56 def create_url [request_or_response.destination, signed_params].join("?") end |
#verify_signature(query) ⇒ Object
50 51 52 53 54 |
# File 'lib/saml/bindings/http_redirect.rb', line 50 def verify_signature(query) unless request_or_response.provider.verify(signature_algorithm, signature, parse_signature_params(query)) raise Saml::Errors::SignatureInvalid.new end end |