Sha256: 03d0a94ec88ea64f3c49d9a4c8dc6c74bd1b4f1a0518f26bd1086afb2e872c77
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require "xml_security" require "time" module Onelogin::Saml class Response attr_accessor :response, :document, :logger, :settings def initialize(response) raise ArgumentError.new("Response cannot be nil") if response.nil? self.response = response self.document = XMLSecurity::SignedDocument.new(Base64.decode64(response)) end def is_valid? return false if response.empty? return false if settings.nil? return false if settings.idp_cert_fingerprint.nil? document.validate(settings.idp_cert_fingerprint, logger) end # The value of the user identifier as designated by the initialization request response def name_id @name_id ||= document.elements["/samlp:Response/saml:Assertion/saml:Subject/saml:NameID"].text end # When this user session should expire at latest def session_expires_at @expires_at ||= Time.parse(document.elements["/samlp:Response/saml:Assertion/saml:AuthnStatement"].attributes["SessionNotOnOrAfter"]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-saml-0.2.3 | lib/onelogin/saml/response.rb |
ruby-saml-0.2.2 | lib/onelogin/saml/response.rb |