AuthCASpbh::UserAgent - CAS proxy authentication client for Apache/mod_perl


        use Apache2::AuthCASpbh::UserAgent;

        my $ua = Apache2::AuthCASpbh::UserAgent->new(
                        apache_r => $r,
                        cas_cookie_map => [ { URL_re => '^https://my\.server/cas' },
                                            { URL_re => '^https://other\.server/ssoapp',
                                              cookie_name => 'CAS_Cookie' } ]);

        my $req = HTTP::Request->new('GET', 'https://my.server/');


AuthCASpbh::UserAgent is a derivative of LWP::UserAgent that adds transparent support for proxy CAS authentication. All of the documentation for LWP::UserAgent applies, and any method or configuration described in that documentation is supported by an Apache2::AuthCASpbh::UserAgent object.

AuthCASpbh::UserAgent adds two configuration options to the new() method as defined by LWP::UserAgent:


The Apache/mod_perl request object for the request in which AuthCASpbh::UserAgent is being used. This parameter is mandatory.

This parameter controls how AuthCASpbh handles automatically managing CAS session cookies for requests. It takes a reference to an array, with the array members being references to hashes with the following components:


A regular expression compared against the request being made to determine whether or not this entry applies to the request. Comparisons are made are in order beginning with the first hash reference in the array, and the first match ends the search.

An optional value defining the name of the session cookie used by the remote application. If no value is supplied, the value of the SessionCookieName parameter for the calling request is used.

If no cas_cookie_map is supplied, no automated session management will be performed and your application is responsible for implementing a mechanism such that all requests made after the initial successful authentication access that session, or else authentication will be performed on every request.

Note that if no cookie_jar was supplied and this option exists, a default cookie_jar will be created. If the request matches one of the URL_re entries, and a cookie with the configured name is returned, AuthCASpbh::UserAgent will store the cookie and inject it into future requests that match the same URL_re.


AuthCASpbh is available via CPAN as well as on GitHub at


Copyright (c) 2018, Paul B. Henson <>

This file is part of AuthCASpbh.

AuthCASpbh 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 3 of the License, or (at your option) any later version.

AuthCASpbh 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 AuthCASpbh. If not, see <>.


Apache2::AuthCASpbh - Overview and configuration details

Apache2::AuthCASpbh::Authz - Authorization functionality

Apache2::AuthCASpbh::ProxyCB - Proxy granting ticket callback module

Apache2::AuthCASpbh::UserAgent - Proxy authentication client