lib/global_session/directory.rb in global_session-3.2.10 vs lib/global_session/directory.rb in global_session-3.3.0
- old
+ new
@@ -26,11 +26,11 @@
# to instances of Session.
#
# The default implementation is simplistic, but should be suitable for most applications.
# Directory is designed to be specialized via subclassing. To override the behavior to
# suit your needs, simply create a subclass of Directory and add a configuration file
- # setting to specify the class name of your implementation:
+ # setting to specify the class name of your implementation:
#
# common:
# directory:
# class: MyCoolDirectory
#
@@ -106,25 +106,27 @@
#
# ===Raise
# InvalidSession:: if the session contained in the cookie has been invalidated
# ExpiredSession:: if the session contained in the cookie has expired
# MalformedCookie:: if the cookie was corrupt or malformed
- # SecurityError:: if signature is invalid or cookie is not signed by a trusted authority
+ # InvalidSignature:: if signature is invalid or cookie is not signed by a trusted authority
def create_session(cookie=nil)
forced_version = configuration['cookie']['version']
if cookie.nil?
# Create a legitimately new session
case forced_version
- when 3, nil
+ when 4
+ Session::V4.new(self, cookie)
+ when nil, 3
Session::V3.new(self, cookie)
when 2
Session::V2.new(self, cookie)
when 1
Session::V1.new(self, cookie)
else
- raise ArgumentError, "Unknown value #{forced_version} for configuration.cookie.version"
+ raise ArgumentError, "Unknown value #{forced_version} for configuration.cookie.version"
end
else
warn "GlobalSession::Directory#create_session with an existing session is DEPRECATED -- use #load_session instead"
load_session(cookie)
end
@@ -140,11 +142,11 @@
#
# ===Raise
# InvalidSession:: if the session contained in the cookie has been invalidated
# ExpiredSession:: if the session contained in the cookie has expired
# MalformedCookie:: if the cookie was corrupt or malformed
- # SecurityError:: if signature is invalid or cookie is not signed by a trusted authority
+ # InvalidSignature:: if signature is invalid or cookie is not signed by a trusted authority
def load_session(cookie)
Session.new(self, cookie)
end
# @return [Hash] map of String authority-names to OpenSSL::PKey public-keys
@@ -168,10 +170,10 @@
# @deprecated will be removed in GlobalSession v4; please use Keystore instead
# @see GlobalSession::Keystore
def local_authority_name
@keystore.private_key_name
end
-
+
# Determine whether this system trusts a particular named authority based on
# the settings specified in Configuration and/or the presence of public key
# files on disk.
#
# === Parameters