Sha256: ccca7d7138733ce6c437727ce658d29516f8302d03b2fda236c7243b05fb5311
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
module HasGlobalSession class Directory attr_reader :authorities, :private_key, :local_authority_name def initialize(keystore_directory) certs = Dir[File.join(keystore_directory, '*.pub')] keys = Dir[File.join(keystore_directory, '*.key')] raise ConfigurationError, "Excepted 0 or 1 key files, found #{keys.size}" unless [0, 1].include?(keys.size) @authorities = {} certs.each do |cert_file| basename = File.basename(cert_file) authority = basename[0...(basename.rindex('.'))] #chop trailing .ext @authorities[authority] = OpenSSL::PKey::RSA.new(File.read(cert_file)) raise ConfigurationError, "Expected #{basename} to contain an RSA public key" unless @authorities[authority].public? end if (authority_name = Configuration['authority']) key_file = keys.detect { |kf| kf =~ /#{authority_name}.key$/ } raise ConfigurationError, "Key file #{authority_name}.key not found" unless key_file @private_key = OpenSSL::PKey::RSA.new(File.read(key_file)) raise ConfigurationError, "Expected #{basename} to contain an RSA private key" unless @private_key.private? @local_authority_name = authority_name end end def trusted_authority?(authority) Configuration['trust'].include?(authority) end def invalidated_session?(uuid) false end def report_exception(exception, cookie=nil) true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
has_global_session-0.8.3 | lib/has_global_session/directory.rb |