AuthCAS-1.7000755001750001750 013002133020 12522 5ustar00salaunsalaun000000000000AuthCAS-1.7/.cvsignore000444001750001750 11413002133020 14633 0ustar00salaunsalaun000000000000blib* Makefile Makefile.old pm_to_blib* *.tar.gz .lwpcookies CAS-* cover_db AuthCAS-1.7/Build.PL000444001750001750 132213002133020 14151 0ustar00salaunsalaun000000000000use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'AuthCAS', license => 'perl', dist_author => 'Olivier Salaun ', dist_version_from => 'lib/AuthCAS.pm', create_license => 1, requires => { 'IO::Socket::SSL' => 0, 'LWP::UserAgent' => 0, }, build_requires => { 'Test::More' => 0, }, add_to_cleanup => [ 'AuthCAS-*' ], meta_add => { resources => { homepage => 'https://sourcesup.renater.fr/projects/perlcas/', repository => 'https://subversion.renater.fr/perlcas/', } } ); $builder->create_build_script(); AuthCAS-1.7/Changes000444001750001750 1564213002133020 14202 0ustar00salaunsalaun0000000000002016-10-20 12:09 osalaun_ur1 * trunk/META.yml, trunk/lib/AuthCAS.pm: Preparing version 1.7 2016-10-20 09:08 osalaun_ur1 * trunk/lib/AuthCAS.pm: Add encoding declaration in perl module. Fix for this bug report: https://rt.cpan.org/Ticket/Display.html?id=87241 2012-09-10 09:40 olivier.salaun * trunk/LICENSE, trunk/MANIFEST, trunk/MANIFEST.SKIP, trunk/META.yml: add LICENSE file 2012-09-08 03:44 svendowideit * trunk/MANIFEST, trunk/MANIFEST.SKIP, trunk/META.json, trunk/META.yml: add MANIFEST.SKIP so that we don't accidentally add past releases to the MANIFEST during disttest 2012-09-07 11:58 olivier.salaun * trunk/Build.PL, trunk/MANIFEST, trunk/META.json, trunk/META.yml: Failed to build release 1.6 ; creating a META.json file for a try 2012-09-07 08:34 olivier.salaun * trunk/Changes: preparing 1.6 2012-09-07 01:15 svendowideit * trunk/Build.PL, trunk/MANIFEST, trunk/META.yml: small META updates 2012-09-07 01:14 svendowideit * trunk/lib/AuthCAS.pm, trunk/t/simple.t: don't tlk to CAS server unless service_url and ticket are defined 2012-09-07 01:14 svendowideit * trunk/Build.PL, trunk/MANIFEST, trunk/lib/AuthCAS.pm, trunk/t/simple.t: add simplistic unit test to expose a problem in error reporting and un-set variables 2012-09-07 01:13 svendowideit * trunk/Build.PL, trunk/META.yml, trunk/Makefile.PL: list same deps in Build.PL and Makefile.PL - https://rt.cpan.org/Public/Bug/Display.html?id=52682 2012-09-07 01:12 svendowideit * trunk/lib/AuthCAS.pm: missed a link 2012-09-07 01:12 svendowideit * trunk/lib/AuthCAS.pm: even more pod 2012-09-07 01:11 svendowideit * trunk/lib/AuthCAS.pm: learning a little more pod 2012-09-07 01:11 svendowideit * trunk/lib/AuthCAS.pm: learning a little pod 2012-09-07 01:10 svendowideit * trunk/lib/AuthCAS.pm: move some pod around 2012-09-07 01:10 svendowideit * trunk/Changes, trunk/META.yml, trunk/README, trunk/lib/AuthCAS.pm: add SSL_version option to constructor to allow for servers that cause problems add pod skeletons for all functions 2012-09-07 01:09 svendowideit * trunk/lib/AuthCAS.pm: perltidy 2011-04-11 14:35 olivier.salaun * trunk/META.yml, trunk/lib/AuthCAS.pm: changement de numéro de version pour s'adapter à CPAN : 1.4.1 => 1.5 2011-04-11 14:00 olivier.salaun * trunk/META.yml, trunk/lib/AuthCAS.pm: preparing release 1.4.1 2011-04-11 13:50 olivier.salaun * trunk/Changes: updating changelog 2011-04-11 13:41 olivier.salaun * trunk/lib/AuthCAS.pm: Bug fix reported by S.Posé, Rectorat de la Réunion. AUthentication requests would not get processed by the CAS server. Replaced \n with \r\n while performing an HTTP GET. 2009-06-08 13:00 olivier.salaun * trunk/Changes: Update changelog 2009-06-08 13:00 olivier.salaun * trunk/META.yml, trunk/lib/AuthCAS.pm: Renaming 1.3.3 release to 1.4 to match the CPAN versionning style 2009-06-05 15:47 olivier.salaun * trunk/Changes, trunk/META.yml, trunk/lib/AuthCAS.pm: preparing version 1.3.3 2009-05-12 15:48 olivier.salaun * trunk/Changes, trunk/META.yml, trunk/lib/AuthCAS.pm: Updating the version number 2009-05-12 07:31 olivier.salaun * trunk/lib/AuthCAS.pm: Change: now use eval() to check if perl modules are available ; this is required by recent Perl interpreters 2007-10-16 09:26 olivier.salaun * trunk/lib/AuthCAS.pm: Updated release number 2007-10-16 09:20 olivier.salaun * trunk/Changes, trunk/META.yml: Preparing 1.3.1 release 2007-10-16 09:13 olivier.salaun * trunk/lib/AuthCAS.pm: [reported by S.McDonald, bepress.com] Fix: error at "make test" : "Global symbol "$xmlRef" requires explicit package name" The code was still refering to the old $xmlRef variable 2007-08-21 08:43 olivier.salaun * trunk/Changes: Updated 2007-08-21 08:31 olivier.salaun * trunk/lib/AuthCAS.pm: [reported by P.Brusten]Fix: expected an arrayref instead of an array for gethttps2() output. This bug was introduced by S.More's patch. Concel it. 2007-08-21 08:20 olivier.salaun * trunk/README: Refer to the bug tracking system 2007-04-06 16:14 olivier.salaun * trunk/Changes: Updated 2007-04-06 16:10 olivier.salaun * trunk/META.yml, trunk/lib/AuthCAS.pm: preparind 1.2 2007-04-06 16:05 olivier.salaun * trunk/lib/AuthCAS.pm: [Kasper Løvschall] Fix: XML parser now accepts multiple name space tags in CAS xml responses 2007-04-06 15:56 olivier.salaun * trunk/lib/AuthCAS.pm: [#24021] [Stephen More] Fix: error trapping in get_https2 2007-04-06 15:30 olivier.salaun * trunk/debian, trunk/debian/compat, trunk/debian/control, trunk/debian/copyright, trunk/debian/rules: [Lionel Porcheron, Anywhere] Added the required files to allow Debian packaging. 2006-11-13 13:02 olivier.salaun * trunk/Changes: updated 2006-04-11 14:01 olivier.salaun * trunk/lib/AuthCAS.pm: Fix: Added "Host:" HTTP header field to requests 2006-03-14 09:42 olivier.salaun * trunk/META.yml, trunk/lib/AuthCAS.pm, trunk/t/00.load.t: preparing release 1.1 2006-03-14 08:40 olivier.salaun * trunk/t/00.load.t: [reported by L.Porcheron]: incorrect tests referring to old module name 2005-04-21 15:02 olivier.salaun * trunk/lib/AuthCAS.pm, trunk/lib/CAS.pm: enamed module 2005-04-21 14:50 olivier.salaun * trunk/Build.PL, trunk/MANIFEST, trunk/META.yml, trunk/Makefile.PL, trunk/sampleCasClient.pl: enamed project AuthCAS?\024?\024 2005-04-21 14:04 olivier.salaun * trunk/sampleCasClient.pl: restore sample code 2005-04-21 14:04 olivier.salaun * trunk, trunk/.cvsignore, trunk/Build.PL, trunk/CAS.pm, trunk/ChangeLog, trunk/Changes, trunk/MANIFEST, trunk/META.yml, trunk/Makefile.PL, trunk/README, trunk/lib, trunk/lib/CAS.pm, trunk/sampleCasClient.pl, trunk/t, trunk/t/00.load.t, trunk/t/pod-coverage.t, trunk/t/pod.t: A clean CPAN distribution of CAS.pm 2003-11-28 14:19 olivier.salaun * trunk/CAS.pm: Rename sub 2003-11-27 11:12 olivier.salaun * trunk/CAS.pm: Change: allow all service Path to be changed at new() time 2003-11-26 15:55 olivier.salaun * trunk/CAS.pm: Add getServerGatewayURL() for nonblocking login check 2003-11-25 15:41 olivier.salaun * trunk/ChangeLog: Update 2003-11-25 15:40 olivier.salaun * trunk/CAS.pm, trunk/sampleCasClient.pl: Change: Better error management via the $errors variable 2003-11-14 16:09 olivier.salaun * trunk/ChangeLog: Add Changelog 2003-11-14 16:08 olivier.salaun * trunk/CAS.pm: [proposed by V.Mathieu] Change: verify CAS server certificate only if capath or cafile were set 2003-11-14 15:33 olivier.salaun * trunk/CAS.pm, trunk/sampleCasClient.pl: [reported by V.Mathieu] Fix SSL_verify_mode 2003-11-14 15:08 olivier.salaun * trunk/CAS.pm, trunk/sampleCasClient.pl: [reported by V. Mathieu] Fix: capath and cafile were inverted in sample code 2003-11-14 15:00 olivier.salaun * trunk/CAS.pm, trunk/sampleCasClient.pl: Initial revision 2012-12-19 11:01 root * branches, tags, trunk: Init AuthCAS-1.7/LICENSE000444001750001750 4374013002133020 13714 0ustar00salaunsalaun000000000000This software is copyright (c) 2016 by Olivier Salaun . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2016 by Olivier Salaun . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2016 by Olivier Salaun . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End AuthCAS-1.7/MANIFEST000444001750001750 40313002133020 13765 0ustar00salaunsalaun000000000000.cvsignore Build.PL Changes debian/compat debian/control debian/copyright debian/rules lib/AuthCAS.pm LICENSE Makefile.PL MANIFEST META.json META.yml # Will be created by "make dist" README sampleCasClient.pl t/00.load.t t/pod-coverage.t t/pod.t t/simple.t AuthCAS-1.7/META.json000444001750001750 210613002133020 14277 0ustar00salaunsalaun000000000000{ "abstract" : "Client library for JA-SIG CAS 2.0 authentication server", "author" : [ "Olivier Salaun " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4216", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "AuthCAS", "prereqs" : { "build" : { "requires" : { "Test::More" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0.42" } }, "runtime" : { "requires" : { "IO::Socket::SSL" : "0", "LWP::UserAgent" : "0" } } }, "provides" : { "AuthCAS" : { "file" : "lib/AuthCAS.pm", "version" : "1.7" } }, "release_status" : "stable", "resources" : { "homepage" : "https://sourcesup.renater.fr/projects/perlcas/", "repository" : { "url" : "https://subversion.renater.fr/perlcas/" } }, "version" : "1.7" } AuthCAS-1.7/META.yml000444001750001750 124213002133020 14127 0ustar00salaunsalaun000000000000--- abstract: 'Client library for JA-SIG CAS 2.0 authentication server' author: - 'Olivier Salaun ' build_requires: Test::More: '0' configure_requires: Module::Build: '0.42' dynamic_config: 1 generated_by: 'Module::Build version 0.4216, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: AuthCAS provides: AuthCAS: file: lib/AuthCAS.pm version: '1.7' requires: IO::Socket::SSL: '0' LWP::UserAgent: '0' resources: homepage: https://sourcesup.renater.fr/projects/perlcas/ repository: https://subversion.renater.fr/perlcas/ version: '1.7' AuthCAS-1.7/Makefile.PL000444001750001750 72113002133020 14611 0ustar00salaunsalaun000000000000use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'AuthCAS', AUTHOR => 'Olivier Salaun ', VERSION_FROM => 'lib/AuthCAS.pm', ABSTRACT_FROM => 'lib/AuthCAS.pm', PREREQ_PM => { 'IO::Socket::SSL' => 0, 'LWP::UserAgent' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'AuthCAS-*' }, ); AuthCAS-1.7/README000444001750001750 246213002133020 13543 0ustar00salaunsalaun000000000000AuthCAS The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it get an idea of the modules uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install Alternatively, to install with Module::Build, you can use the following commands: perl Build.PL ./Build ./Build test ./Build install REPORTING BUGS You can report bugs using our bug tracking system : http://sourcesup.cru.fr/tracker/?group_id=76 COPYRIGHT AND LICENCE Put the correct copyright and licence information here. Copyright (C) 2005,2006,2007,2009 Olivier Salaun - Comité Réseau des Universités 2012 Sven Dowideit - SvenDowideit@fosiki.com This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AuthCAS-1.7/sampleCasClient.pl000555001750001750 541313002133020 16271 0ustar00salaunsalaun000000000000#!/usr/bin/perl ## Author Olivier Salaün ## Copyright Comité Réseau des Universités ## http://www.cru.fr ## This is a sample CAS client ## You should add 3 ScriptAlias entries for it in your Apache conf file ## ScriptAlias /testproxy /var/www/cgi-bin/AuthCAS/sampleCasClient.pl ## ScriptAlias /testapp /var/www/cgi-bin/AuthCAS/sampleCasClient.pl ## ## This last alias should be set as HTTPS ## ScriptAlias /testcallback /var/www/cgi-bin/AuthCAS/sampleCasClient.pl use AuthCAS; my $proxy_url = 'http://your.server/testproxy'; my $proxy_callback_url = 'https://your.server/testcallback'; my $app_url = 'http://your.server/testapp'; my $cas_url = 'https://your.cas.server'; my $cas = new AuthCAS(casUrl => $cas_url, CAFile => '/usr/local/apache/conf/ssl.crt/ca-bundle.crt', ); if ($ENV{'SCRIPT_NAME'} eq '/testproxy') { $cas->proxyMode(pgtFile => '/tmp/pgt.txt', pgtCallbackUrl => $proxy_callback_url ); unless ($ENV{'QUERY_STRING'} =~ /ticket=/) { ## Redirect the User for login at CAS ## This step is not required if we already have a PGT (Proxy Granting Ticket) my $login_url = $cas->getServerLoginURL($proxy_url); printf "Location: $login_url\n\n"; exit 0; } my $ST; $ENV{'QUERY_STRING'} =~ /ticket=([^&]+)/; $ST = $1; my $user = $cas->validateST($proxy_url, $ST); unless (defined $user) { &error(&AuthCAS::get_errors); exit 1; } my $PT = $cas->retrievePT($app_url); my ($user2, @proxies) = $cas->validatePT($app_url, $PT); printf "Content-type: text/plain\n\nST: $ST\nUser: $user\nPT: $PT\nUser2 : $user2\nProxies : %s", join(',',@proxies); exit 0; }elsif ($ENV{'SCRIPT_NAME'} eq '/testapp') { unless ($ENV{'QUERY_STRING'} =~ /ticket=/) { ## Redirect the User for login at CAS ## This step is not required if we already have a PGT (Proxy Granting Ticket) my $login_url = $cas->getServerLoginURL($app_url); printf "Location: $login_url\n\n"; exit 0; } my $ST; $ENV{'QUERY_STRING'} =~ /ticket=([^&]+)/; $ST = $1; my $user = $cas->validateST($app_url, $ST); printf "Content-type: text/plain\n\nST: $ST\nUser: $user\n"; exit 0; }elsif ($ENV{'SCRIPT_NAME'} eq '/testcallback') { $cas->proxyMode(pgtFile => '/tmp/pgt.txt', pgtCallbackUrl => $proxy_callback_url ); $ENV{'QUERY_STRING'} =~ /^pgtIou=(\S+)&pgtId=(\S+)$/; $cas->storePGT($1,$2); print "Content-type: text/plain\n\n"; dump_env(\*STDOUT); exit 0; }else { print "Content-type: text/plain\n\n"; &dump_env(\*STDOUT); } sub dump_env { my $fd = shift; foreach my $k (keys %ENV) { printf $fd "$k = $ENV{$k}\n"; } } sub error { print "Content-type: text/plain\n\n"; printf "Erreur : %s\n", join('',@_); return 1; } AuthCAS-1.7/debian000755001750001750 013002133020 13744 5ustar00salaunsalaun000000000000AuthCAS-1.7/debian/compat000444001750001750 213002133020 15217 0ustar00salaunsalaun0000000000004 AuthCAS-1.7/debian/control000444001750001750 140713002133020 15506 0ustar00salaunsalaun000000000000Source: libauthcas-perl Section: perl Priority: optional Build-Depends: debhelper (>= 4.0.2), libmodule-build-perl Build-Depends-Indep: perl (>= 5.8.0-7) Maintainer: Lionel Porcheron Standards-Version: 3.6.1 Package: libauthcas-perl Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, Description: Client library for CAS 2.0 CAS is Yale University's web authentication system, heavily inspired by Kerberos. Release 2.0 of CAS provides "proxied credential" feature that allows authentication tickets to be carried by intermediate applications (Portals for instance), they are called proxy. . This AuthCAS Perl module provides required subroutines to validate and retrieve CAS tickets. . http://sourcesup.cru.fr/perlcas/ AuthCAS-1.7/debian/copyright000444001750001750 135613002133020 16041 0ustar00salaunsalaun000000000000This is the debian package for the AuthCAS module. It was created by Lionel Porcheron using dh-make-perl. It was downloaded from http://sourcesup.cru.fr/perlcas/ The upstream author is: Olivier Salaun Copyright (C) 2003 Comite Reseau des Universites (http://www.cru.fr). All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Perl is distributed under your choice of the GNU General Public License or the Artistic License. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL' and the Artistic Licence in `/usr/share/common-licenses/Artistic'. AuthCAS-1.7/debian/rules000444001750001750 351013002133020 15155 0ustar00salaunsalaun000000000000#!/usr/bin/make -f # This debian/rules file is provided as a template for normal perl # packages. It was created by Marc Brockschmidt for # the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may # be used freely wherever it is useful. # # It was later modified by Jason Kohles # http://www.jasonkohles.com/ to support Module::Build installed modules # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # If set to a true value then MakeMaker's prompt function will # always return the default without waiting for user input. export PERL_MM_USE_DEFAULT=1 PACKAGE=$(shell dh_listpackages) ifndef PERL PERL = /usr/bin/perl endif TMP =$(CURDIR)/debian/$(PACKAGE) build: build-stamp build-stamp: dh_testdir # Add commands to compile the package here $(PERL) Build.PL installdirs=vendor OPTIMIZE="-Wall -O2 -g" $(PERL) Build touch build-stamp clean: dh_testdir dh_testroot # Add commands to clean up after the build process here -$(PERL) Build distclean dh_clean build-stamp install-stamp install: build install-stamp install-stamp: dh_testdir dh_testroot dh_clean -k # Add commands to install the package into debian/$PACKAGE_NAME here $(PERL) Build test $(PERL) Build install destdir=$(TMP) touch install-stamp binary-arch: # We have nothing to do by default. binary-indep: build install dh_testdir dh_testroot # dh_installcron # dh_installmenu # dh_installexamples dh_installdocs README dh_installchangelogs Changes dh_perl dh_link dh_strip dh_compress dh_fixperms dh_installdeb dh_gencontrol dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary AuthCAS-1.7/lib000755001750001750 013002133020 13270 5ustar00salaunsalaun000000000000AuthCAS-1.7/lib/AuthCAS.pm000444001750001750 4164213002133020 15242 0ustar00salaunsalaun000000000000 package AuthCAS; use strict; use vars qw( $VERSION); $VERSION = '1.7'; =encoding utf8 =head1 NAME AuthCAS - Client library for JA-SIG CAS 2.0 authentication server =head1 VERSION Version 1.7 =head1 DESCRIPTION AuthCAS aims at providing a Perl API to JA-SIG Central Authentication System (CAS). Only a basic Perl library is provided with CAS whereas AuthCAS is a full object-oriented library. =head1 PREREQUISITES This script requires IO::Socket::SSL and LWP::UserAgent =head1 SYNOPSIS 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); =head1 DESCRIPTION Jasig CAS is Yale University's web authentication system, heavily inspired by Kerberos. Release 2.0 of CAS provides "proxied credential" feature that allows authentication tickets to be carried by intermediate applications (Portals for instance), they are called proxy. This AuthCAS Perl module provides required subroutines to validate and retrieve CAS tickets. =cut my @ISA = qw(Exporter); my @EXPORT = qw($errors); my $errors; use Carp; =pod =head2 new my $cas = new AuthCAS( casUrl => 'https://cas.myserver', CAFile => '/etc/httpd/conf/ssl.crt/ca-bundle.crt', ); The C constructor lets you create a new B object. =over =item casUrl - REQUIRED =item CAFile =item CAPath =item loginPath - '/login' =item logoutPath - '/logout' =item serviceValidatePath - '/serviceValidate' =item proxyPath - '/proxy' =item proxyValidatePath - '/proxyValidate' =item SSL_version - unset Sets the version of the SSL protocol used to transmit data. If the default causes connection issues, setting it to 'SSLv3' may help. see the documentation for L for more information see L for more details. =back Returns a new B or dies on error. =cut sub new { my ( $pkg, %param ) = @_; my $cas_server = { url => $param{'casUrl'}, CAFile => $param{'CAFile'}, CAPath => $param{'CAPath'}, loginPath => $param{'loginPath'} || '/login', logoutPath => $param{'logoutPath'} || '/logout', serviceValidatePath => $param{'serviceValidatePath'} || '/serviceValidate', proxyPath => $param{'proxyPath'} || '/proxy', proxyValidatePath => $param{'proxyValidatePath'} || '/proxyValidate', SSL_version => $param{SSL_version}, }; bless $cas_server, $pkg; return $cas_server; } =pod =head2 get_errors Return module errors =cut sub get_errors { return $errors; } =pod =head2 proxyMode Use the CAS object as a proxy =over =item pgtFile =item pgtCallbackUrl =back =cut sub proxyMode { my $self = shift; my %param = @_; $self->{'pgtFile'} = $param{'pgtFile'}; $self->{'pgtCallbackUrl'} = $param{'pgtCallbackUrl'}; $self->{'proxy'} = 1; return 1; } ## Escape dangerous chars in URLS sub _escape_chars { my $s = shift; ## Escape chars ## !"#$%&'()+,:;<=>?[] AND accented chars ## escape % first # foreach my $i (0x25,0x20..0x24,0x26..0x2c,0x3a..0x3f,0x5b,0x5d,0x80..0x9f,0xa0..0xff) { foreach my $i (0x26) { my $hex_i = sprintf "%lx", $i; $s =~ s/\x$hex_i/%$hex_i/g; } return $s; } =pod =head2 dump_var =cut sub dump_var { my ( $var, $level, $fd ) = @_; if ( ref($var) ) { if ( ref($var) eq 'ARRAY' ) { foreach my $index ( 0 .. $#{$var} ) { print $fd "\t" x $level . $index . "\n"; &dump_var( $var->[$index], $level + 1, $fd ); } } elsif ( ref($var) eq 'HASH' ) { foreach my $key ( sort keys %{$var} ) { print $fd "\t" x $level . '_' . $key . '_' . "\n"; &dump_var( $var->{$key}, $level + 1, $fd ); } } } else { if ( defined $var ) { print $fd "\t" x $level . "'$var'" . "\n"; } else { print $fd "\t" x $level . "UNDEF\n"; } } } ## Parse an HTTP URL sub _parse_url { my $url = shift; my ( $host, $port, $path ); if ( $url =~ /^(https?):\/\/([^:\/]+)(:(\d+))?(.*)$/ ) { $host = $2; $path = $5; if ( $1 eq 'http' ) { $port = $4 || 80; } elsif ( $1 eq 'https' ) { $port = $4 || 443; } else { $errors = sprintf "Unknown protocol '%s'\n", $1; return undef; } } else { $errors = sprintf "Unable to parse URL '%s'\n", $url; return undef; } return ( $host, $port, $path ); } ## Simple XML parser sub _parse_xml { my $data = shift; my %xml_struct; while ( $data =~ /^<([^\s>]+)(\s+[^\s>]+)*>([\s\S\n]*)(<\/\1>)/m ) { my ( $new_tag, $new_data ) = ( $1, $3 ); chomp $new_data; $new_data =~ s/^[\s\n]+//m; $data =~ s/^<$new_tag(\s+[^\s>]+)*>([\s\S\n]*)(<\/$new_tag>)//m; $data =~ s/^[\s\n]+//m; ## Check if data still includes XML tags my $struct; if ( $new_data =~ /^<([^\s>]+)(\s+[^\s>]+)*>([\s\S\n]*)(<\/\1>)/m ) { $struct = &_parse_xml($new_data); } else { $struct = $new_data; } push @{ $xml_struct{$new_tag} }, $struct; } return \%xml_struct; } =pod =head2 getServerLoginURL($service) Returns a URL that you can redirect the browser to, which includes the URL to return to TODO: it escapes the return URL, but I've noticed some issues with more complicated URL's =cut sub getServerLoginURL { my $self = shift; my $service = shift; return $self->{'url'} . $self->{'loginPath'} . '?service=' . &_escape_chars($service); } =pod =head2 getServerLoginGatewayURL($service) Returns non-blocking login URL ie: if user is logged in, return the ticket, otherwise do not prompt for login =cut sub getServerLoginGatewayURL { my $self = shift; my $service = shift; return $self->{'url'} . $self->{'loginPath'} . '?service=' . &_escape_chars($service) . '&gateway=1'; } =pod =head2 getServerLogoutURL($service) Return logout URL After logout user is redirected back to the application =cut sub getServerLogoutURL { my $self = shift; my $service = shift; return $self->{'url'} . $self->{'logoutPath'} . '?service=' . &_escape_chars($service) . '&gateway=1'; } =pod =head2 getServerServiceValidateURL($service, $ticket, $pgtUrl) Returns =cut sub getServerServiceValidateURL { my $self = shift; my $service = shift; my $ticket = shift; my $pgtUrl = shift; my $query_string = 'service=' . &_escape_chars($service) . '&ticket=' . $ticket; if ( defined $pgtUrl ) { $query_string .= '&pgtUrl=' . &_escape_chars($pgtUrl); } ## URL was /validate with CAS 1.0 return $self->{'url'} . $self->{'serviceValidatePath'} . '?' . $query_string; } =pod =head2 getServerProxyURL($targetService, $pgt) Returns =cut sub getServerProxyURL { my $self = shift; my $targetService = shift; my $pgt = shift; return $self->{'url'} . $self->{'proxyPath'} . '?targetService=' . &_escape_chars($targetService) . '&pgt=' . &_escape_chars($pgt); } =pod =head2 getServerProxyValidateURL($service, $ticket) Returns =cut sub getServerProxyValidateURL { my $self = shift; my $service = shift; my $ticket = shift; return $self->{'url'} . $self->{'proxyValidatePath'} . '?service=' . &_escape_chars($service) . '&ticket=' . &_escape_chars($ticket); } =pod =head2 validateST($service, $ticket) Validate a Service Ticket Also used to get a PGT Returns the login that created the ticket, if the ticket is valid for that $service URL returns undef if the ticket is not valid. =cut sub validateST { my $self = shift; my $service = shift; my $ticket = shift; if (!defined($service)) { $errors = 'Need a service url to validate ticket.'; return undef; } if (!defined($ticket)) { $errors = 'No ticket to validate.'; return undef; } my $pgtUrl = $self->{'pgtCallbackUrl'}; my $xml = $self->callCAS( $self->getServerServiceValidateURL( $service, $ticket, $pgtUrl ) ); if ( defined $xml->{'cas:serviceResponse'}[0]{'cas:authenticationFailure'} ) { $errors = sprintf "Failed to validate Service Ticket %s : %s\n", $ticket, $xml->{'cas:serviceResponse'}[0]{'cas:authenticationFailure'}[0]; return undef; } my $user = $xml->{'cas:serviceResponse'}[0]{'cas:authenticationSuccess'}[0] {'cas:user'}[0]; ## If in Proxy mode, also retreave a PGT if ( $self->{'proxy'} ) { my $pgtIou; if ( defined $xml->{'cas:serviceResponse'}[0] {'cas:authenticationSuccess'}[0]{'cas:proxyGrantingTicket'} ) { $pgtIou = $xml->{'cas:serviceResponse'}[0]{'cas:authenticationSuccess'}[0] {'cas:proxyGrantingTicket'}[0]; } unless ( defined $self->{'pgtFile'} ) { $errors = sprintf "pgtFile not defined\n"; return undef; } ## Check stored PGT unless ( open STORE, $self->{'pgtFile'} ) { $errors = sprintf "Unable to read %s\n", $self->{'pgtFile'}; return undef; } my $pgtId; while () { if (/^$pgtIou\s+(.+)$/) { $pgtId = $1; last; } } $self->{'pgtId'} = $pgtId; } return ($user); } =pod =head2 validatePT($service, $ticket) Validate a Proxy Ticket Returns the login that created the ticket, if the ticket is valid for that $service URL, and a list of Proxies used. user returned == undef if its not a valid ticket =cut sub validatePT { my $self = shift; my $service = shift; my $ticket = shift; if (!defined($service)) { $errors = 'Need a service url to validate ticket.'; return undef; } if (!defined($ticket)) { $errors = 'No ticket to validate.'; return undef; } my $xml = $self->callCAS( $self->getServerProxyValidateURL( $service, $ticket ) ); if ( defined $xml->{'cas:serviceResponse'}[0]{'cas:authenticationFailure'} ) { $errors = sprintf "Failed to validate Proxy Ticket %s : %s\n", $ticket, $xml->{'cas:serviceResponse'}[0]{'cas:authenticationFailure'}[0]; return undef; } my $user = $xml->{'cas:serviceResponse'}[0]{'cas:authenticationSuccess'}[0] {'cas:user'}[0]; my @proxies; if ( defined $xml->{'cas:serviceResponse'}[0]{'cas:authenticationSuccess'}[0] {'cas:proxies'} ) { @proxies = @{ $xml->{'cas:serviceResponse'}[0]{'cas:authenticationSuccess'}[0] {'cas:proxies'}[0]{'cas:proxy'} }; } return ( $user, @proxies ); } =pod =head2 callCAS($url) ## Access a CAS URL and parses received XML Returns =cut sub callCAS { my $self = shift; my $url = shift; my ( $host, $port, $path ) = &_parse_url($url); my $xml = get_https2( $host, $port, $path, { 'cafile' => $self->{'CAFile'}, 'capath' => $self->{'CAPath'}, 'SSL_version' => $self->{'SSL_version'} } ); #use Data::Dumper; die '--'.$#$xml.': '.Dumper($xml); unless ($xml && $#$xml >= 0) { warn $errors; return undef; } ## Skip HTTP header fields my $line = shift @$xml; while ( $line !~ /^\s*$/ ) { $line = shift @$xml; } return &_parse_xml( join( '', @$xml ) ); } =pod =head2 storePGT($pgtIou, $pgtId) =cut sub storePGT { my $self = shift; my $pgtIou = shift; my $pgtId = shift; unless ( open STORE, ">>$self->{'pgtFile'}" ) { $errors = sprintf "Unable to write to %s\n", $self->{'pgtFile'}; return undef; } printf STORE "%s\t%s\n", $pgtIou, $pgtId; close STORE; return 1; } =pod =head2 retrievePT($service) Returns =cut sub retrievePT { my $self = shift; my $service = shift; my $xml = $self->callCAS( $self->getServerProxyURL( $service, $self->{'pgtId'} ) ); if ( defined $xml->{'cas:serviceResponse'}[0]{'cas:proxyFailure'} ) { $errors = sprintf "Failed to get PT : %s\n", $xml->{'cas:serviceResponse'}[0]{'cas:proxyFailure'}[0]; return undef; } if ( defined $xml->{'cas:serviceResponse'}[0]{'cas:proxySuccess'}[0] {'cas:proxyTicket'} ) { return $xml->{'cas:serviceResponse'}[0]{'cas:proxySuccess'}[0] {'cas:proxyTicket'}[0]; } return undef; } =pod =head2 get_https2 request a document using https, return status and content Sven suspects this is intended to be private. Returns =cut sub get_https2 { my $host = shift; my $port = shift; my $path = shift; my $ssl_data = shift; my $trusted_ca_file = $ssl_data->{'cafile'}; my $trusted_ca_path = $ssl_data->{'capath'}; if ( ( $trusted_ca_file && !( -r $trusted_ca_file ) ) || ( $trusted_ca_path && !( -d $trusted_ca_path ) ) ) { $errors = sprintf "error : incorrect access to cafile ".($trusted_ca_file||'')." or capath ".($trusted_ca_path||'')."\n"; return undef; } unless ( eval "require IO::Socket::SSL" ) { $errors = sprintf "Unable to use SSL library, IO::Socket::SSL required, install IO-Socket-SSL (CPAN) first\n"; return undef; } require IO::Socket::SSL; unless ( eval "require LWP::UserAgent" ) { $errors = sprintf "Unable to use LWP library, LWP::UserAgent required, install LWP (CPAN) first\n"; return undef; } require LWP::UserAgent; my $ssl_socket; my %ssl_options = ( SSL_use_cert => 0, PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => '5' ); $ssl_options{'SSL_ca_file'} = $trusted_ca_file if ($trusted_ca_file); $ssl_options{'SSL_ca_path'} = $trusted_ca_path if ($trusted_ca_path); ## If SSL_ca_file or SSL_ca_path => verify peer certificate $ssl_options{'SSL_verify_mode'} = 0x01 if ( $trusted_ca_file || $trusted_ca_path ); $ssl_options{'SSL_version'} = $ssl_data->{'SSL_version'} if defined( $ssl_data->{'SSL_version'} ); $ssl_socket = new IO::Socket::SSL(%ssl_options); unless ($ssl_socket) { $errors = sprintf "error %s unable to connect https://%s:%s/\n", &IO::Socket::SSL::errstr, $host, $port; return undef; } my $request = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n"; print $ssl_socket "$request"; my @result; while ( my $line = $ssl_socket->getline ) { push @result, $line; } $ssl_socket->close( SSL_no_shutdown => 1 ); return \@result; } =pod =head1 SEE ALSO JA-SIG Central Authentication Service L was Yale Central Authentication Service L phpCAS L =head1 COPYRIGHT Copyright (C) 2003, 2005,2006,2007,2009 Olivier Salaun - Comité Réseau des Universités L 2012 Sven Dowideit - L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHORS Olivier Salaun Sven Dowideit =cut 1; AuthCAS-1.7/t000755001750001750 013002133020 12765 5ustar00salaunsalaun000000000000AuthCAS-1.7/t/00.load.t000444001750001750 15113002133020 14421 0ustar00salaunsalaun000000000000use Test::More tests => 1; BEGIN { use_ok( 'AuthCAS' ); } diag( "Testing AuthCAS $AuthCAS::VERSION" ); AuthCAS-1.7/t/pod-coverage.t000444001750001750 25413002133020 15643 0ustar00salaunsalaun000000000000#!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); AuthCAS-1.7/t/pod.t000444001750001750 21413002133020 14046 0ustar00salaunsalaun000000000000#!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); AuthCAS-1.7/t/simple.t000444001750001750 275413002133020 14610 0ustar00salaunsalaun000000000000 use Test::More tests => 5; use AuthCAS; { my $cas = new AuthCAS( casUrl => 'https://not_there/', CAFile => '/usr/local/apache/conf/ssl.crt/ca-bundle.crt_notTHERE', ); my $return_url = 'http://myapp/something'; #this actually throws a warning my $login_url = $cas->getServerLoginURL($return_url); ok( !defined( $cas->validateST( $return_url, 'ST-42-SLwl77Lv5xx6QK2dmlze-cas' ) ), 'non-existant, but reasonable format ticket, to a non-existant server' ); } { my $cas = new AuthCAS( casUrl => 'https://jasig:8443/', SSL_version => 'SSLv3', # CAFile => '/usr/local/apache/conf/ssl.crt/ca-bundle.crt_notTHERE', ); my $return_url = 'http://myapp/something'; #this actually throws a warning my $login_url = $cas->getServerLoginURL($return_url); ok( !defined( $cas->validateST( $return_url, 'ST-42-SLwl77Lv5xx6QK2dmlze-cas' ) ), 'non-existant, but reasonable format ticket, to a server that _might_ exist' ); ok( !defined( $cas->validateST( $return_url, '' ) ), 'empty string ticket, to a server that _might_ exist' ); ok( !defined( $cas->validateST( $return_url ) ), 'no ticket, to a server that _might_ exist' ); ok( !defined( $cas->validateST( ) ), 'no ticket, no return url, to a server that _might_ exist' ); }