Sha256: 831a31bce0db1317b7508725d84ec2746e0839d3c93794e8dbdb99b83546d027
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module Saml module Kit # This module provides the behaviours # associated with SAML Response documents. # .e.g. Response, LogoutResponse module Respondable extend ActiveSupport::Concern attr_reader :request_id included do validates_inclusion_of :status_code, in: [Namespaces::SUCCESS] validate :must_match_request_id end # @!visibility private def query_string_parameter 'SAMLResponse' end # Returns the /Status/StatusCode@Value def status_code at_xpath('./*/samlp:Status/samlp:StatusCode/@Value').try(:value) end # Returns the /Status/StatusMessage def status_message at_xpath('./*/samlp:Status/samlp:StatusMessage').try(:text) end # Returns the /InResponseTo attribute. def in_response_to at_xpath('./*/@InResponseTo').try(:value) end # Returns true if the Status code is #{Saml::Kit::Namespaces::SUCCESS} def success? Namespaces::SUCCESS == status_code end private def must_match_request_id return if request_id.nil? return if in_response_to == request_id errors.add(:in_response_to, error_message(:invalid_response_to)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
saml-kit-1.3.0 | lib/saml/kit/concerns/respondable.rb |
saml-kit-1.2.0 | lib/saml/kit/concerns/respondable.rb |