NAME
Authen::CAS::External::UserAgent - UserAgent role for CAS session managers.
VERSION
This documentation refers to version 0.08.
SYNOPSIS
package MyCAS::Session;
use Moose;
# Use this role
with 'Authen::CAS::External::UserAgent';
sub get_cas_credentials {
my ($self, $service) = @_;
# Do something
return $username, $password;
}
sub get_cas_ticket_granting_cookie {
my ($self, $username, $service) = @_;
# Do something
return $TGC;
}
1;
DESCRIPTION
Provides a way to authenticate with a CAS server just as a browser would. This is useful with web scrapers needing to login to a CAS site.
ROLE REQUIRES
This is a Moose::Role and for this role to be used, the user MUST provide the following two methods:
get_cas_credentials
This is called as a method with the first argument being a string that is the URL of the service that is about to be logged in to. If no service is being logged in to, then it will be undefined. This function is expected to return a username string and a password string, both of which are optional, but MUST be returned in that order.
get_cas_ticket_granting_cookie
This is called as a method with the first argument being a string that is the username being used and the second argument being a string that is the URL of the service that is about to be logged into. This function is expected to return a string that is the ticket granting cookie for the CAS service, or nothing.
ATTRIBUTES
cas_url
This is a URI object of the base URL of the CAS site. This is typically the path before /login
. A string may be supplied and will automatically be converted to a URI object.
previous_response
This holds the response object Authen::CAS::External::Response from the last executed CAS navigation.
redirect_back
This is a Boolean that determines if the "user_agent" will navigate outside of the "cas_url". The default is 0
.
user_agent
This is a LWP::UserAgent that is used to navigate the CAS site. The default is LWP::UserAgent with an in-memory cookie jar and allows the POST
method to be redirectable.
METHODS
clear_previous_response
This will clear the "previous_response" attribute.
get
This is an alias to the get
method of the "user_agent".
has_previous_response
This will return if there is a value present in the "previous_response" attribute.
service_request_url
service_request_url(%args)
This method will return a URI object that is the URL to request for the CAS login page. All arguments are optional. The following are the possible arguments:
cas_url
Added in version 0.06; be sure to require this version for this feature.
This is the URL of the CAS deployment to use. By default this will use the "cas_url" attribute. This can be either a URI object or a string.
service
This is a string of the service URL to log in to.
gateway
This is a Boolean of whether or not to use gateway login mode.
renew
This is a Boolean to whether or not to renew the session.
DEPENDENCIES
HTML::Form 5.817
HTML::TokeParser 3.00
HTTP::Status 5.817
LWP::UserAgent 5.819
Moose::Role 0.89
Scalar::Util 1.14
URI 1.22
namespace::clean 0.04
AUTHOR
Douglas Christopher Wilson, <doug at somethingdoug.com>
BUGS AND LIMITATIONS
Please report any bugs or feature requests to bug-authen-cas-external at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Authen-CAS-External. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
I highly encourage the submission of bugs and enhancements to my modules.
LICENSE AND COPYRIGHT
Copyright 2009 Douglas Christopher Wilson.
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; either version 1, or (at your option) any later version, or
the Artistic License version 2.0.