AuthCAS(3pm)
πΈ AuthCAS(3pm) β bestie, come get your tickets π
okay so this is AuthCAS, a page from the User Contributed Perl Documentation corner of the manual, and it is genuinely iconic. it's a client library for the JA-SIG CAS 2.0 authentication server, and yes i'm gonna walk you through every single bit of it. grab a snack. π
β¨ VERSION β¨
Version 1.7 π
π DESCRIPTION π
AuthCAS is here to give you a Perl API for JA-SIG Central Authentication System (CAS, iykyk). the vibe: CAS itself only ships a basic Perl library, which is giving bare minimum. AuthCAS is the full object-oriented library. main character energy only. β¨
π§ PREREQUISITES π§
this script needs IO::Socket::SSL and LWP::UserAgent. no cap, it will not function without them. π
π SYNOPSIS π
a simple example with a direct CAS authentication
A simple example with a direct CAS authentication
use AuthCAS;
my $cas = new AuthCAS(casUrl => 'https://cas.myserver,
CAFile => '/etc/httpd/conf/ssl.crt/ca-bundle.crt',
);
my $login_url = $cas->getServerLoginURL('http://myserver/app.cgi');
## The user should be redirected to the $login_url
## When coming back from the CAS server a ticket is provided in the QUERY_STRING
## $ST should contain the receaved Service Ticket
my $user = $cas->validateST('http://myserver/app.cgi', $ST);
printf "User authenticated as %s\n", $user;
In the following example a proxy is requesting a Proxy Ticket for the target application
$cas->proxyMode(pgtFile => '/tmp/pgt.txt',
pgtCallbackUrl => 'https://myserver/proxy.cgi?callback=1
);
## Same as before but the URL is the proxy URL
my $login_url = $cas->getServerLoginURL('http://myserver/proxy.cgi');
## Like in the previous example we should receave a $ST
my $user = $cas->validateST('http://myserver/proxy.cgi', $ST);
## Process errors
printf STDERR "Error: %s\n", &AuthCAS::get_errors() unless (defined $user);
## Now we request a Proxy Ticket for the target application
my $PT = $cas->retrievePT('http://myserver/app.cgi');
## This piece of code is executed by the target application
## It received a Proxy Ticket from the proxy
my ($user, @proxies) = $cas->validatePT('http://myserver/app.cgi', $PT);
printf "User authenticated as %s via %s proxies\n", $user, join(',',@proxies);
β¨ DESCRIPTION β¨ (yes bestie, again β it's the sequel)
Jasig CAS is Yale University's web authentication system, and it's heavily inspired by Kerberos. π Release 2.0 of CAS brings the "proxied credential" feature, which lets authentication tickets be carried by intermediate applications β think Portals and stuff β and those carriers are literally called a proxy.
this AuthCAS Perl module hands you the subroutines you need to validate and retrieve CAS tickets. periodt.
πΈ new
my $cas = new AuthCAS(
casUrl => 'https://cas.myserver',
CAFile => '/etc/httpd/conf/ssl.crt/ca-bundle.crt',
);
the new constructor is how you create a brand new AuthCAS object. slay. π
here's the whole menu of what you can pass it:
casUrlβ REQUIRED. no casUrl, no vibes.CAFileCAPathloginPathβ defaults to'/login'logoutPathβ defaults to'/logout'serviceValidatePathβ defaults to'/serviceValidate'proxyPathβ defaults to'/proxy'proxyValidatePathβ defaults to'/proxyValidate'SSL_versionβ unset by default. this one sets the version of the SSL protocol used to transmit data. if the default is causing you connection issues, setting it to'SSLv3'may help. π«Ά see the documentation for"METHODS"inIO::Socket::SSLfor more info, and check out<http://www.perlmonks.org/?node_id=746493>for more details.
Returns a new AuthCAS β or dies on error. π
π get_errors
returns the module errors. that's it, that's the whole thing. handy when something goes sideways.
π proxyMode
use the CAS object as a proxy. π¦
pgtFile =item pgtCallbackUrl
π dump_var
(the docs just say the name bestie, that's all we got, we're not gonna invent lore)
β getServerLoginURL($service)
returns a URL you can redirect the browser to, and it includes the URL to return to. π
TODO: it escapes the return URL, but the author has noticed some issues with more complicated URL's. so heads up. π
π¦ getServerLoginGatewayURL($service)
returns a non-blocking login URL. ie: if the user is already logged in, it returns the ticket, otherwise it does not prompt for login. polite. we love a low-pressure queen.
πΈ getServerLogoutURL($service)
returns the logout URL. after logout, the user gets redirected back to the application. bye bestie, come back soon π
π getServerServiceValidateURL($service, $ticket, $pgtUrl)
Returns
β¨ getServerProxyURL($targetService, $pgt)
Returns
π getServerProxyValidateURL($service, $ticket)
Returns
π validateST($service, $ticket)
validates a Service Ticket. also used to get a PGT. π₯
it returns the login that created the ticket, if the ticket is valid for that $service URL.
it returns undef if the ticket is not valid. π
π validatePT($service, $ticket)
validates a Proxy Ticket.
it returns the login that created the ticket, if the ticket is valid for that $service URL, and a list of Proxies used.
theuserreturned== undefif it's not a valid ticket. no ticket, no entry, sorry bestie π
π§ callCAS($url)
## Access a CAS URL and parses received XML
Returns
π storePGT($pgtIou, $pgtId)
(no description in the source, bestie β we keep it 100 and don't make stuff up)
π retrievePT($service)
Returns
β get_https2
requests a document using https, and returns status and content.
Sven suspects this is intended to be private. π
Returns
π SEE ALSO π
- JA-SIG Central Authentication Service β
<http://www.jasig.org/cas> - was Yale Central Authentication Service β
<http://www.yale.edu/tp/auth/> - phpCAS β
<http://esup-phpcas.sourceforge.net/>
π COPYRIGHT π
Copyright (C) 2003, 2005,2006,2007,2009 Olivier Salaun - Comite Reseau
des Universites <http://www.cru.fr>
2012 Sven Dowideit - <mailto:SvenDowideit@fosiki.com>
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
π AUTHORS π
Olivier Salaun
Sven Dowideit
okay that's the whole page bestie, you're officially educated π«Ά
this was AuthCAS(3pm) β perl v5.32.0, dated 2021-01-07. go forth and authenticate something iconic. π
β¨π
π¦ where this page comes from
- debian bookworm: libauthcas-perl 1.7-1.1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- debian trixie: libauthcas-perl 1.7-1.1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu jammy: libauthcas-perl 1.7-1.1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu noble: libauthcas-perl 1.7-1.1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu resolute: libauthcas-perl 1.7-1.1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms