You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Brian P Millett <bp...@ec-group.com> on 2003/02/14 20:40:26 UTC

patch (FWIW) AuthCookie & AuthCookieDBI

Hi,
    For waht its worth, I've gotten the Apache-AuthCookie & 
Apache-AuthCookieDBI to work with my apache configured as:
Apache/2.0.44 (Unix) mod_perl/1.99_09-dev Perl/v5.8.0 mod_ssl/2.0.44 
OpenSSL/0.9.6g DAV/2 PHP/4.3.0 mod_jk2/2.0.2

I hope someone finds this a bit usefull, sorry to post here if this is 
not the correct forum


It works fine with the following modperl.conf parameters:
(Cookies are not created if "domain" is set)

    PerlModule Apache::compat
    PerlModule ModPerl::Registry
    PerlModule Apache::AuthDBI
    PerlModule Apache::AuthenIMAP
    PerlTaintCheck Off

    Alias /modperl/ "/opt/apache2/modperl/"
    <Directory "/opt/apache2/modperl">
        Options Indexes MultiViews All
        AllowOverride FileInfo AuthConfig Limit
        <Limit GET POST PUT>
               Order allow,deny
               Allow from 192.168.250.
               Deny from 192.168.250.199
        </Limit>
    </Directory>
    <Location /modperl>
         SetHandler  perl-script
         PerlOptions +GlobalRequest
         PerlResponseHandler ModPerl::Registry
         Options +ExecCGI
    </Location>

    # This PerlSetVar MUST precede the PerlModule line because the
    # key is read in a BEGIN block when the module is loaded.
    PerlSetVar ECGDBI_SecretKeyFile /opt/apache2/conf/ec-group.com.key

    PerlModule Apache::AuthCookieDBI
    PerlSetVar AuthCookieDebug 0
    PerlSetVar ECGPath /protected
    # Usually documents are uncached - turn off here
    PerlSetVar ECGCache 1
    PerlSetVar ECGLoginScript /modperl/authLogin.pl

    # Optional, to share tickets between servers.
    # PerlSetVar ECGDomain .ec-group.com
   
    # These must be set
    PerlSetVar ECGDBI_DSN "DBI:Pg:dbname=acl;host=localhost"

    # Sample for postgreSQL to populate users:
    # Schema for creating the database tables for an authentication system.

    #CREATE TABLE users (
    #    username     CHAR(16) PRIMARY KEY,
    #    passwd       VARCHAR(50)
    #);

    #CREATE TABLE groups (
    #    org      CHAR(16),
    #    username CHAR(16)
    #);

    # These are optional, the module sets sensible defaults.
    PerlSetVar ECGDBI_User "XXXX"
    PerlSetVar ECGDBI_Password "XXXX"
    PerlSetVar ECGDBI_UsersTable "users"
    PerlSetVar ECGDBI_UserField "username"
    PerlSetVar ECGDBI_PasswordField "passwd"
    PerlSetVar ECGDBI_CryptType "md5"
    PerlSetVar ECGDBI_GroupsTable "groups"
    PerlSetVar ECGDBI_GroupField "org"
    PerlSetVar ECGDBI_GroupUserField "username"
    PerlSetVar ECGDBI_EncryptionType "none"
    PerlSetVar ECGDBI_SessionLifetime 00-24-00-00

    # Protected by AuthCookieDBI.
    <Location /protected>
        AuthType Apache::AuthCookieDBI
        AuthName ECG
        #SetHandler perl-script
        PerlOptions +GlobalRequest
        Options ExecCGI
        PerlAuthenHandler Apache::AuthCookieDBI->authenticate
        PerlAuthzHandler Apache::AuthCookieDBI->authorize
        require valid-user
        require group ec-group
    </Location>

    # Login location.
    <Files LOGIN>
        AuthType Apache::AuthCookieDBI
        AuthName ECG
        PerlOptions +GlobalRequest
        SetHandler perl-script
        PerlResponseHandler Apache::AuthCookieDBI->login
    </Files>

-- 
Brian Millett                    
Enterprise Consulting Group   "Shifts in paradigms
(314) 205-9030               often cause nose bleeds."
bpm@ec-group.com                           Greg Glenn


Re: patch (FWIW) AuthCookie & AuthCookieDBI

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>  
> -      $r->connection->auth_type($auth_type);
> -      $r->connection->user($auth_user);
> +      $r->auth_type($auth_type);
> +      $r->user($auth_user);

you can see my rather long (and one sided) threads on this list today for 
more details, but $r->auth_type is not the same as $r->connection->auth_type.

if you're looking to do without Apache::compat, then you should use my patch 
and $r->ap_auth_type instead.  if using Apache::compat, then you can keep 
$r->connection->auth_type.

I'd recommend you mail the maintainers of these modules directly to gain 2.0 
support.  in particular $r->user is already in 1.0 as an alias for 
$r->connection->user, and the constants are available there as well.  so, 
according to your changes, with a few simple changes both these modules can 
be made to work under either Apache::compat or 1.0 without any 
modifications.  cool.

--Geoff




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org