Sha256: 4dec912fe7c2ee84664aeb7c96f97096ce36cef954da28be30598bd0914a6751

Contents?: true

Size: 1.5 KB

Versions: 53

Compression:

Stored size: 1.5 KB

Contents

module Saml
  class Response
    include Saml::ComplexTypes::StatusResponseType

    attr_accessor :xml_value

    tag "Response"
    has_many :assertions, Saml::Assertion, xpath: './'
    has_many :encrypted_assertions, Saml::Elements::EncryptedAssertion

    def authn_failed?
      !success? && status.status_code.authn_failed?
    end

    def request_denied?
      !success? && status.status_code.request_denied?
    end

    def request_unsupported?
      !success? && status.status_code.request_unsupported?
    end

    def no_authn_context?
      !success? && status.status_code.no_authn_context?
    end

    def unknown_principal?
      !success? && status.status_code.unknown_principal?
    end

    def encrypt_assertions(certificate)
      @encrypted_assertions = []
      assertions.each do |assertion|
        @encrypted_assertions << Saml::Util.encrypt_assertion(assertion, certificate)
      end
      assertions.clear
    end

    def decrypt_assertions(private_key)
      @assertions ||= []
      encrypted_assertions.each do |encrypted_assertion|
        @assertions << Saml::Util.decrypt_assertion(encrypted_assertion, private_key)
      end
      encrypted_assertions.clear
    end

    def assertion
      assertions.first
    end

    def assertion=(assertion)
      (self.assertions ||= []) << assertion
    end

    def encrypted_assertion
      encrypted_assertions.first
    end

    def encrypted_assertion=(encrypted_assertion)
      (self.encrypted_assertions ||= []) << encrypted_assertion
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
libsaml-3.5.0 lib/saml/response.rb
libsaml-3.4.0 lib/saml/response.rb
libsaml-3.3.0 lib/saml/response.rb
libsaml-3.2.3 lib/saml/response.rb
libsaml-3.2.2 lib/saml/response.rb
libsaml-3.2.1 lib/saml/response.rb
libsaml-3.1.2 lib/saml/response.rb
libsaml-3.1.1 lib/saml/response.rb
libsaml-3.1.0 lib/saml/response.rb
libsaml-3.0.9 lib/saml/response.rb
libsaml-2.24.3 lib/saml/response.rb
libsaml-2.24.2 lib/saml/response.rb
libsaml-3.0.8 lib/saml/response.rb
libsaml-3.0.7 lib/saml/response.rb
libsaml-3.0.6 lib/saml/response.rb
libsaml-3.0.5 lib/saml/response.rb
libsaml-3.0.4 lib/saml/response.rb
libsaml-3.0.3 lib/saml/response.rb
libsaml-3.0.2 lib/saml/response.rb
libsaml-3.0.1 lib/saml/response.rb