1# $Id: PH.pm,v 1.1 1999/11/11 03:28:32 jgsmith Exp $ 2# 3# Copyright (c) 1999, Texas A&M University 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 3. Neither the name of the University nor the names of its contributors 15# may be used to endorse or promote products derived from this software 16# without specific prior written permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTERS ``AS IS'' 19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28# POSSIBILITY OF SUCH DAMAGE. 29 30# 31# Sample derivation from Authen::Ticket using the CCSO Nameserver 32# 33 34# 35# Put the following in the httpd.conf file: 36# 37# For client website: 38# 39# PerlAccessHandler My::PH 40# PerlSetVar TM_Domain .tamu.edu 41# ErrorDocument 403 http://ticket.tamu.edu/ 42# 43# For server website: 44# 45# PerlHandler My::PH 46# 47 48use strict; 49 50# 51# main switch class 52# 53 54package My::PH; 55 56use vars (qw/@ISA $VERSION/); 57 58$VERSION = '0.01'; 59@ISA = (qw/Authen::Ticket/); 60 61# 62# ticket server class 63# 64 65package My::PH::Server; 66 67use vars (qw/@ISA $VERSION %DEFAULTS/); 68 69use Net::PH (); 70 71$VERSION = '0.01'; 72@ISA = (qw/Authen::Ticket::Server/); 73#@ISA = (qw/Authen::Ticket::Server Authen::Ticket::Signature/); 74%DEFAULTS = ( 75 TicketNameserver => 'ns.tamu.edu', 76 TicketNameserverPort => '105', 77}; 78 79sub authenticate { 80 my($class, $r, $u) = @_; 81 82 my $ph = new Net::PH($self->{TicketNameserver}, 83 $self->{TicketNameserverPort}); 84 85 if($ph->login($u->{user}, $u->{password}, 1)) { 86 $ph->logout; 87 return { }; 88 } 89 return undef; 90} 91 92# 93# ticket client class 94# 95 96package My::PH::Client; 97 98use vars (qw/@ISA $VERSION/); 99 100$VERSION = '0.01'; 101@ISA = (qw/Authen::Ticket::Client/); 102#@ISA = (qw/Authen::Ticket::Client Authen::Ticket::Signature/); 103 1041; 105