mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
New version of PHPCAS
This commit is contained in:
32
include/phpCAS/docs/Building
Normal file
32
include/phpCAS/docs/Building
Normal file
@@ -0,0 +1,32 @@
|
||||
########################################
|
||||
### Build process for phpCAS package ###
|
||||
########################################
|
||||
|
||||
1. Prepare your own build config:
|
||||
|
||||
go to the utils/ dir and copy build-example.properties to a
|
||||
build.properties file and adjust the path for all needed binaries. You need
|
||||
at least php and doxygen for package creation. Git is needed as a developer with
|
||||
commit priviledges and upload right for the distribution package.
|
||||
|
||||
2. Install necessary php packages:
|
||||
|
||||
Install the pear package PEAR_PackageFileManager2 via the command
|
||||
|
||||
"pear install PEAR_PackageFileManager2"
|
||||
|
||||
|
||||
3. Run the "ant" tasks to build the phpCAS package and other developer tasks:
|
||||
|
||||
ant dist # create a local package
|
||||
ant clean # clear local packages and temporary files
|
||||
ant prepare # The default action, tags, packages, and commits to the local git repository
|
||||
ant push # Push the new commits and tags to the origin repository (github)
|
||||
ant revert # To revert any "ant prepare" actions before they are pushed to the github repo
|
||||
|
||||
The ant prepare target is equivalent to ant tag && ant dist && ant markdev.
|
||||
|
||||
To revert the commits and tag additions added in the ant tag and ant markdev
|
||||
targets, use the new ant revert target. This should not be done after pushing.
|
||||
Running ant prepare is safe and can be followed by ant revert to get rid of the
|
||||
added commits and tag in your local repository.
|
||||
680
include/phpCAS/docs/ChangeLog
Normal file
680
include/phpCAS/docs/ChangeLog
Normal file
@@ -0,0 +1,680 @@
|
||||
Changes in version 1.6.1
|
||||
|
||||
Bug Fixes:
|
||||
* Only initialize the session-storage array when values are populated (Adam Franco)
|
||||
* Autoload source/CAS.php file [#422] (Pierrick Charron)
|
||||
|
||||
Changes in version 1.6.0
|
||||
|
||||
Bug Fixes:
|
||||
* Introduce required service_name constructor argument to fix
|
||||
service hostname discovery exploitation vulnerability CVE-2022-39369 (Henry Pan)
|
||||
* Set user agent [#421] (Fydon)
|
||||
|
||||
Changes in version 1.5.0
|
||||
|
||||
Bug Fixes:
|
||||
* Fix undefined variables [#417] (Dawid Polak)
|
||||
* Fix client when getting ticket and it's null [#415] (Quentin Belot)
|
||||
* Allow autoloader to detect trait_exists() [#394] (Jean-Luc Herren)
|
||||
* Use curl_setopt_array instead of loop in CurlRequest [#391] (François Freitag)
|
||||
|
||||
Improvement:
|
||||
* Disable printf when verbosity flag is not set to true [#396] (Michał Kleszczyński)
|
||||
* Disabling error printing based on verbosity flag [#393] (Michał Kleszczyński)
|
||||
* Drop php5 compatibility [#385] (François Freitag)
|
||||
* Upgrade phpunit [#378] (François Freitag)
|
||||
* Drop support for outdate php versions[#380] (François Freitag)
|
||||
|
||||
Changes in version 1.4.0
|
||||
|
||||
Bug Fixes:
|
||||
* Remove ineffective test annotations @outputBuffering [#379] (François Freitag)
|
||||
* Fix travis-ci build process and remove PHP5 support [#366] (Joachim Fritschi)
|
||||
* Fix use of deprecated setDebug() in examples [#360] (Joachim Fritschi)
|
||||
* Fix session_set_save_handler error [#365] (Joachim Fritschi)
|
||||
* Fix wrong server_port documentation [#369] (Joachim Fritschi)
|
||||
|
||||
Improvement:
|
||||
* support samesite cookies attribute (#370) (Mickael)
|
||||
* Remove PHP5 support [#366] (Joachim Fritschi)
|
||||
|
||||
|
||||
Changes in version 1.3.9
|
||||
|
||||
Bug Fixes:
|
||||
* Fix regression of #248: Support of longer session tickets (#349) (Alan Nelson)
|
||||
* Fix private call generating php warning and no logout handling (#352) (Julien Gribonvald)
|
||||
|
||||
Improvement:
|
||||
* Add support for logging via a PSR-3 logger [#329] (Jon Dufresne)
|
||||
* Improve attribute handling [#317] (Tobias Schiebeck)
|
||||
* Prefer composer autoload over Autoload.php (Jon Dufresne)
|
||||
* Add Galego Language [#356] Sherwin Harris
|
||||
* Add Portuges Language [#358] Sherwin Harris
|
||||
* Accept callback with extended HTTP_ACCESS headers [#342] (Ivaylo Botyov Nikolov)
|
||||
* Refactor session handling [#340] (Henry Pan, Andrew Miller)
|
||||
|
||||
Changes in version 1.3.8
|
||||
|
||||
Bug Fixes:
|
||||
* Fix pear package [#297] (Phil Fenstermacher)
|
||||
|
||||
Improvement:
|
||||
* Adding support for PROXY CALLBACK using POST parameters instead of GET [#312]
|
||||
|
||||
Changes in version 1.3.7
|
||||
|
||||
Bug Fixes:
|
||||
* Fix pear package [#297] (Phil Fenstermacher)
|
||||
|
||||
Improvement:
|
||||
* add method to get list of supported protocols (#293) Julien Boulen
|
||||
|
||||
|
||||
Changes in version 1.3.6
|
||||
|
||||
Security Fixes:
|
||||
* Fix XSS in proxy mode [#271] (Joachim Fritschi)
|
||||
|
||||
Bug Fixes:
|
||||
* Fix bad condition [#252] (Brice Vercoustre)
|
||||
* Hash ticket strings to generate valid-length session-ids [#224, #244, #248] (Adam Franco)
|
||||
* Fix "phpCAS" class capitalization in code [#273, #277] (phy25)
|
||||
|
||||
Improvement:
|
||||
* Remove fallback for __autoload [#247] (marinaglancy)
|
||||
* More robust check for Windows OS in File.php [#275] (xamount)
|
||||
* Fix continue statement within switch/case for php 7.3 compatibility [#278] (stonk7)
|
||||
|
||||
Changes in version 1.3.5
|
||||
|
||||
Security Fixes:
|
||||
* Fix possible authentication bypass in validateCAS20 [#228] (Gregory Boddin)
|
||||
|
||||
Bug Fixes:
|
||||
* Fix file permissions (non-executable) [#177] (Remi Collet)
|
||||
* Fixed translations Greek and Japanese [#192](ikari7789)
|
||||
* Fix errors under phpdbg [#204] (MasonM)
|
||||
* Fix logout replication error [#213] (Gregory Boddin)
|
||||
|
||||
Improvement:
|
||||
* Add more debug info to logout code [#95] (Joachim Fritschi)
|
||||
* Allow longer ticket >32 chars for PGTStorage [#130] (Joachim Fritchi)
|
||||
* Improved verification of supplied CA arguments [#172] (Joachim Fritschi)
|
||||
* Change minimum supported php version to 5.4 in documentation (Joachim Fritschi)
|
||||
* Add message to CAS_Authentication_Exception [#197] (Baldinof)
|
||||
* Ingnore composer related files and directories [#201] (greg0ire)
|
||||
* Add setter for cas client [#206] (greg0ire)
|
||||
* Add callback for attribute parsing [#205] (Gregory Boddin)
|
||||
* Added setter for base url [#208] (LeopardDennis)
|
||||
* Fix documentation of code documentation [#216] (erozqba)
|
||||
* Improved https detection by HTTP_X_FORWARDED_Protocol [#220] (Gregory Boddin)
|
||||
* Add language support for simplified chinese [#227] (phy25)
|
||||
|
||||
|
||||
Changes in version 1.3.4
|
||||
Security Fixes:
|
||||
|
||||
Bug Fixes:
|
||||
* Mark auth call completed for post-auth callback [#131] (Daniel Frett)
|
||||
* Remove typo CAS_TypeMismatchException [#133] (Gabrijel Gavranović)
|
||||
* Fix SERVER_ADMIN error for alternate Webservers [#103] (Joachim Fritschi)
|
||||
* Fix non-strict string comparision in _isHttps check [#139] (Brandon Peters)
|
||||
* Fix setNoCasServerValidation for cURL 7.10 [#122] (Joachim Fritschi)
|
||||
* Fix renew support [#93] (Joachim Fritschi)
|
||||
* _getClientUrl() fixes with reverse proxies [#154] adongy
|
||||
* Param type doc should be 'string' in CAS::logoutWithRedirectService() [#167] Chris McCafferty
|
||||
* Fix broken class reference [#161] Joachim Fritschi
|
||||
|
||||
|
||||
Improvement:
|
||||
* Add phpCAS::isInitialized() API method [#112] (Adam Franco)
|
||||
* select temporary directory based on env vars [#136) (Geoffroy Desvernay)
|
||||
* Add gitattributes to reduce unnecessary files from composer installs. [#141] (Jon Dufresne)
|
||||
* Allow cas endpoint to be a 'get url' [#146] (flushbi)
|
||||
* Add documentation for phpCAS::$_PHPCAS_CLIENT [#156] (Sylvain)
|
||||
* Improve https check [#139] (Joachim Fritschi)
|
||||
* Add time to trace [#158] (cwsterling)
|
||||
* Add php5.6 tests, move to faster docker env [#169] (Florian Holzhauer)
|
||||
* Introduce a setVerbose() toggle to prevent debug info leaking in production [#152 #147] (Joachim Fritschi)
|
||||
|
||||
|
||||
Changes in version 1.3.3
|
||||
Security Fixes:
|
||||
* CVE-2014-4172 Urlencode all tickets [#125] (Marvin Addison)
|
||||
|
||||
Bug Fixes:
|
||||
* Fix CURL compatibility CURL >= 7.28.0 [#66] (adoy)
|
||||
* Commit session before redirect [#79] (kakawait)
|
||||
* Fix warnings for php => 5.5 [87] (fh)
|
||||
* Update wrong wording in examples [#90] (misilot)
|
||||
* Fixed bug in imap.php [#105] (echampet)
|
||||
* Fix missing Server_Admin variable for nginex [#121](arianf)
|
||||
* Fix error in TypeMismatchException [#123 ](Develle)
|
||||
* Fix bug in https test [#126] (Florent Baldino)
|
||||
|
||||
|
||||
Improvement:
|
||||
* Fix grammar of documentation [#61] (frett)
|
||||
* Improved testability of the phpCAS client [#7] (Adam Franco)
|
||||
* Fixed typo [#70] (fh)
|
||||
* Example for improved cookie hardening [#67] (Joachim Fritschi)
|
||||
* Added support for X-Forwarded-Proto Header [#77] (Paul Donohue)
|
||||
* Added composer support [#73] (dhyde)
|
||||
* Travis for continuous integration [#82] (fh)
|
||||
* Support for X-Forwared-Port [#100] (neopeak)
|
||||
* Support for CAS 3.0 protocol [#116] (fredrik-w)
|
||||
|
||||
|
||||
Changes in version 1.3.2
|
||||
Security Fixes:
|
||||
* CVE-2012-5583 Missing CN validation of CAS server certificate [#58] (Joachim Fritschi)
|
||||
|
||||
Bug Fixes:
|
||||
* Fix broken character encoding in Greek and French [#40] (Joachim Fritschi)
|
||||
* Minor error corrections in a few example files [] (Joachim Fritschi)
|
||||
* Remove erroneous break statement [#44] (jbittel)
|
||||
* Use X-Forwarded-Port [#45] (Andrew Kirkpatrick)
|
||||
* Stop autoloader using set_include_path [#51/#52] (drysdaleb)
|
||||
* Fix undefined property in the rebroadcast code [#47] (Joachim Fritschi)
|
||||
|
||||
Improvement:
|
||||
* Enable getCookies on a proxied sevices [#56] (Adam Franco)
|
||||
|
||||
Changes in version 1.3.1
|
||||
Bug Fixes:
|
||||
* Readd PEAR support to the package [#30] (Joachim Fritschi)
|
||||
* fix a __autoload conflicts in the autoloader [#36] (Joachim Fritschi)
|
||||
* fix PEAR code style errors [25] (Joachim Fritschi)
|
||||
* properly unset variables during checkAuthenticate[#35] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.3.0
|
||||
Improvements:
|
||||
* enable single sign-out when session has already started [#29] (Benvii)
|
||||
|
||||
Changes in version 1.3.0RC1
|
||||
|
||||
Bug Fixes:
|
||||
* the saml logout url should be parsed urlencoded [#24] (dlineate)
|
||||
* fix a proxy mode bug introduced in a previous comitt [#16] (Adam Franco)
|
||||
* Fix include_path order so that the phpCAS path takes precedence [#13] (Adam Franco)
|
||||
* fix invalid characters in the php session naming [#17] (Joachim Fritschi)
|
||||
* fix an initialisation problem introduced in the PGT storage [18] (Daniel Frett)
|
||||
* make sure the PGTStorage object is initialized if a user is utilizing the createTable method [#4] (Daniel Frett)
|
||||
* Fix error message in phpCAS::setCacheTimesForAuthRecheck() [PHPCAS-132/#1] (Bradley Froehle)
|
||||
* Always return attributes in utf8 [PHPCAS-102]
|
||||
* Fix warning during debugging if debug is set to false [PHPCAS-123] (Sean Watkins)
|
||||
|
||||
New Features:
|
||||
* Add a script to create the PGT db table in proxy mode [#11] (Joachim Fritschi)
|
||||
* Switch to the Apache License [#5] (Adam Franco, Joachim Fritschi)
|
||||
* Move to github and add all necessary file to package [#12] (Adam Franco)
|
||||
* New build process for github [#12] (Adam Franco)
|
||||
* Update unit tests to work with the lastest phpunit version [PHPCAS-128] (Adam Franco)
|
||||
* Refacatoring of the protocol decision making to allow validation of proxied usage [PHPCAS-69] (Joachim Fritschi, Adam Franco)
|
||||
* Rebroadcast of logout and pgtiou to support clustered phpcas [PHPCAS-100] (Matthew Selwood, Adam Franco)
|
||||
|
||||
Improvements:
|
||||
* Improved cookie handling [] (Adam Franco
|
||||
* Indent, format and user name guidelines of PEAR [#14] (Joachim Fritschi)
|
||||
* Add a class autoloading feature [PHPCAS-125/#8] (Joachim Fritschi)
|
||||
* Remove global variables [PHPCAS-126] (Adam Franco)
|
||||
* Implementation of an exception framework to allow gracefull termination [PHPCAS-109] (Joachim Fritschi)
|
||||
|
||||
Security Fixes:
|
||||
* CVE-2012-1104 validate proxied usage of a service [PHPCAS-69] (Joachim Fritschi, Adam Franco)
|
||||
* CVE-2012-1105 change the default PGT save path to the session storage path and set proper permissions [#22] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.2.2
|
||||
|
||||
Bug Fixes:
|
||||
* Improve compatibility with php < 5.3 for E_USER_DEPRECATED [PHPCAS-116] (Hugh Eaves)
|
||||
|
||||
Changes in version 1.2.2RC1
|
||||
|
||||
Bug Fixes:
|
||||
* CASClient::getURL() cannot be private [PHPCAS-103] (Joachim Fritschi)
|
||||
* CASClient::getServerServiceValidateURL() doesn't respect existing query strings [PHPCAS-104] (Bradley Froehle, Joachim Fritschi)
|
||||
* CASClient::retrievePT() must be a public function [PHPCAS-107] (Joachim Fritschi)
|
||||
* Expose setNoClearTicketsFromUrl() to the client [PHPCAS-108] (Joachim Fritschi)
|
||||
* Remove the PGT filestorage in xml format that is not implemented [PHPCAS-112] (Joachim Fritschi)
|
||||
* Fix compatibility of the PGT db storage interface with postgres [PHPCAS-113] (Joachim Fritschi)
|
||||
|
||||
Improvement
|
||||
* Support for proxied POST requests. [PHPCAS-90] (Adam Franco)
|
||||
* Add missing example for the new pgt-db storage [PHPCAS-101] (Joachim Fritschi)
|
||||
* CASClient::getServerLoginURL(): Don't cache gateway/renew parameters [PHPCAS-105] (Bradley Froehle)
|
||||
* fix parsing of cookies with special symbols in their values [PHPCAS-106] (Joachim Fritschi)
|
||||
* Removal of the debug_backtrace hack for php4 [PHPCAS-110] (Joachim Fritschi)
|
||||
* Clean up the naming structure of the classes [PHPCAS-111] (Joachim Fritschi)
|
||||
* Better debug log output format [PHPCAS-114] (Joachim Fritschi)
|
||||
* Many more examples and one central config. Improved code documentation [PHPCAS-86] (Joachim Fritschi, Adam Franco)
|
||||
|
||||
Changes in version 1.2.1
|
||||
* None
|
||||
|
||||
Changes in version 1.2.1RC1
|
||||
Improvements
|
||||
* add support for storing PGTs in a database [PHPCAS-94] (Daniel Frett)
|
||||
|
||||
Bug Fixes
|
||||
* phpCAS::setDebug(FALSE) should stop logging [PHPCAS-95] (Joachim Fritschi)
|
||||
* fix checkAuthenticate return value documentation [PHPCAS-92] (Joachim Fritschi)
|
||||
* fix PGTStorage contructor name [PHPCAS-93] (Daniel Frett)
|
||||
* fix the PHPCAS_SERVICE_NOT_AVAILABLE constant [PHPCAS-91] (Daniel Frett)
|
||||
* fix redirection with multiple proxies in HTTP_X_FORWARDED_HOST [PHPCAS-98] (Joachim Fritschi)
|
||||
* fix some undefinde variable warnings in debug mode [PHPCAS-96] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.2.0
|
||||
* None
|
||||
|
||||
Changes in version 1.2.0RC2
|
||||
Improvements
|
||||
* add callback hooks during authentication and single sign-out [PHPCAS-76] (Adam Franco)
|
||||
|
||||
Changes in version 1.2.0RC1
|
||||
Improvements
|
||||
* add hasAttribute($key) and getAttribute($key) [PHPCAS-43] (Adam Franco)
|
||||
* add unit tests for cas 2.0 attribute support [PHPCAS-88] (Adam Franco)
|
||||
* expose the proxy chain through the phpcas interface [PHPCAS-89] (Adam Franco)
|
||||
* add deprecation messages to the logout functions with an url parameter [PHPCAS-85] (Joachim Fritschi)
|
||||
|
||||
Bug Fixes
|
||||
* fix public/private modifier for some functions [PHPCAS-87] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.2.0-beta1
|
||||
|
||||
Bug Fixes
|
||||
* fix redirection behind a proxy. [PHPCAS-78] (Alex Barker)
|
||||
* remove the bogus setCasServerCert() function and clean up the curl ssl settings [PHPCAS-84] (Joachim Fritschi)
|
||||
|
||||
Improvements
|
||||
* mark the logout functions with an url parameter a deprecated [PHPCAS-85] (Joachim Fritschi)
|
||||
* add public/private modifier for all vars and functions [PHPCAS-77] (Joachim Fritschi)
|
||||
* add a testing framwork that implement on and offline testing capabilities [PHPCAS-66] (Adam Franco)
|
||||
* add RFC compliant cookie storage for the proxy() mode. [PHPCAS-54] (Adam Franco)
|
||||
* removal of the domxml compatibility lib [PHPCAS-72] (Matthew Brooks, Joachim Fritschi)
|
||||
* add support for attributes for the cas_2.0 protocol [PHPCAS-43] (Joachim Fritschi, Adam Franco)
|
||||
* removal of unused code and comments [PHPCAS-63] (Joachim Fritschi)
|
||||
* fix static function warnings for php 5.x [PHPCAS-46] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.3
|
||||
Bug Fixes
|
||||
* removal of the non functional pgt-db backend [PHPCAS-65] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.3RC1
|
||||
Security Issue
|
||||
* CVE-2010-3690 phpCAS: XSS during a proxy callback [PHPCAS-80] (Joachim Fritschi)
|
||||
* CVE-2010-3691 phpCAS: prevent symlink attacks during a proxy callback [PHPCAS-80] (Joachim Fritschi)
|
||||
* CVE-2010-3692 phpCAS: directory traversal during a proxy callback [PHPCAS-80] (Joachim Fritschi)
|
||||
|
||||
Bug Fixes
|
||||
* fix missing $this in domxml-php4-to-php5 [PHPCAS-73] (Iñaki Arenaza)
|
||||
* fix broken redirection with safari [PHPCAS-79] (Alex Barker)
|
||||
* fix missing exit() call during ticket validation [PHPCAS-76] (Igor Blanco,Joachim Fritschi)
|
||||
* fix a notice because REQUEST_URL is not defined on IIS [PHPCAS-81] (Iñaki Arenaza)
|
||||
* fix a typo in pgt-db.php [PHPCAS-75] (Julien Cochennec)
|
||||
|
||||
Improvements
|
||||
* upgrade domxml-php4-to-php5 to the newest version [PHPCAS-74] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.2
|
||||
* None
|
||||
|
||||
Changes in version 1.1.2RC2
|
||||
Bug Fixes
|
||||
* Prevent domxml-php4-to-php5 to be inclueded twice [PHPCAS-48] (Brad Krane)
|
||||
|
||||
Changes in version 1.1.2RC1
|
||||
Security Issue
|
||||
* Fix a session hijacking hole CVE-2010-2795 [PHPCAS-61] (Joachim Fritschi)
|
||||
* callbackurl in proxy mode should be urlencoded CVE-2010-2796 [PHPCAS-67] (Joachim Fritschi)
|
||||
|
||||
Improvement
|
||||
* Debuglog contains phpCAS version information [PHPCAS-62] (Joachim Fritschi)
|
||||
|
||||
Bug Fixes
|
||||
* Fix warnings for SAML responses without attributes [PHPCAS-59] (Joachim Fritschi)
|
||||
* Fix duplicate SAML debug output [PHPCAS-64] (Joachim Fritschi)
|
||||
* Providing a new ST/PT/SA during an authenticated session will be ignored
|
||||
and a warning will be issued to the debug log. [PHPCAS-61] (Joachim Fritschi)
|
||||
* fix 2 undefinded variable notices in serviceWeb() [PHPCAS-68] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.1
|
||||
Improvement
|
||||
* On Single Sign Out destroy any existing application session before deleting the phpcas session [PHPCAS-58] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.1RC2
|
||||
Bug fixes
|
||||
* Fix bug in handling urls containing parameters without values [PHPCAS-57] (Joe Lencioni)
|
||||
* New XSS patch for PHPCAS-52 that was undone in r48507 [PHPCAS-57] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.1RC1
|
||||
Bug fixes
|
||||
* Fix bug in restoring an existing session [PHPCAS-55] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0
|
||||
Improvement
|
||||
* Replace deprecated split() with explode(). [PHPCAS-42] (Joe Lencioni)
|
||||
|
||||
Changes in version 1.1.0RC8
|
||||
Bug fixes
|
||||
* Add additional comments regarding the use of serviceValidate and proxyValdiate [PHPCAS-44] (Joachim Fritschi)
|
||||
* Revert all changes made to the ticket parsing in r47347 r48210 [PHPCAS-44] (Joachim Fritschi)
|
||||
* Fix warning when destroying uninitialized session [PHPCAS-53] (Yann Richard,Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC7
|
||||
Security fixes
|
||||
* Fix XSS Vulnerability. Sanatize parameters before using the url submitted by a client [PHPCAS-52] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC6
|
||||
Bug fixes
|
||||
* restore any possible old session before renaming the session [PHPCAS-50] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC5
|
||||
Bug fixes
|
||||
* fixed don't destroy existing sessions unless needed, more debug output [PHPCAS-50] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC4
|
||||
Bug fixes
|
||||
|
||||
* fixed use PHP4 functions to parse saml11 attributes [PHPCAS-51] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC3
|
||||
Bug fixes
|
||||
|
||||
* added a check for missing params [PHPCAS-42] (Joachim Fritschi)
|
||||
|
||||
Changes in version 1.1.0RC2
|
||||
New features
|
||||
|
||||
* added custom validation Urls [PHPCAS-45] (Joachim Fritschi).
|
||||
|
||||
Bug fixes
|
||||
|
||||
* fixed PGT DB storage parameter list [PHPCAS-47] (Paul Merchant, Jr.)
|
||||
* fixed parsing of STs [PHPCAS-44] (Joachim Fritschi)
|
||||
* fixed session initialisation [PHPCAS-50] (Joachim Fritschi)
|
||||
* fixed urls with than one query parameter [PHPCAS-42] (Caio Chassot)
|
||||
|
||||
Changes in version 1.1.0RC1
|
||||
New features
|
||||
|
||||
* added SAML support [PHPCAS-40] (Brian Long and Matthias Crauwels).
|
||||
|
||||
Bug fixes
|
||||
|
||||
* fixed invalid validation URLs [PHPCAS-39] (Alex Danieli).
|
||||
* removed old PHP4 references [PHPCAS-41] (Yann Richard).
|
||||
* fixed curl options [PHPCAS-38] (Andy Cowling).
|
||||
|
||||
Improvement
|
||||
|
||||
* added accept IP addresses for allowed clients [PHPCAS-37] (Arunas Stockus)
|
||||
|
||||
Changes in version 1.0.2RC1
|
||||
Bug fixes
|
||||
|
||||
* fix redirections masking error messages [PHPCAS-36] (Olivier Berger)
|
||||
* fixed validatePGT() failing on phpCAS::traceBegin() with newer domxml-php4-to-php5.php [PHPCAS-35] (Olivier Berger)
|
||||
* Fixed missing exit() at end of callback() method [PHPCAS-34] (Olivier Berger)
|
||||
* Update included domxml-php4-php5.php to most recent version now under LGPL [PHPCAS-30] (Olivier Berger)
|
||||
* fixed empty $target_service in CAS_Client:serviceMail [PHPCAS-22] (Julien Marchal).
|
||||
|
||||
Changes in version 1.0.1
|
||||
Bug fixes
|
||||
|
||||
* fixed PEAR base install directory [PHPCAS-28] (Brett Bieber).
|
||||
* fixed illegal characters in session id [PHPCAS-29] (Michael Ströder, Brett Bieber).
|
||||
* fixed refresh with ticket causes authentication failure [related to PHPCAS-27] (Brett Bieber).
|
||||
* fixed conflict with custom session handlers [PHPCAS-26] (Martin Gonzalez).
|
||||
|
||||
Changes in version 1.0.0
|
||||
New features
|
||||
|
||||
* phpCAS is now PEAR-installable (Brett Bieber).
|
||||
* added method handleLogoutRequests() to handle logout requests incoming from the CAS server (Julien Marchal and Pascal Aubry, requested by Craig Andrews).
|
||||
* added methods setHttpProxy(), setNetworkInterface() and setExtraCurlOptions() (Stéphane Gully).
|
||||
|
||||
Enhancements
|
||||
|
||||
* removed undesirable notice (Glennie Vignarajah).
|
||||
* removed PEAR DB dependency when storing PGTs to the filesytem (Stéphane Gully).
|
||||
|
||||
Changes in version 0.6.0
|
||||
New features
|
||||
|
||||
* added methods setCasServerCert() and setCasServerCaCert() to authenticate the CAS server, and method setNoCasServerValidation() to skip the SSL checks (Pascal Aubry, requested by Andrew Petro).
|
||||
* Added spanish and catalan translations (Ivan Garcia).
|
||||
|
||||
Bug fix
|
||||
|
||||
* fixed PGT storage path on Windows (Olivier Thebault).
|
||||
|
||||
Changes in version 0.5.1
|
||||
New features
|
||||
|
||||
* restored method isAuthenticated() (Julien Marchal).
|
||||
|
||||
Changes in version 0.5.0
|
||||
New features
|
||||
|
||||
* added japanese translation (Noriyuki Fukuoka).
|
||||
* added german translation (Henrik Genssen).
|
||||
* phpCAS now works for CAS v3 proxy tickets (Matt Zukowski).
|
||||
* phpCAS now also works with lighttpd (Marvin Addison)
|
||||
|
||||
Bug fixes
|
||||
|
||||
* fixed method setHTMLFooter() (Noriyuki Fukuoka).
|
||||
* fixed method setHTMLHeader() (Xavier Castanho).
|
||||
* fixed method isHttps() (Henrik Genssen).
|
||||
* fixed method PGTStorageDB() (Ray Lambe).
|
||||
* encode all the parameters, not only '&' characters (Matthew Debus).
|
||||
* fixed ST proxy tickets (Julien Marchal).
|
||||
|
||||
Changes in version 0.4.23
|
||||
Enhancement
|
||||
|
||||
* removed notice messages (David Lowry).
|
||||
|
||||
Changes in version 0.4.22
|
||||
Bug fix
|
||||
|
||||
* added default value for parameter gateway in methods setServerLoginUrl() and redirectToCas() (Velpi).
|
||||
|
||||
New Feature
|
||||
|
||||
* added method isSessionAuthenticated() (Brendan Arnold).
|
||||
|
||||
Other change
|
||||
|
||||
* removed the call to error_reporting() to allow the configuration of error reporting at server level (Pascal Aubry, requested by Sylvain Derosiaux).
|
||||
|
||||
Changes in version 0.4.21
|
||||
Bug fix
|
||||
|
||||
* some URLs were ill-formed in some rare circumstances (Jérôme Andrieux).
|
||||
|
||||
New Feature
|
||||
|
||||
* added methods setServerLoginURL() and setServerLogoutURL() (Wyman Chan).
|
||||
|
||||
Changes in version 0.4.20
|
||||
New feature
|
||||
|
||||
* phpCAS::checkAuthentication() implements the gateway feature of CAS (Pascal Aubry, requested by Romuald Lorthioir).
|
||||
|
||||
Other change
|
||||
|
||||
* phpCAS::authenticateIfNeeded() was renamed phpCAS::forceAuthentication() (Pascal Aubry).
|
||||
|
||||
Changes in version 0.4.19
|
||||
New features
|
||||
|
||||
* the service URL for the CAs server can be fixed with method phpCAS::setFixedServiceURL (Julien Marchal).
|
||||
* the callback URL used to receive PGTs can be fixed with method phpCAS::setFixedCallbackURL() (Julien Marchal).
|
||||
|
||||
* added a CAS_Client wrapper to class phpCAS for method retrievePGT() (Julien Marchal).
|
||||
|
||||
Changes in version 0.4.18
|
||||
Bug fixes
|
||||
|
||||
* debugging information was missing (Alexandre Boisseau).
|
||||
* used an undefined variable in pgt-file.php (Alexandre Boisseau).
|
||||
|
||||
Changes in version 0.4.17
|
||||
Enhancement
|
||||
|
||||
* made phpCAS PHP5 compliant (Vangelis Haniotakis).
|
||||
|
||||
Changes in version 0.4.16
|
||||
Enhancement
|
||||
|
||||
* added the possibility not to start the session management (Vangelis Haniotakis).
|
||||
|
||||
Changes in version 0.4.15
|
||||
Enhancement
|
||||
|
||||
* added a hack to make phpCAS work with IIS (Vangelis Haniotakis).
|
||||
|
||||
Changes in version 0.4.14
|
||||
Enhancement
|
||||
|
||||
* a URL can be given to the CAS server on logout (Sébastien Gougeon and Yann Richard).
|
||||
|
||||
Changes in version 0.4.13
|
||||
Bug fix
|
||||
|
||||
* Removed infinite loop in debug mode (Robert Legros).
|
||||
|
||||
Changes in version 0.4.12
|
||||
Enhancement
|
||||
|
||||
* phpCAS now works even if the web server does not set SERVER_NAME, by relying on HTTP_HOST (Terence Chiu).
|
||||
|
||||
Changes in version 0.4.11
|
||||
Bug fix
|
||||
|
||||
* A typo prevented ticket validation to work correctly (Robert Legros).
|
||||
|
||||
Changes in version 0.4.10
|
||||
Enhancement
|
||||
|
||||
* phpCAS was previously working with PHP >= 4.3.0. A debug_backtrace() wrapper was added and get_elements_by_tagname() calls were modified to make phpCAS work with phpCAS >= 4.2.2 (Robert Legros).
|
||||
|
||||
Changes in version 0.4.9
|
||||
New features
|
||||
|
||||
* Added greek translation (Haniotakis Vangelis).
|
||||
|
||||
Changes in version 0.4.8
|
||||
Enhancements
|
||||
|
||||
* PEAR's DB.php inclusion is done only if a DB class was not already included. This eases the integration into some stand-alone tools that already include DB.php, like Tikiwiki (Pascal Aubry, requested by Terence Chiu).
|
||||
|
||||
Changes in version 0.4.7
|
||||
Enhancements
|
||||
|
||||
* PHP session is now destroyed when using the phpCAS::logout() method (Pascal Aubry, requested by Ruben Recaba).
|
||||
* Call getenv() whenever possible instead of directly dealing with environment variables (with $_ENV['xxx']), as $_ENV is not available par default on some Windows systems (Pascal Aubry).
|
||||
* Set error reporting level to E_ALL ~ E_NOTICE (Pascal Aubry).
|
||||
* Added the release number in the name of the main directory of the zip distribution file (Pascal Aubry, requested by Vincent Mathieu).
|
||||
* Explicitly set certificate control to get round with different curl default configurations (Wyman Chan).
|
||||
|
||||
Changes in version 0.4.6
|
||||
Security bug fix
|
||||
|
||||
* Credentials given to HTTP realms were given in the service URLs to the CAS server (Julien Marchal).
|
||||
|
||||
Enhancements
|
||||
|
||||
* phpCAS now works behind an Apache reverse proxy (Julien Marchal).
|
||||
|
||||
Changes in version 0.4.5
|
||||
Enhancements
|
||||
|
||||
* Developer releasing is now made by ant (Pascal Aubry).
|
||||
|
||||
Bug fixes
|
||||
|
||||
* CAS/PGTStorage files have been renamed to fit to Windows case insensitivity (Pascal Aubry);
|
||||
* %TMP% and %TEMP% environment variables are now taken into account to set the location of the log file (Pascal Aubry).
|
||||
|
||||
Changes in version 0.4.4
|
||||
Enhancement
|
||||
|
||||
* ticket retrieval and validation is now made with curl (Pascal Aubry).
|
||||
|
||||
Changes in version 0.4.3
|
||||
Bug fix
|
||||
|
||||
* phpCAS was not exiting right after redirecting in callback mode (Julien Marchal)
|
||||
|
||||
Changes in version 0.4.2
|
||||
New features
|
||||
|
||||
* Authentication checking is not necessarily redirecting to the CAS server (introduced phpCAS::isAuthenticated()) (Pascal Aubry)
|
||||
* phpCAS can now be used to access IMAP/POP3/NNTP services (cf phpCAS::serviceMail()) (Pascal Aubry)
|
||||
|
||||
Enhancements
|
||||
|
||||
* debugging informations has been improved and is now send to a separate file (/tmp/phpCAS.log by default, can be changed by phpCAS::setDebug()) (Pascal Aubry)
|
||||
|
||||
Changes
|
||||
|
||||
* phpCAS::authenticate() is replaced by phpCAS::authenticateIfNeeded() (semantics unchanged) (Pascal Aubry)
|
||||
* phpCAS::service() is replaced by phpCAS::serviceWeb() (semantics unchanged) (Pascal Aubry)
|
||||
* phpCAS::setDebug() accepts FALSE (to stop debugging) or the name of a file (to log informations) (Pascal Aubry)
|
||||
|
||||
Changes in version 0.4.1
|
||||
New features
|
||||
|
||||
* Sessionning between CAS proxies and services (Pascal Aubry)
|
||||
|
||||
Changes in version 0.4
|
||||
New features
|
||||
|
||||
* CAS proxies can be chained (Pascal Aubry)
|
||||
* improved error printing and debugging (introduced phpCAS::error()) (Pascal Aubry)
|
||||
|
||||
Enhancements
|
||||
|
||||
* proxy parameter removed from phpCAS::client() and introduced phpCAS::proxy() (Pascal Aubry)
|
||||
* moved history from CAS/doc.php to history.php (create_version script updated accordingly) (Pascal Aubry)
|
||||
* improved type-checking and controls for phpCAS methods (Pascal Aubry)
|
||||
|
||||
Changes in version 0.3.2
|
||||
New features
|
||||
|
||||
* CAS proxies now work with HTTP (HTTPS only used for callbacks) (Pascal Aubry)
|
||||
|
||||
Changes in version 0.3.1
|
||||
Bug fixes
|
||||
|
||||
* syntax error in CAS/Client.php (Julien Marchal)
|
||||
|
||||
Changes in version 0.3
|
||||
New features
|
||||
|
||||
* CAS proxies are now supported (but no PGT retrieving for proxied client) (Pascal Aubry)
|
||||
* introduced phpCAS container (Pascal Aubry)
|
||||
|
||||
Bug fixes
|
||||
|
||||
* CAS_LANG_DEFAULT is now taken into account (Pascal Aubry)
|
||||
|
||||
TODO
|
||||
|
||||
* support for PGT storage to databases (Pascal Aubry)
|
||||
* PGT retrieving for proxied clients (Pascal Aubry)
|
||||
|
||||
Version 0.2
|
||||
Features (Pascal Aubry)
|
||||
|
||||
* `Basic' (1.0) CAS mechanism supported (CAS proxies not implemented)
|
||||
* Support for CAS versions 1.0 and 2.0 URL's
|
||||
* Debug mode
|
||||
* Customization of all output pages
|
||||
* Internationalization (english and french, looking for translators...)
|
||||
145
include/phpCAS/docs/Upgrading
Normal file
145
include/phpCAS/docs/Upgrading
Normal file
@@ -0,0 +1,145 @@
|
||||
################################
|
||||
### Upgrading 1.5.0 -> 1.6.0 ###
|
||||
################################
|
||||
|
||||
phpCAS now requires an additional service base URL argument when constructing
|
||||
the client class, similar to other CAS client's serverName config. It accepts
|
||||
any argument of:
|
||||
|
||||
1. A service base URL string. The service URL discovery will always use this
|
||||
server name (protocol, hostname and port number) without using any external
|
||||
host names.
|
||||
2. An array of service base URL strings. The service URL discovery will check
|
||||
against this list before using the auto discovered base URL. If there is no
|
||||
match, the first base URL in the array will be used as the default. This
|
||||
option is helpful if your PHP website is accessible through multiple domains
|
||||
without a canonical name, or through both HTTP and HTTPS.
|
||||
3. A class that implements CAS_ServiceBaseUrl_Interface. If you need to
|
||||
customize the base URL discovery behavior, you can pass in a class that
|
||||
implements the interface.
|
||||
|
||||
For option 1 and 2, protocol, hostname and port should all appear without a
|
||||
trailing slash, e.g. http://example.org:8080. You can omit the default port for
|
||||
the protocol, which means use https://example.org instead of
|
||||
https://example.org:443 (if you use HTTPS).
|
||||
|
||||
For security reasons, we no longer allow service base URL discovery without an
|
||||
allowed list check by default. For more information, refer to the security
|
||||
advisory.
|
||||
|
||||
This version also changed the CURL User Agent string that phpCAS uses when
|
||||
sending validation requests to the CAS server. It will appear as phpCAS/1.6.0
|
||||
with the version number reflecting the library version.
|
||||
|
||||
|
||||
################################
|
||||
### Upgrading 1.3.3 -> 1.3.4 ###
|
||||
################################
|
||||
|
||||
For security hardening purposes the verbose error messages to the web browsers
|
||||
are now masked. If you want to have the verbose messages you need to use:
|
||||
phpCAS::setVerbose(true);
|
||||
This will set the configuration to the old verbose mode that helps during
|
||||
development and debugging.
|
||||
|
||||
|
||||
################################
|
||||
### Upgrading 1.3.1 -> 1.3.2 ###
|
||||
################################
|
||||
|
||||
Due to the missing validation of the CN of the SSL certifcate it may be that
|
||||
phpcas fails validation of CAS server certicates that do not match the IP/DNS
|
||||
name you use in the phpcas client() or proxy() setup.
|
||||
If this happens a quick workaround to change the setup to the old but unsecure
|
||||
behaviour. This can be seen in the no_ssl_cn_validation example.
|
||||
This is not a recommended setting and is no a secure setup!
|
||||
|
||||
################################
|
||||
### Upgrading 1.2.x -> 1.3.0 ###
|
||||
################################
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
1. Changing of the default debug.log permissions:
|
||||
------------------------------------------------------------------
|
||||
|
||||
The default debug log is now created with 0600 permissions to be only readable
|
||||
by the webserver
|
||||
|
||||
-------------------------------------------------------
|
||||
2. Changing of the behaviour of proxied applications:
|
||||
-------------------------------------------------------
|
||||
|
||||
If your application is being proxied (Another casified application is using
|
||||
proxy tickets to access your service you need to change your configuration. The
|
||||
new default configuration is now to deny any proxied use of your service unless
|
||||
it is exlicitly allowed:
|
||||
|
||||
If you want your service to be proxied you have to enable it (default disabled)
|
||||
and define an accepable list of proxies that are allowed to proxy your service.
|
||||
|
||||
Add each allowed proxy definition object. For the normal CAS_ProxyChain
|
||||
class, the constructor takes an array of proxies to match. The list is in
|
||||
reverse just as seen from the service. Proxies have to be defined in reverse
|
||||
from the service to the user. If a user hits service A and gets proxied via
|
||||
B to service C the list of acceptable on C would be array(B,A). The definition
|
||||
of an individual proxy can be either a string or a regexp (preg_match is used)
|
||||
that will be matched against the proxy list supplied by the cas server
|
||||
when validating the proxy tickets. The strings are compared starting from
|
||||
the beginning and must fully match with the proxies in the list.
|
||||
|
||||
Examples:
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
'https://app.example.com/'
|
||||
)));
|
||||
or
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
'/^https:\/\/app[0-9]\.example\.com\/rest\//',
|
||||
'http://client.example.com/'
|
||||
)));
|
||||
|
||||
For quick testing or in certain production screnarios you might want to
|
||||
allow allow any other valid service to proxy your service. To do so, add
|
||||
the "Any" chain:
|
||||
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
|
||||
THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
|
||||
IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
|
||||
ON THIS SERVICE.
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
3. Changing of the default PGT file storage location in proxy mode:
|
||||
----------------------------------------------------------------
|
||||
|
||||
The default storage of the sensitive PGT session files is the
|
||||
session_save_path() now. This is a php environment dependent dir which is also
|
||||
used for storing your php session data. The default permissions are also changed
|
||||
to 0600 to be only readable by the webserver.
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
4. The setPGTStorageFile() function has changed it parameters.
|
||||
------------------------------------------------------------------
|
||||
|
||||
The setPGTStorageFile() function no longer needs an storage "format" argument.
|
||||
Since the format functionality was never implemented it has now been dropped
|
||||
and only the path argument is necessary.
|
||||
|
||||
------------------------------------------------------------------
|
||||
5. The startSession boolean in the constructor has been changed to
|
||||
changeSessionID
|
||||
------------------------------------------------------------------
|
||||
|
||||
The last parameter of the constructor for has been changed from "start session"
|
||||
to "change session ID". This has no negative effects on existion integrations
|
||||
but will allow integration with other frameworks to take advantage of single
|
||||
sign-out if they switch to "true". phpCAS will then rename the session id
|
||||
(keeping all vars) and be able to single sign-out users.
|
||||
|
||||
|
||||
|
||||
|
||||
107
include/phpCAS/docs/examples/config.example.php
Normal file
107
include/phpCAS/docs/examples/config.example.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The purpose of this central config file is configuring all examples
|
||||
* in one place with minimal work for your working environment
|
||||
* Just configure all the items in this config according to your environment
|
||||
* and rename the file to config.php
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file config.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
$phpcas_path = '../../source/';
|
||||
|
||||
///////////////////////////////////////
|
||||
// Basic Config of the phpCAS client //
|
||||
///////////////////////////////////////
|
||||
|
||||
// Full Hostname of your CAS Server
|
||||
$cas_host = 'cas.example.com';
|
||||
|
||||
// Context of the CAS Server
|
||||
$cas_context = '/cas';
|
||||
|
||||
// Port of your CAS server. Normally for a https server it's 443
|
||||
$cas_port = 443;
|
||||
|
||||
// Path to the ca chain that issued the cas server certificate
|
||||
$cas_server_ca_cert_path = '/path/to/cachain.pem';
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Advanced Config for special purposes //
|
||||
//////////////////////////////////////////
|
||||
|
||||
// The "real" hosts of clustered cas server that send SAML logout messages
|
||||
// Assumes the cas server is load balanced across multiple hosts
|
||||
$cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com');
|
||||
|
||||
// Client config for the required domain name, should be protocol, hostname and port
|
||||
$client_service_name = 'http://127.0.0.1';
|
||||
|
||||
// Client config for cookie hardening
|
||||
$client_domain = '127.0.0.1';
|
||||
$client_path = 'phpcas';
|
||||
$client_secure = true;
|
||||
$client_httpOnly = true;
|
||||
$client_lifetime = 0;
|
||||
|
||||
// Database config for PGT Storage
|
||||
$db = 'pgsql:host=localhost;dbname=phpcas';
|
||||
//$db = 'mysql:host=localhost;dbname=phpcas';
|
||||
$db_user = 'phpcasuser';
|
||||
$db_password = 'mysupersecretpass';
|
||||
$db_table = 'phpcastabel';
|
||||
$driver_options = '';
|
||||
|
||||
///////////////////////////////////////////
|
||||
// End Configuration -- Don't edit below //
|
||||
///////////////////////////////////////////
|
||||
|
||||
// Generating the URLS for the local cas example services for proxy testing
|
||||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
|
||||
$curbase = 'https://' . $_SERVER['SERVER_NAME'];
|
||||
} else {
|
||||
$curbase = 'http://' . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
||||
$curbase .= ':' . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
$curdir = dirname($_SERVER['REQUEST_URI']) . "/";
|
||||
|
||||
// CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest
|
||||
$rebroadcast_node_1 = 'http://cas-client-1.example.com';
|
||||
$rebroadcast_node_2 = 'http://cas-client-2.example.com';
|
||||
|
||||
// access to a single service
|
||||
$serviceUrl = $curbase . $curdir . 'example_service.php';
|
||||
// access to a second service
|
||||
$serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php';
|
||||
|
||||
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/');
|
||||
$pgtUrlRegexp = '/^' . $pgtBase . '.*$/';
|
||||
|
||||
$cas_url = 'https://' . $cas_host;
|
||||
if ($cas_port != '443') {
|
||||
$cas_url = $cas_url . ':' . $cas_port;
|
||||
}
|
||||
$cas_url = $cas_url . $cas_context;
|
||||
|
||||
// Set the session-name to be unique to the current script so that the client script
|
||||
// doesn't share its session with a proxied script.
|
||||
// This is just useful when running the example code, but not normally.
|
||||
session_name(
|
||||
'session_for-'
|
||||
. preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME']))
|
||||
);
|
||||
// Set an UTF-8 encoding header for internation characters (User attributes)
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
?>
|
||||
53
include/phpCAS/docs/examples/create_pgt_storage_db_table.php
Normal file
53
include/phpCAS/docs/examples/create_pgt_storage_db_table.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Script that generates a default table for PGT/PGTiou storage. This script
|
||||
* assumes a database with proper permissions exists and we are habe
|
||||
* permissions to create a table.
|
||||
* All database settings have to be set in the config.php file. Or the
|
||||
* CAS_PGTStorage_Db() options:
|
||||
* $db, $db_user, $db_password, $db_table, $driver_options
|
||||
* have to filled out directly. Option examples can be found in the
|
||||
* config.example.php
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file create_pgt_storage_table.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
|
||||
// Dummy client because we need a 'client' object
|
||||
$client = new CAS_Client(
|
||||
CAS_VERSION_2_0, true, $cas_host, $cas_port, $cas_context, $client_service_name, false
|
||||
);
|
||||
|
||||
// Set the torage object
|
||||
$cas_obj = new CAS_PGTStorage_Db(
|
||||
$client, $db, $db_user, $db_password, $db_table, $driver_options
|
||||
);
|
||||
$cas_obj->init();
|
||||
$cas_obj->createTable();
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS PGT db storage table creation</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="success">
|
||||
<?php
|
||||
echo 'Table <b>' . $db_table . '</b> successfully created in database <b>' . $db . '</b>';
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
10
include/phpCAS/docs/examples/example.css
Normal file
10
include/phpCAS/docs/examples/example.css
Normal file
@@ -0,0 +1,10 @@
|
||||
.error {
|
||||
border: 1px solid #aa0000;
|
||||
color: #aa0000;
|
||||
padding: 5px;
|
||||
}
|
||||
.success {
|
||||
border: 1px solid #00aa00;
|
||||
color: #00aa00;
|
||||
padding: 5px;
|
||||
}
|
||||
82
include/phpCAS/docs/examples/example_advanced_saml11.php
Normal file
82
include/phpCAS/docs/examples/example_advanced_saml11.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Advanced example for SAML with attributes and single logout
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_advanced_saml11.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
// phpCAS::setNoCasServerValidation();
|
||||
|
||||
// Handle SAML logout requests that emanate from the CAS host exclusively.
|
||||
// Failure to restrict SAML logout requests to authorized hosts could
|
||||
// allow denial of service attacks where at the least the server is
|
||||
// tied up parsing bogus XML messages.
|
||||
phpCAS::handleLogoutRequests(true, $cas_real_hosts);
|
||||
|
||||
// Force CAS authentication on any page that includes this file
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// Some small code triggered by the logout button
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Advanced SAML 1.1 example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Advanced SAML 1.1 example</h2>
|
||||
<?php require 'script_info.php' ?>
|
||||
|
||||
Authentication succeeded for user
|
||||
<strong><?php echo phpCAS::getUser(); ?></strong>.
|
||||
|
||||
<h3>User Attributes</h3>
|
||||
<ul>
|
||||
<?php
|
||||
foreach (phpCAS::getAttributes() as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
echo '<li>', $key, ':<ol>';
|
||||
foreach ($value as $item) {
|
||||
echo '<li><strong>', $item, '</strong></li>';
|
||||
}
|
||||
echo '</ol></li>';
|
||||
} else {
|
||||
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
72
include/phpCAS/docs/examples/example_custom_urls.php
Normal file
72
include/phpCAS/docs/examples/example_custom_urls.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for overriding validation urls
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_custom_urls.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// Override the proxy validation url for any (ST and PT) any CAS 1.0, 2.0 and 3.0 validation
|
||||
// Example of the URL for the version of CAS 2.0 validation
|
||||
phpCAS::setServerProxyValidateURL('https://cas.example.org:1443/proxyValidate');
|
||||
// Override the validation url for any CAS 1.0, 2.0 and 3.0 validation
|
||||
// Example of the URL for the version of CAS 2.0 validation
|
||||
//phpCAS::setServerServiceValidateURL('https://cas.example.org:1443/serviceValidate');
|
||||
//Override the validation url for any SAML11 validation
|
||||
//phpCAS::setServerSamlValidateURL('https://cas.example.org:1443/samlValidate');
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// logout if desired
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
71
include/phpCAS/docs/examples/example_gateway.php
Normal file
71
include/phpCAS/docs/examples/example_gateway.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example that uses the CAS gateway feature
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_gateway.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
if (isset($_REQUEST['login'])) {
|
||||
phpCAS::forceAuthentication();
|
||||
}
|
||||
|
||||
// check CAS authentication
|
||||
$auth = phpCAS::checkAuthentication();
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if ($auth) {
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php include 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p><?php
|
||||
} else {
|
||||
?>
|
||||
<h1>Guest mode</h1>
|
||||
<p><a href="?login=">Login</a></p><?php
|
||||
}
|
||||
?>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
</body>
|
||||
</html>
|
||||
85
include/phpCAS/docs/examples/example_hardening.php
Normal file
85
include/phpCAS/docs/examples/example_hardening.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Advanced example for hardening the phpcas client
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_hardening.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(false);
|
||||
|
||||
// Harden session cookie to prevent some attacks on the cookie (e.g. XSS)
|
||||
session_set_cookie_params($client_lifetime, $client_path, $client_domain, $client_secure, $client_httpOnly);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
// phpCAS::setNoCasServerValidation();
|
||||
|
||||
// Handle SAML logout requests that emanate from the CAS host exclusively.
|
||||
// Failure to restrict SAML logout requests to authorized hosts could
|
||||
// allow denial of service attacks where at the least the server is
|
||||
// tied up parsing bogus XML messages.
|
||||
phpCAS::handleLogoutRequests(true, $cas_real_hosts);
|
||||
|
||||
// Force CAS authentication on any page that includes this file
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// Some small code triggered by the logout button
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Advanced SAML 1.1 example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Advanced SAML 1.1 example</h2>
|
||||
<?php require 'script_info.php' ?>
|
||||
|
||||
Authentication succeeded for user
|
||||
<strong><?php echo phpCAS::getUser(); ?></strong>.
|
||||
|
||||
<h3>User Attributes</h3>
|
||||
<ul>
|
||||
<?php
|
||||
foreach (phpCAS::getAttributes() as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
echo '<li>', $key, ':<ol>';
|
||||
foreach ($value as $item) {
|
||||
echo '<li><strong>', $item, '</strong></li>';
|
||||
}
|
||||
echo '</ol></li>';
|
||||
} else {
|
||||
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
76
include/phpCAS/docs/examples/example_html.php
Normal file
76
include/phpCAS/docs/examples/example_html.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example that changes html of phpcas messages
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_html.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// customize HTML output
|
||||
phpCAS::setHTMLHeader(
|
||||
'<html>
|
||||
<head>
|
||||
<title>__TITLE__</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>__TITLE__</h1>'
|
||||
);
|
||||
phpCAS::setHTMLFooter(
|
||||
'<hr>
|
||||
<address>
|
||||
phpCAS __PHPCAS_VERSION__,
|
||||
CAS __CAS_VERSION__ (__SERVER_BASE_URL__)
|
||||
</address>
|
||||
</body>
|
||||
</html>'
|
||||
);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client with HTML output customization</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
</body>
|
||||
</html>
|
||||
63
include/phpCAS/docs/examples/example_lang.php
Normal file
63
include/phpCAS/docs/examples/example_lang.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example that changes language of phpcas pages
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_lang.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// set the language to french
|
||||
phpCAS::setLang(PHPCAS_LANG_FRENCH);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Exemple d'internationalisation de phpCAS</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Authentification réussie !</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>L'utilisateur connecté est <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>La version de phpCAS est <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
</body>
|
||||
</html>
|
||||
64
include/phpCAS/docs/examples/example_logout.php
Normal file
64
include/phpCAS/docs/examples/example_logout.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for handling logout requests
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_logout.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// handle incoming logout requests
|
||||
phpCAS::handleLogoutRequests();
|
||||
|
||||
// Or as an advanced featue handle SAML logout requests that emanate from the
|
||||
// CAS host exclusively.
|
||||
// Failure to restrict SAML logout requests to authorized hosts could
|
||||
// allow denial of service attacks where at the least the server is
|
||||
// tied up parsing bogus XML messages.
|
||||
// phpCAS::handleLogoutRequests(true, $cas_real_hosts);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for diabling SSL CN valdiation
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_simple.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
// phpCAS::setNoCasServerValidation();
|
||||
// You can also disable the validation of the certficate CN. This means the
|
||||
// certificate must be valid but the CN of the certificate must not match the
|
||||
// IP or hostname you are using to access the server
|
||||
phpCAS::setCasServerCACert($cas_server_ca_cert_path, false);
|
||||
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// logout if desired
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
74
include/phpCAS/docs/examples/example_pgt_storage_db.php
Normal file
74
include/phpCAS/docs/examples/example_pgt_storage_db.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example that changes the storage of the pgt tickets
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_pgt_storage_db.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// set PGT storage to file in plain format in the same directory as session files
|
||||
phpCAS::setPGTStorageDB($db, $db_user, $db_password, $db_table);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy example with PGT storage to a database</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxy example with PGT storage to file</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
// call a service and change the color depending on the result
|
||||
if (phpCAS::serviceWeb($serviceUrl, $err_code, $output)) {
|
||||
echo '<div class="success">';
|
||||
} else {
|
||||
echo '<div class="error">';
|
||||
}
|
||||
echo $output;
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
74
include/phpCAS/docs/examples/example_pgt_storage_file.php
Normal file
74
include/phpCAS/docs/examples/example_pgt_storage_file.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example that changes the storage of the pgt tickets to file
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_pgt_storage_db.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// set PGT storage to file in plain format in the same directory as session files
|
||||
phpCAS::setPGTStorageFile(session_save_path());
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy example with PGT storage to file</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxy example with PGT storage to file</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
// call a service and change the color depending on the result
|
||||
if ( phpCAS::serviceWeb($serviceUrl, $err_code, $output) ) {
|
||||
echo '<div class="success">';
|
||||
} else {
|
||||
echo '<div class="error">';
|
||||
}
|
||||
echo $output;
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
98
include/phpCAS/docs/examples/example_proxy_GET.php
Normal file
98
include/phpCAS/docs/examples/example_proxy_GET.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxy that makes a GET request.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_proxy_GET.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy example #2</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxied proxy example</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
|
||||
// call a service and change the color depending on the result
|
||||
try {
|
||||
$service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET);
|
||||
$service->setUrl($serviceUrl);
|
||||
$service->send();
|
||||
if ($service->getResponseStatusCode() == 200) {
|
||||
echo '<div class="success">';
|
||||
echo $service->getResponseBody();
|
||||
echo '</div>';
|
||||
} else {
|
||||
// The service responded with an error code 404, 500, etc.
|
||||
echo '<div class="error">';
|
||||
echo 'The service responded with a '
|
||||
. $service->getResponseStatusCode() . ' error.';
|
||||
echo '</div>';
|
||||
}
|
||||
} catch (CAS_ProxyTicketException $e) {
|
||||
if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE) {
|
||||
echo '<div class="error">';
|
||||
echo "Your login has timed out. You need to log in again.";
|
||||
echo '</div>';
|
||||
} else {
|
||||
// Other proxy ticket errors are from bad request format (shouldn't happen)
|
||||
// or CAS server failure (unlikely) so lets just stop if we hit those.
|
||||
throw $e;
|
||||
}
|
||||
} catch (CAS_ProxiedService_Exception $e) {
|
||||
// Something prevented the service request from being sent or received.
|
||||
// We didn't even get a valid error response (404, 500, etc), so this
|
||||
// might be caused by a network error or a DNS resolution failure.
|
||||
// We could handle it in some way, but for now we will just stop.
|
||||
throw $e;
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
103
include/phpCAS/docs/examples/example_proxy_POST.php
Normal file
103
include/phpCAS/docs/examples/example_proxy_POST.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxy that makes a POST request.
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_proxy_POST.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
$serviceUrl = $curbase . $curdir . 'example_service_POST.php';
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy POST example</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxy POST example</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
|
||||
// call a service and change the color depending on the result
|
||||
try {
|
||||
$service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST);
|
||||
$service->setUrl($serviceUrl);
|
||||
$service->setContentType('application/x-www-form-urlencoded');
|
||||
$service->setBody('favorite_color=blue');
|
||||
$service->send();
|
||||
if ($service->getResponseStatusCode() == 200) {
|
||||
echo '<div class="success">';
|
||||
echo $service->getResponseBody();
|
||||
echo '</div>';
|
||||
} else {
|
||||
// The service responded with an error code 404, 500, etc.
|
||||
echo '<div class="error">';
|
||||
echo 'The service responded with a '
|
||||
. $service->getResponseStatusCode() . ' error.';
|
||||
echo $service->getResponseBody();
|
||||
echo '</div>';
|
||||
}
|
||||
} catch (CAS_ProxyTicketException $e) {
|
||||
if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE) {
|
||||
echo '<div class="error">';
|
||||
echo "Your login has timed out. You need to log in again.";
|
||||
echo '</div>';
|
||||
} else {
|
||||
// Other proxy ticket errors are from bad request format (shouldn't happen)
|
||||
// or CAS server failure (unlikely) so lets just stop if we hit those.
|
||||
throw $e;
|
||||
}
|
||||
} catch (CAS_ProxiedService_Exception $e) {
|
||||
// Something prevented the service request from being sent or received.
|
||||
// We didn't even get a valid error response (404, 500, etc), so this
|
||||
// might be caused by a network error or a DNS resolution failure.
|
||||
// We could handle it in some way, but for now we will just stop.
|
||||
throw $e;
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
63
include/phpCAS/docs/examples/example_proxy_rebroadcast.php
Normal file
63
include/phpCAS/docs/examples/example_proxy_rebroadcast.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxy that rebroadcasts all PGTs to different servers in the
|
||||
* cluster
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_proxy_rebroadcast.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// Set the nodes for rebroadcasting pgtIou/pgtId and logoutRequest
|
||||
phpCAS::addRebroadcastNode($rebroadcast_node_1);
|
||||
phpCAS::addRebroadcastNode($rebroadcast_node_2);
|
||||
|
||||
// handle incoming logout requests
|
||||
phpCAS::handleLogoutRequests();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy rebroadcast example</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxy rebroadcast example</h1>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
</body>
|
||||
</html>
|
||||
71
include/phpCAS/docs/examples/example_proxy_serviceWeb.php
Normal file
71
include/phpCAS/docs/examples/example_proxy_serviceWeb.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxy with session usage
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_proxy_GET.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxied proxy example (with sessioning)</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxied proxy example (with sessioning)</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
// call a service and change the color depending on the result
|
||||
if (phpCAS::serviceWeb($serviceUrl, $err_code, $output)) {
|
||||
echo '<div class="success">';
|
||||
} else {
|
||||
echo '<div class="error">';
|
||||
}
|
||||
echo $output;
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxy with session usage
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_proxy_serviceWeb_chaining.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxy example #2</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>phpCAS proxied proxy example</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl2; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
// call a service and change the color depending on the result
|
||||
if (phpCAS::serviceWeb($serviceUrl2, $err_code, $output)) {
|
||||
echo '<div class="success">';
|
||||
} else {
|
||||
echo '<div class="error">';
|
||||
}
|
||||
echo $output;
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
72
include/phpCAS/docs/examples/example_renew.php
Normal file
72
include/phpCAS/docs/examples/example_renew.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a simple cas 2.0 client
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_renew.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::renewAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// logout if desired
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
|
||||
// logout if desired
|
||||
if (isset($_REQUEST['session'])) {
|
||||
session_unset();
|
||||
session_destroy();
|
||||
unset($_REQUEST['session']);
|
||||
header("Location: ".$_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
<p><a href="?session=">Kill local Session</a></p>
|
||||
</body>
|
||||
</html>
|
||||
96
include/phpCAS/docs/examples/example_service.php
Normal file
96
include/phpCAS/docs/examples/example_service.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for proxied service with session support
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_service.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// If you want your service to be proxied you have to enable it (default
|
||||
// disabled) and define an accepable list of proxies that are allowed to
|
||||
// proxy your service.
|
||||
//
|
||||
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
|
||||
// class, the constructor takes an array of proxies to match. The list is in
|
||||
// reverse just as seen from the service. Proxies have to be defined in reverse
|
||||
// from the service to the user. If a user hits service A and gets proxied via
|
||||
// B to service C the list of acceptable on C would be array(B,A). The definition
|
||||
// of an individual proxy can be either a string or a regexp (preg_match is used)
|
||||
// that will be matched against the proxy list supplied by the cas server
|
||||
// when validating the proxy tickets. The strings are compared starting from
|
||||
// the beginning and must fully match with the proxies in the list.
|
||||
// Example:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// 'https://app.example.com/'
|
||||
// )));
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
|
||||
// 'http://client.example.com/'
|
||||
// )));
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
|
||||
phpCAS::allowProxyChain(
|
||||
new CAS_ProxyChain(
|
||||
array('/^' . $pgtBase . 'example_service_that_proxies.php$/',
|
||||
'/^' . $pgtBase . 'example_proxy_serviceWeb_chaining.php$/'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// For quick testing or in certain production screnarios you might want to
|
||||
// allow allow any other valid service to proxy your service. To do so, add
|
||||
// the "Any" chain:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
|
||||
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
|
||||
// ON THIS SERVICE.
|
||||
//phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
print '<h1>I am a service that can be proxied.</h1>';
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
require 'script_info.php';
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
echo '<p>The user\'s login is <b>' . phpCAS::getUser() . '</b>.</p>';
|
||||
|
||||
// increment the number of requests of the session and print it
|
||||
if (!isset($_SESSION['n'])) {
|
||||
$_SESSION['n'] = 0;
|
||||
}
|
||||
echo '<p>request #' . (++$_SESSION['n']) . '</p>';
|
||||
|
||||
?>
|
||||
104
include/phpCAS/docs/examples/example_service_POST.php
Normal file
104
include/phpCAS/docs/examples/example_service_POST.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for proxied service with session support and POST support
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_service_POST.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// If you want your service to be proxied you have to enable it (default
|
||||
// disabled) and define an accepable list of proxies that are allowed to
|
||||
// proxy your service.
|
||||
//
|
||||
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
|
||||
// class, the constructor takes an array of proxies to match. The list is in
|
||||
// reverse just as seen from the service. Proxies have to be defined in reverse
|
||||
// from the service to the user. If a user hits service A and gets proxied via
|
||||
// B to service C the list of acceptable on C would be array(B,A). The definition
|
||||
// of an individual proxy can be either a string or a regexp (preg_match is used)
|
||||
// that will be matched against the proxy list supplied by the cas server
|
||||
// when validating the proxy tickets. The strings are compared starting from
|
||||
// the beginning and must fully match with the proxies in the list.
|
||||
// Example:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// 'https://app.example.com/'
|
||||
// )));
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
|
||||
// 'http://client.example.com/'
|
||||
// )));
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
|
||||
|
||||
// For quick testing or in certain production screnarios you might want to
|
||||
// allow allow any other valid service to proxy your service. To do so, add
|
||||
// the "Any" chain:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
|
||||
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
|
||||
// ON THIS SERVICE.
|
||||
//phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
print
|
||||
"<h1>I only respond to POST requests. This is a "
|
||||
. $_SERVER['REQUEST_METHOD'] . " request.</h1>";
|
||||
exit;
|
||||
}
|
||||
if (empty($_POST['favorite_color'])) {
|
||||
header('HTTP/1.1 400 Bad Request');
|
||||
print '<h1>You must post a <strong>favorite_color</strong>.</h1>';
|
||||
exit;
|
||||
}
|
||||
|
||||
print '<h1>I am a service that responds to POST requests.</h1>';
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
require 'script_info.php';
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
echo '<p>The user\'s login is <b>' . phpCAS::getUser() . '</b>.</p>';
|
||||
|
||||
print
|
||||
'<h1>Your favorite color is ' . htmlentities($_POST['favorite_color'])
|
||||
. '</h1>';
|
||||
|
||||
// increment the number of requests of the session and print it
|
||||
if (!isset($_SESSION['n'])) {
|
||||
$_SESSION['n'] = 0;
|
||||
}
|
||||
echo '<p>request #' . (++$_SESSION['n']) . '</p>';
|
||||
105
include/phpCAS/docs/examples/example_service_that_proxies.php
Normal file
105
include/phpCAS/docs/examples/example_service_that_proxies.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a proxied proxy
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_service_that_proxies.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// If you want your service to be proxied you have to enable it (default
|
||||
// disabled) and define an accepable list of proxies that are allowed to
|
||||
// proxy your service.
|
||||
//
|
||||
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
|
||||
// class, the constructor takes an array of proxies to match. The list is in
|
||||
// reverse just as seen from the service. Proxies have to be defined in reverse
|
||||
// from the service to the user. If a user hits service A and gets proxied via
|
||||
// B to service C the list of acceptable on C would be array(B,A). The definition
|
||||
// of an individual proxy can be either a string or a regexp (preg_match is used)
|
||||
// that will be matched against the proxy list supplied by the cas server
|
||||
// when validating the proxy tickets. The strings are compared starting from
|
||||
// the beginning and must fully match with the proxies in the list.
|
||||
// Example:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// 'https://app.example.com/'
|
||||
// )));
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
|
||||
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
|
||||
// 'http://client.example.com/'
|
||||
// )));
|
||||
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
|
||||
|
||||
// For quick testing or in certain production screnarios you might want to
|
||||
// allow allow any other valid service to proxy your service. To do so, add
|
||||
// the "Any" chain:
|
||||
// phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
|
||||
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
|
||||
// ON THIS SERVICE.
|
||||
//phpCAS::allowProxyChain(new CAS_ProxyChain_Any);
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// moreover, a PGT was retrieved from the CAS server that will
|
||||
// permit to gain accesses to new services.
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS proxied proxy service example</title>
|
||||
<link rel="stylesheet" type='text/css' href='example.css'/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>I am a service that can be proxied. In turn, I proxy another service.</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<h2>Response from service <?php echo $serviceUrl; ?></h2>
|
||||
<?php
|
||||
flush();
|
||||
// call a service and change the color depending on the result
|
||||
if ( phpCAS::serviceWeb($serviceUrl, $err_code, $output) ) {
|
||||
echo '<div class="success">';
|
||||
} else {
|
||||
echo '<div class="error">';
|
||||
}
|
||||
echo $output;
|
||||
echo '</div>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
63
include/phpCAS/docs/examples/example_simple.php
Normal file
63
include/phpCAS/docs/examples/example_simple.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Example for a simple cas 2.0 client
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file example_simple.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/
|
||||
|
||||
// Load the settings from the central config file
|
||||
require_once 'config.php';
|
||||
// Load the CAS lib
|
||||
require_once $phpcas_path . '/CAS.php';
|
||||
|
||||
// Enable debugging
|
||||
phpCAS::setLogger();
|
||||
// Enable verbose error messages. Disable in production!
|
||||
phpCAS::setVerbose(true);
|
||||
|
||||
// Initialize phpCAS
|
||||
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context, $client_service_name);
|
||||
|
||||
// For production use set the CA certificate that is the issuer of the cert
|
||||
// on the CAS server and uncomment the line below
|
||||
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
|
||||
|
||||
// For quick testing you can disable SSL validation of the CAS server.
|
||||
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
|
||||
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
|
||||
phpCAS::setNoCasServerValidation();
|
||||
|
||||
// force CAS authentication
|
||||
phpCAS::forceAuthentication();
|
||||
|
||||
// at this step, the user has been authenticated by the CAS server
|
||||
// and the user's login name can be read with phpCAS::getUser().
|
||||
|
||||
// logout if desired
|
||||
if (isset($_REQUEST['logout'])) {
|
||||
phpCAS::logout();
|
||||
}
|
||||
|
||||
// for this test, simply print that the authentication was successfull
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>phpCAS simple client</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Successfull Authentication!</h1>
|
||||
<?php require 'script_info.php' ?>
|
||||
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
|
||||
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
|
||||
<p><a href="?logout=">Logout</a></p>
|
||||
</body>
|
||||
</html>
|
||||
20
include/phpCAS/docs/examples/script_info.php
Normal file
20
include/phpCAS/docs/examples/script_info.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Small script to add some info about the example script that is running.
|
||||
* Adds some info that makes it easier to distinguish different proxy sessions
|
||||
*
|
||||
* PHP Version 7
|
||||
*
|
||||
* @file script_info.php
|
||||
* @category Authentication
|
||||
* @package PhpCAS
|
||||
* @author Joachim Fritschi <jfritschi@freenet.de>
|
||||
* @author Adam Franco <afranco@middlebury.edu>
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
||||
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
||||
*/ ?>
|
||||
<dl style='border: 1px dotted; padding: 5px;'>
|
||||
<dt>Current script</dt><dd><?php print basename($_SERVER['SCRIPT_NAME']); ?></dd>
|
||||
<dt>session_name():</dt><dd> <?php print session_name(); ?></dd>
|
||||
<dt>session_id():</dt><dd> <?php print session_id(); ?></dd>
|
||||
</dl>
|
||||
BIN
include/phpCAS/docs/images/esup-portail.png
Normal file
BIN
include/phpCAS/docs/images/esup-portail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
include/phpCAS/docs/images/jasig.png
Normal file
BIN
include/phpCAS/docs/images/jasig.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
include/phpCAS/docs/images/phpcas.png
Normal file
BIN
include/phpCAS/docs/images/phpcas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
19
include/phpCAS/docs/index.html
Normal file
19
include/phpCAS/docs/index.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>phpCAS</title>
|
||||
</head>
|
||||
<body>
|
||||
<p><img src="images/phpcas.png" width="191" height="68"/></p>
|
||||
<p>phpCAS documentation is hosted at <a href="https://apereo.atlassian.net/wiki/spaces/CASC/pages/103252517/phpCAS">https://apereo.atlassian.net/wiki/spaces/CASC/pages/103252517/phpCAS</a>.</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/apereo/phpCAS/tree/master/docs/examples">examples</a></li>
|
||||
<li><a href="api">source documentation</a></li>
|
||||
</ul>
|
||||
<p><img src="images/esup-portail.png" width="182" height="68"/> <img src="images/jasig.png" width="169" height="87"/></p>
|
||||
<p> </p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user