Apache::AuthCAS - A configurable Apache authentication module that enables you to protect content on an Apache server using an existing Yale CAS authentication server.
perl -MCPAN -e 'install Apache::AuthCAS'
This module should be loaded in the mod_perl startup script or equivalent.
Add the following lines to an Apache configuration file or .htaccess file:
AuthType Apache::AuthCAS AuthName "CAS" PerlAuthenHandler Apache::AuthCAS->authenticate require valid-user *note* - this simple config assumes that custom settings are configured into the module itself. If not, they will need to be specified with PerlSetVar params (see below for examples).
You can configure this module by placing the devel/production settings in the module itself. This is particular handy if you would like to make authentication with this module available via .htaccess to users whom you would rather not share the database username/password with.
Any options that are not set in the Apache configuration will default to the values preconfigured in the Apache::AuthCAS module. Either explicitly override those options that do not match your environment or set them in the module itself.
The Apache::AuthCAS module allows a user to protect their non-Java content on an Apache server with the Yale CAS authentication server.
Perl modules: Net::SSLeay MIME::Base64 DBI DBD::<module name> (i.e. DBD::Pg)
This module can be optionally configured to use proxy credentials. This is enabled by setting the CASService and CASProxyService configuration parameters.
Example configuration without proxiable credentials, which assumes that the module itself has been configured with devel and production variables set:
AuthType Apache::AuthCAS AuthName "CAS" PerlAuthenHandler Apache::AuthCAS->authenticate PerlSetVar CASProduction "1" require valid-user
Example configuration without proxiable credentials, which has not been modified:
AuthType Apache::AuthCAS AuthName "CAS" PerlAuthenHandler Apache::AuthCAS->authenticate PerlSetVar CASHost "auth.somedomain.com" PerlSetVar CASPort "443" PerlSetVar CASErrorURL "https://somedomain.com/cas/error/" PerlSetVar CASDatabaseName "cas" PerlSetVar CASDatabaseHost "db.somedomain.com" PerlSetVar CASDatabasePort "5432" PerlSetVar CASDatabaseDriver "Pg" PerlSetVar CASDatabaseUser "dbuser" PerlSetVar CASDatabasePass "dbpass" PerlSetVar CASSessionCookieName "APACHECAS" PerlSetVar CASSessionTimeout "1800" PerlSetVar CASLogLevel "0" PerlSetVar CASRemoveTicket "false" require valid-user
Example configuration with proxiable credentials, which assumes that the module itself has been configured with devel and production variables set:
AuthType Apache::AuthCAS AuthName "CAS" PerlAuthenHandler Apache::AuthCAS->authenticate PerlSetVar CASProduction "1" PerlSetVar CASService "https://somedomain.com/email/" PerlSetVar CASProxyService "mail.somedomain.com" require valid-user
Example configuration with proxiable credentials, which has not been modified:
AuthType Apache::AuthCAS AuthName "CAS" PerlAuthenHandler Apache::AuthCAS->authenticate PerlSetVar CASService "https://somedomain.com/email/" PerlSetVar CASProxyService "mail.somedomain.com" PerlSetVar CASNumProxyTickets "1" PerlSetVar CASHost "auth.somedomain.com" PerlSetVar CASPort "443" PerlSetVar CASErrorURL "https://somedomain.com/cas/error/" PerlSetVar CASDatabaseName "cas" PerlSetVar CASDatabaseHost "db.somedomain.com" PerlSetVar CASDatabasePort "5432" PerlSetVar CASDatabaseDriver "Pg" PerlSetVar CASDatabaseUser "dbuser" PerlSetVar CASDatabasePass "dbpass" PerlSetVar CASSessionCookieName "APACHECAS" PerlSetVar CASSessionTimeout "1800" PerlSetVar CASLogLevel "0" PerlSetVar CASRemoveTicket "false" require valid-user
These are Apache configuration option examples for Apache::AuthCAS
# the host name of the CAS server PerlSetVar CASHost "auth.somedomain.com" # the port number for the CAS server PerlSetVar CASPort "443" # are we running with production config or dev config PerlSetVar CASProduction "1" # the URL a client is redirected to after logging in PerlSetVar CASService "https://somedomain.com/email/" # the service proxy tickets will be granted for PerlSetVar CASProxyService "mail.somedomain.com" # number of proxy tickets to give the underlying application PerlSetVar CASNumProxyTickets "2" # the URL the client is redirected to when an error occurs PerlSetVar CASErrorURL "https://somedomain.com/error/" # the name of the DBI database driver PerlSetVar CASDatabaseDriver "Pg" # the host name of the database server PerlSetVar CASDatabaseHost "db.somedomain.com" # the port number of the database server PerlSetVar CASDatabasePort "5433" # the name of the database for sessions/pgtiou mapping PerlSetVar CASDatabaseName "cas" # the user to connnect to the database with PerlSetVar CASDatabaseUser "dbuser" # the password to connect to the databse with PerlSetVar CASDatabasePass "dbpass" # the name of the session table PerlSetVar CASDatabaseSessionTable "cas_sessions" # the name of the pgtiou to pgt mapping table PerlSetVar CASDatabasePGTIOUTable "cas_pgtiou_to_pgt" # the level of logging PerlSetVar CASLogLevel "4" # whether we should perform a redirect, stripping the service ticket # once we have already created a session for the client PerlSetVar CASRemoveTicket "true" # the name of the cookie that will be used for sessions PerlSetVar CASSessionCookieName "APACHECAS" # the max time before a session expires (in seconds) PerlSetVar CASSessionTimeout "1800" # not currently able to override through Apache configuration: # CAS login URI # CAS logout URI # CAS proxy URI # CAS proxy validate URI # CAS service validate URI # parameter used to pass in PGTIOU # parameter used to pass in PGT # session cleanup threshold # basic authentication emulation
This module should work in both mod_perl 1 and 2. For Apache 2/mod_perl 2, the Apache::compat may need to be loaded in your mod_perl startup script. This can be done by adding:
use Apache::compat;
into the script included by the PerlRequire directive in your Apache configuration. For instance, if your Apache configuration includes the line:
PerlRequire /usr/local/sbin/modperl_startup.pl
then the "use" line mentioned above should be added to this file. Consult the mod_perl documentation for more information regarding mod_perl startup scripts.
http://www.yale.edu/tp/auth/
http://perl.apache.org/
David Castro <dcastro@apu.edu>
Copyright (C) 2004 David Castro <dcastro@apu.edu>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To install Apache::AuthCAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::AuthCAS
CPAN shell
perl -MCPAN -e shell install Apache::AuthCAS
For more information on module installation, please visit the detailed CPAN module installation guide.