Authen-Ticket
view release on metacpan or search on metacpan
lib/Authen/Ticket/Client.pm view on Meta::CPAN
}
foreach my $k (keys %defaults) {
$$self{$k} ||= $opts{$k} || $defaults{$k};
$self->debug("$k set to $$self{$k}");
}
}
sub initialize { }
sub decode_cookie {
my($self, $ticket) = @_;
return decode_base64($ticket);
}
sub deconstruct_cookie {
my($self, $ticket) = @_;
my $t = { };
$self->debug("Ticket: [$ticket]");
$ticket .= ',';
my @parts = $ticket =~ m{((.*?) # keyword match
\s*=\s* #
(("(.*?)",)|((.*?),)) # value match
)
}gx
;
@parts = grep(!/^\s*$/, @parts);
foreach my $i (0..(@parts/5)) {
# tag = 1 mod 5
# value = 4 mod 5
$t->{$parts[$i*5+1]} = $parts[$i*5+4];
}
return $t;
}
1;
__END__
=pod
=head1 NAME
Authen::Ticket::Client - Authentication code for the client website
=head1 DESCRIPTION
Authen::Ticket::Client contains the basic tools required to decode and
reconstruct the information in a ticket. See Authen::Ticket for the
mod_perl access handler using Authen::Ticket::Client.
=head1 METHODS
=over 4
=item decode_cookie($class, $ticket)
This subroutine returns the decoded version of the ticket. This is the
place to put decryption of the cookie or other checks that do not
depend on understanding the information within the ticket. The default
version decodes from base 64. The return value is the decoded
string representation of the ticket.
=item deconstruct_cookie($class, $ticket)
This subroutine breaks the ticket apart into field values. The return
value is a hash reference containing the key/value pairs. This subroutine
should only be concerned with ensuring a properly constructed ticket.
=item initialize()
This subroutine may be used to perform particular class initialization
beyond the defaults provided by Ticket::Authen::Client->new. Any
configuration variables for the httpd configuration file should be
placed in the %__PACKAGE__::DEFAULTS hash.
=head1 AUTHOR
James G. Smith, <jgsmith@tamu.edu>
=head1 COPYRIGHT
Copyright (c) 1999, Texas A&M University. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. Neither the name of the University nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTERS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
=head1 SEE ALSO
perl(1), Authen::Ticket(3), Authen::Ticket::Server(3)
=cut
( run in 1.046 second using v1.01-cache-2.11-cpan-7fcb06a456a )