1AuthCAS(3) User Contributed Perl Documentation AuthCAS(3)
2
3
4
6 AuthCAS - Client library for CAS 2.0 authentication server
7
9 Version 1.5
10
12 AuthCAS aims at providing a Perl API to Yale's Central Authentication
13 System (CAS). Only a basic Perl library is provided with CAS whereas
14 AuthCAS is a full object-oriented library. =head1 PREREQUISITES
15
16 This script requires IO::Socket::SSL and LWP::UserAgent
17
18 any
19
20 Network
21
23 A simple example with a direct CAS authentication
24
25 use AuthCAS;
26 my $cas = new AuthCAS(casUrl => 'https://cas.myserver,
27 CAFile => '/etc/httpd/conf/ssl.crt/ca-bundle.crt',
28 );
29
30 my $login_url = $cas->getServerLoginURL('http://myserver/app.cgi');
31
32 ## The user should be redirected to the $login_url
33 ## When coming back from the CAS server a ticket is provided in the QUERY_STRING
34
35 ## $ST should contain the receaved Service Ticket
36 my $user = $cas->validateST('http://myserver/app.cgi', $ST);
37
38 printf "User authenticated as %s\n", $user;
39
40
41 In the following example a proxy is requesting a Proxy Ticket for the target application
42
43 $cas->proxyMode(pgtFile => '/tmp/pgt.txt',
44 pgtCallbackUrl => 'https://myserver/proxy.cgi?callback=1
45 );
46
47 ## Same as before but the URL is the proxy URL
48 my $login_url = $cas->getServerLoginURL('http://myserver/proxy.cgi');
49
50 ## Like in the previous example we should receave a $ST
51
52 my $user = $cas->validateST('http://myserver/proxy.cgi', $ST);
53
54 ## Process errors
55 printf STDERR "Error: %s\n", &AuthCAS::get_errors() unless (defined $user);
56
57 ## Now we request a Proxy Ticket for the target application
58 my $PT = $cas->retrievePT('http://myserver/app.cgi');
59
60 ## This piece of code is executed by the target application
61 ## It received a Proxy Ticket from the proxy
62 my ($user, @proxies) = $cas->validatePT('http://myserver/app.cgi', $PT);
63
64 printf "User authenticated as %s via %s proxies\n", $user, join(',',@proxies);
65
67 CAS is Yale University's web authentication system, heavily inspired by
68 Kerberos. Release 2.0 of CAS provides "proxied credential" feature
69 that allows authentication tickets to be carried by intermediate
70 applications (Portals for instance), they are called proxy.
71
72 This AuthCAS Perl module provides required subroutines to validate and
73 retrieve CAS tickets.
74
76 Yale Central Authentication Service (http://www.yale.edu/tp/auth/)
77 phpCAS (http://esup-phpcas.sourceforge.net/)
78
80 Copyright (C) 2003 Comite Reseau des Universites (http://www.cru.fr).
81 All rights reserved.
82
83 This library is free software; you can redistribute it and/or modify it
84 under the same terms as Perl itself.
85
87 Olivier Salaun
88
89
90
91perl v5.12.3 2011-05-23 AuthCAS(3)