Class: Arrow::Session::UserTrackId
- Inherits:
-
Id
- Object
- Arrow::Object
- Id
- Arrow::Session::UserTrackId
- Defined in:
- lib/arrow/session/usertrackid.rb
Overview
The Arrow::Session::UsertrackId class, a derivative of Arrow::Session::Id. This class creates session id objects which uses Apache’s builtin mod_usertrack for the session key.
Authors
Michael Granger
Please see the file LICENSE in the top-level directory for licensing details.
Class Method Summary
-
+ (Object) generate(uri, request)
Generate a new id string for the given request.
-
+ (Object) validate(uri, idstring)
Returns an untainted copy of the specified idstring if it is in the expected form for this type of id.
Methods inherited from Id
create, derivativeDirs, #initialize, #new?, #to_s
Methods inherited from Arrow::Object
deprecate_class_method, deprecate_method, inherited
Methods included from Arrow::Loggable
Constructor Details
This class inherits a constructor from Arrow::Session::Id
Class Method Details
+ (Object) generate(uri, request)
Generate a new id string for the given request
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/arrow/session/usertrackid.rb', line 35 def self::generate( uri, request ) if uri.path = uri.path.sub( %r{^/}, '' ) else = 'Apache' end unless request..key?( ) raise SessionError, "No cookie named '%s' was found. Make sure "\ "mod_usertrack is enabled and configured correctly" % end return validate( uri, request.[].value ) end |
+ (Object) validate(uri, idstring)
Returns an untainted copy of the specified idstring if it is in the expected form for this type of id.
26 27 28 29 30 31 |
# File 'lib/arrow/session/usertrackid.rb', line 26 def self::validate( uri, idstring ) return nil if idstring.nil? rval = idstring[/^[\w.]+\.\d+$/] or return nil? rval.untaint return rval end |