AuthCAS(3pm)

πŸ“¦
version 1.7 Β· 7 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

🌸 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.
  • CAFile
  • CAPath
  • loginPath β€” 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" in IO::Socket::SSL for 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.

the user returned == undef if 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 πŸ‘‘


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