Debian Codegraph @

README

raw
1 Authen::CAS::Client is an implementation of a client for use with
2 JA-SIG's Central Authentication Service.
3
4
5 More information about the CAS protocol can be found
6 at the JA-SIG CAS homepage:
7
8 http://www.ja-sig.org/products/cas/
9
10
11 To install this module, use the following steps:
12
13 perl Makefile.PL
14 make
15 make test
16 make install
17
18
19 NAME
20 Authen::CAS::Client - Provides an easy-to-use interface for
21 authentication using JA-SIG's Central Authentication Service
22
23 SYNOPSIS
24 use Authen::CAS::Client;
25
26 my $cas = Authen::CAS::Client->new( 'https://example.com/cas' );
27
28
29 # generate an HTTP redirect to the CAS login URL
30 my $r = HTTP::Response->new( 302 );
31 $r->header( Location => $cas->login_url );
32
33
34 # generate an HTTP redirect to the CAS logout URL
35 my $r = HTTP::Response->new( 302 );
36 $r->header( Location => $cas->logout_url );
37
38
39 # validate a service ticket (CAS v1.0)
40 my $r = $cas->validate( $service, $ticket );
41 if( $r->is_success ) {
42 print "User authenticated as: ", $r->user, "\n";
43 }
44
45 # validate a service ticket (CAS v2.0)
46 my $r = $cas->service_validate( $service, $ticket );
47 if( $r->is_success ) {
48 print "User authenticated as: ", $r->user, "\n";
49 }
50
51
52 # validate a service/proxy ticket (CAS v2.0)
53 my $r = $cas->proxy_validate( $service, $ticket );
54 if( $r->is_success ) {
55 print "User authenticated as: ", $r->user, "\n";
56 print "Proxied through:\n";
57 print " $_\n"
58 for $r->proxies;
59 }
60
61
62 # validate a service ticket and request a proxy ticket (CAS v2.0)
63 my $r = $cas->service_validate( $server, $ticket, pgtUrl => $url );
64 if( $r->is_success ) {
65 print "User authenticated as: ", $r->user, "\n";
66
67 unless( defined $r->iou ) {
68 print "Service validation for proxying failed\n";
69 }
70 else {
71 print "Proxy granting ticket IOU: ", $r->iou, "\n";
72
73 ...
74 # map IOU to proxy granting ticket via request to pgtUrl
75 ...
76
77 $r = $cas->proxy( $pgt, $target_service );
78 if( $r->is_success ) {
79 print "Proxy ticket issued: ", $r->proxy_ticket, "\n";
80 }
81 }
82 }
83
84 DESCRIPTION
85 The Authen::CAS::Client module provides a simple interface for
86 authenticating users using JA-SIG's CAS protocol. Both CAS v1.0 and v2.0
87 are supported.
88
89 METHODS
90 new $url [, %args]
91 "new()" creates an instance of an "Authen::CAS::Client" object. $url
92 refers to the CAS server's base URL. %args may contain the following
93 optional parameter:
94
95 fatal => $boolean
96 If this argument is true, the CAS client will "die()" when an error
97 occurs and $@ will contain the error message. Otherwise an
98 "Authen::CAS::Client::Response::Error" object will be returned. See
99 Authen::CAS::Client::Response for more detail on response objects.
100
101 login_url $service [, %args]
102 "login_url()" returns the CAS server's login URL which can be used to
103 redirect users to start the authentication process. $service is the
104 service identifier that will be used during validation requests. %args
105 may contain the following optional parameters:
106
107 renew => $boolean
108 This causes the CAS server to force a user to re-authenticate even if an
109 SSO session is already present for that user.
110
111 gateway => $boolean
112 This causes the CAS server to only rely on SSO sessions for
113 authentication. If an SSO session is not available for the current user,
114 validation will result in a failure.
115
116 logout_url [%args]
117 "logout_url()" returns the CAS server's logout URL which can be used to
118 redirect users to end authenticated sessions. %args may contain the
119 following optional parameter:
120
121 url => $url
122 If present, the CAS server will present the user with a link to the
123 given URL once the user has logged out.
124
125 validate $service, $ticket [, %args]
126 "validate()" attempts to validate a service ticket using the CAS v1.0
127 protocol. $service is the service identifier that was passed to the CAS
128 server during the login process. $ticket is the service ticket that was
129 received after a successful authentication attempt. Returns an
130 appropriate Authen::CAS::Client::Response object. %args may contain the
131 following optional parameter:
132
133 renew => $boolean
134 This will cause the CAS server to respond with a failure if
135 authentication validation was done via a CAS SSO session.
136
137 service_validate $service, $ticket [, %args]
138 "service_validate()" attempts to validate a service ticket using the CAS
139 v2.0 protocol. This is similar to "validate()", but allows for greater
140 flexibility when there is a need for proxying authentication to back-end
141 services. The $service and $ticket parameters are the same as above.
142 Returns an appropriate Authen::CAS::Client::Response object. %args may
143 contain the following optional parameters:
144
145 renew => $boolean
146 This will cause the CAS server to respond with a failure if
147 authentication validation was done via a CAS SSO session.
148
149 pgtUrl => $url
150 This tells the CAS server that a proxy ticket needs to be issued for
151 proxying authentication to a back-end service. $url corresponds to a
152 callback URL that the CAS server will use to verify the service's
153 identity. Per the CAS specification, this URL must be HTTPS. If this
154 verification fails, normal validation will occur, but a proxy granting
155 ticket IOU will not be issued.
156
157 Also note that this call will block until the CAS server completes its
158 service verification attempt. The returned proxy granting ticket IOU can
159 then be used to retrieve the proxy granting ticket that was passed as a
160 parameter to the given URL.
161
162 proxy_validate $service, $ticket [, %args]
163 "proxy_validate()" is almost identical in operation to
164 "service_validate()" except that both service tickets and proxy tickets
165 can be used for validation and a list of proxies will be provided if
166 proxied authentication has been used. The $service and $ticket
167 parameters are the same as above. Returns an appropriate
168 Authen::CAS::Client::Response object. %args may contain the following
169 optional parameters:
170
171 renew => $boolean
172 This is the same as described above.
173
174 pgtUrl => $url
175 This is the same as described above.
176
177 proxy $pgt, $target
178 "proxy()" is used to retrieve a proxy ticket that can be passed to a
179 back-end service for proxied authentication. $pgt is the proxy granting
180 ticket that was passed as a parameter to the "pgtUrl" specified in
181 either "service_validate()" or "proxy_validate()". $target is the
182 service identifier for the back-end system that will be using the
183 returned proxy ticket for validation. Returns an appropriate
184 Authen::CAS::Client::Response object.
185
186 BUGS
187 None are known at this time, but if you find one, please feel free to
188 submit a report to the author.
189
190 AUTHOR
191 jason hord <[email protected]>
192
193 SEE ALSO
194 Authen::CAS::Client::Response
195
196 More information about CAS can be found at JA-SIG's CAS homepage:
197 <http://www.ja-sig.org/products/cas/>
198
199 LICENSE
200 This software is information. It is subject only to local laws of
201 physics.
202