Apache2-PageKit

 view release on metacpan or  search on metacpan

docsrc/reference.xml  view on Meta::CPAN

			LockHandle => $dbh,
			},
	};
  }

  # this one is if you prefer PostgreSQL
  sub pkit_session_setup {
    my $model = shift;
    my $dbh = $model->dbh;

    my %session_setup = (
  	session_store_class => 'Postgres',
  	session_lock_class => 'Null',
  	session_serialize_class => 'Base64',
  	session_args => {
  			 Handle => $dbh,
                           IDLength => 32,
                           Commit => 0,
                          }
    );
    return \%session_setup;
  }

     </synopsis>
    </refsynopsisdiv>
    <refsect1>
     <title>Description</title>
     <para>
      Method must return a hash reference using <ulink url="http://kobesearch.cpan.org/search?dist=Apache-SessionX">Apache::SessionX</ulink> session
      setup arguments.  This hash reference should contain the following key/value pairs:
     </para>
     <variablelist>
      <varlistentry>
       <term>session_store_class</term>
       <listitem>
        The object store class that should be used for
         Apache::SessionX session handling.
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>session_lock_class</term>
       <listitem>
        The lock manager class that should be used for
        Apache::PageKit::Session session handling.
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>session_args</term>
       <listitem>
        Reference to an hash containing options for the
        <literal>session_lock_class</literal> and <literal>session_store_class</literal>
       </listitem>
      </varlistentry>
     </variablelist>
    </refsect1>
   </refentry>
   <refentry id="model.api.pkit_auth_credential">
    <refnamediv>
     <refname>pkit_auth_credential</refname>
     <refpurpose>
      Verifies login credentials and returns session key
     </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
     <synopsis>
  sub pkit_auth_credential {
    my ($model) = @_;

    # in this example, login and passwd are the names of the credential fields
    my $login = $model->input('login');
    my $passwd = $model->input('passwd');

    # create a session key
    # your code here.........

    return $ses_key;
  }
     </synopsis>
    </refsynopsisdiv>
    <refsect1>
     <title>Description</title>
     <para>
Verifies the user-supplied credentials and return a session key.  The
session key is a string that is stored on the user's computer using cookies.
Often you'll use the user ID and a MD5 hash of a a secret key, user ID, password.
     </para>
     <para>
Note that the string returned should not contain any commas, spaces, or semi-colons.
     </para>
    </refsect1>
   </refentry>
   <refentry id="model.api.pkit_auth_session_key">
    <refnamediv>
     <refname>pkit_auth_session_key</refname>
     <refpurpose>Verifies a session key and returns the user ID and session ID
     </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
     <synopsis>
  sub pkit_auth_session_key {
    my ($model, $ses_key) = @_;

    # check whether $ses_key is valid, if so return user id in $user_id
    # your code here.........

    return $ok ? ($user_id, $session_id) : undef;
  }
     </synopsis>
    </refsynopsisdiv>
    <refsect1>
     <title>Description</title>
     <para>
Verifies the session key (previously generated by <link linkend="model.api.pkit_auth_credential">auth_credential</link>)
and returns the user ID, and session ID.
     </para>
     <para>
The returned user ID will be fed to <literal>$r-&gt;connection-&gt;user</literal>.
     </para>
     <para>
The returned session ID will used to retreive the session from the database.
     </para>
    </refsect1>
   </refentry>
   <refentry id="model.api.pkit_common_code">
    <refnamediv>
     <refname>pkit_common_code</refname>
     <refpurpose>
      Code common across site.
     </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
     <synopsis>
  sub pkit_common_code {
    my $model = shift;

    # code that should be executed for every page on your site here...
  }
     </synopsis>
    </refsynopsisdiv>
    <refsect1>
     <title>Description</title>
     <para>
Code that gets called before the page and component code for every page on

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.948 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )