Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
OpenXPKI::Server::SessUser3Contributed Perl DocumeOpenXPKI::Server::Session(3)

NAME
       OpenXPKI::Server::Session - Factory to create, persist and resume
       sessions

SYNOPSIS
       To start	a new session:

	   my $session = OpenXPKI::Server::Session->new(load_config => 1)->create;
	   $session->data->pki_realm("democa");
	   ...
	   $session->persist;

       To resume an existing session:

	   my $session = OpenXPKI::Server::Session->new(load_config => 1);
	   $session->resume($id);

       Or if you want to specify config	and logger explicitely:

	   my $session = OpenXPKI::Server::Session
	       ->new(
		   type	=> "Database",
		   config => { dbi => $dbi },
		   log => OpenXPKI::Server::Log->new,
	       )
	       ->create;
	   ...

       The parameters in the "config" HashRef are directly passed as
       constructor parameters to the session driver class (i.e.	to
       "OpenXPKI::Server::Session::Driver::Database->new" in the example)

STATIC METHODS
   new
       Constructor that	creates	a new session with an empty data object.

METHODS
   id
       Accessor	to get or set the session ID (shortcut for
       "$session->data->id").

   is_valid
       Accessor	to mark	the session as "valid" or query	the current state
       (shortcut for "$session->data->is_valid").

   data_as_hashref
       Returns a HashRef containing names and values of	all previously set
       session attributes.

       Parameters

       o   @attrs - optional: list of attribute	names if only a	subset shall
	   be returned.

   is_initialized
       Returns 1 if the	session	is initialized,	i.e. either data has been set
       or a persisted session was resumed.

   create
       Creates a new sesssion.

   resume
       Resume the specified session by loading its data	from the backend
       storage.

       Returns the object reference to "OpenXPKI::Server::Session" if the
       session was successfully	resumed	or undef otherwise (i.e. expired
       session or unknown ID).

       Parameters

       o   $id - session ID

   persist
       Saves the session to the	backend	storage	if any session data has
       changed.

       Returns 1 if data was actually written to the backend, "undef"
       otherwise.

       Named parameters

       o   force - "Bool" force	writing	session	even if	nothing	has changed.
	   This	will update the	modified timestamp of the stored session.

   delete
       Deletes the session data	from the backend storage and then from this
       session object, so that it cannot be access anymore.

       Returns 1 if data was actually written to the backend or	"undef"	if
       there is	no session data	yet.

   new_id
       Switches	the session to a new ID	and updates the	backend.

       Returns the new session ID.

   purge_expired
       Deletes all sessions that are expired from the backend storage.

   is_expired
       Returns true if the current session is expired.

perl v5.32.0			  2020-08-29	  OpenXPKI::Server::Session(3)

NAME | SYNOPSIS | STATIC METHODS | METHODS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=OpenXPKI::Server::Session&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help