LibCAS::Client - A perl module for authenticating and validating against Jasig's CAS server
Version 0.01
LibCAS::Client provides an OO interface for generating URLs and validating tickets for Jasig's Central Authentication Service (CAS).
Using the module should hopefully be straight forward, something similar to:
my $cas = LibCAS::Client->new(cas_url => 'https://my-cas-server/cas'); my $login_url = $cas->login_url(service => 'my_service_name'); # Do a HTTP redirect to $login_url to have CAS prompt for credentials # or to have the CAS server issue a service ticket. my $r = $cas->service_validate(service => 'my_service_name', ticket => 'ticket_from_login'); if ($r->is_success()) { # Do things for successful authentication } elsif ($r->is_failure()) { # Do things for failed authentication } else { # Anything that makes it here is an error }
Create a new instance of the LibCAS::Client object. Valid parameters are:
https://localhost/cas
/login
/logout
/validate
/proxy
/serviceValidate
/proxyValidate
Generate the login url needed for the CAS server, depending on the cas_url and cas_login_path parameters passed during object construction.
cas_url
cas_login_path
Valid parameters to the login_url method are:
login_url
Generate the logout url needed for the CAS server, depending on the cas_url and cas_logout_path parameters passed during object construction.
cas_logout_path
NOTE: Calling this method will destroy the single sign-on session, which may affect the client's ability to access other applications protected by this CAS server.
Valid parameters to the logout_url method are:
logout_url
Generate the URL that performs CAS protocol version 1.0 service ticket validation.
Valid parameters to the validate_url method are:
validate_url
Generate the URL that performs CAS protocol version 2.0 service ticket validation, and generate proxy- granting tickets, if requested.
Valid parameters to the service_validate_url method are:
service_validate_url
Generate the URL to the CAS server for generating proxy tickets.
Valid parameters to the proxy_url method are:
proxy_url
This method performs the same functions as the service_validate_url method, with the added benefit of being able to validate proxy tickets as well.
Valid parameters for proxy_validate_url are the same as they are for service_validate_url
proxy_validate_url
Validate a service ticket using CAS protocol version 1.0. Supported arguments for this method are the same as they are for the validate_url method.
Returns an LibCAS::Client::Response object to denote whether or not the validation was successful. Success, failure, or error conditions can be checked by calling the is_success(), is_failure(), or is_error() methods on the returned object.
is_success()
is_failure()
is_error()
Validate a service ticket using CAS protocol version 2.0. Supported arguments for this method are the same as they are for the service_validate_url method.
Obtain a proxy ticket to services that have a proxy granting ticket, and will be using proxy authentication to a back-end service. Supported arguments for this method are the same as they are for the service_validate_url method.
Validate a service ticket, or a proxy ticket, using CAS protocol version 2.0. Supported arguments for this method are the same as they are for the proxy_validate_url method.
"Mike Morris", <"michael.m.morris at gmail.com">
<"michael.m.morris at gmail.com">
You can find documentation for this module with the perldoc command.
perldoc LibCAS::Client
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=LibCAS
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/LibCAS
CPAN Ratings
http://cpanratings.perl.org/d/LibCAS
Search CPAN
http://search.cpan.org/dist/LibCAS/
This code is derived from Authen::CAS::Client and AuthCAS, with the added ability to customize the paths for the services on the CAS server, and use URI and XML parsing libs.
Documentation for the CAS protocol can be found at http://www.jasig.org/cas/protocol
Copyright 2012 "Michael Morris".
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install LibCAS::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LibCAS::Client
CPAN shell
perl -MCPAN -e shell install LibCAS::Client
For more information on module installation, please visit the detailed CPAN module installation guide.