Download the PHP package maxmotionr/cas-bundle without Composer
On this page you can find all versions of the php package maxmotionr/cas-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maxmotionr/cas-bundle
More information about maxmotionr/cas-bundle
Files in maxmotionr/cas-bundle
Package cas-bundle
Short Description PHPCas wrapper for Symfony2, Symfony3, Symfony4
License LGPL-3.0-or-later
Homepage https://github.com/l3-team/CasBundle
Informations about the package cas-bundle
Symfony 2/3/4 Cas Bundle
This bundle is a dependancy based wrapper for the classic jasig/phpCAS library.
Supports Single Sign Out (no support in BeSimpleSSoBundle).
Installation
Install the Bundle by adding this line to your composer.json :
Then
Declaration of the Bundle in the Kernel of Symfony
For Symfony2 or Symfony3, add the Bundle in app/AppKernel.php
For Symfony4, add the Bundle in config/bundles.php (if line not present)
Bundle Configuration
For Symfony2 or Symfony3, add the l3_cas parameters in your config file (parameters.yml and parameters.yml.dist) :
For Symfony4, add the variables in your config file (.env.local and .env) :
And add the l3_cas parameters in your config/services.yml file (under parameters) :
Security Configuration
For Symfony2 or Symfony3 or Symfony4, configure the firewall in the security file app/config/security.yml
Anonymous Configuration
Be careful that if you want use the anonymous mode, the bundle cas use the login __NO_USER__, use the security like this :
In Symfony4, if you use chain_provider, you should set provider name on all entry (ie l3_firewall and main) firewall (where security is active : security: true) in config/packages/security.yaml like this :
Next set force to false in app/config/parameters.yml (for Symfony2 or Symfony3) and in config/services.yaml (for Symfony4) :
And for Symfony2 or Symfony3 set default: anonymous in app/config/security.yml
For Symfony4 set main: anonymous in config/packages/security.yaml
For Symfony2 or Symfony3, add parameters cas_host and cas_login_target and cas_path and cas_gateway in your files app/config/parameters.yml.dist and app/config/parameters.yml under parameters (NOT under l3_cas)
For Symfony4, add parameters cas_host and cas_login_target in your config/services.yaml under parameters (NOT under l3_cas)
Create a login route and force route in your DefaultController in your application:
Finally you can use the route /login in order to call the cas login page and redirect to your application, then you become connected :)
Configuration of the Single Sign Out
In order to use the Single Sign Out, it is recommanded to disable Symfony Sessions in Symfony (so you will use the PHP native sessions).
Information : The bundle checks with PHPCas to detect some disconnections requests not fully implemented by PHPCAS (see L3\Bundle\CasBundle\Security\CasListener::checkHandleLogout() for more details)
UserProvider
For LDAP users, you can use the LdapUserBundle (branch ou=people) or LdapUdlUserBundle (branch ou=accounts). You can use the simple UidUserBundle which only returns the uid.
You can also use FOSUserBundle... like this : //security.yml
Logout route
In Symfony 2 or Symfony 3, if you want use /logout route in order to call Logout, you can add this in your routing.yml :
In Symfony 4, you can add this in your routes.yaml :
Additional Attributes
The Jasig Cas Server can return additional attributes in addition to the main attribute (generally uid) with the function phpCAS::getAttributes().
You can get the additional attributes in a controller with this code :
All versions of cas-bundle with dependencies
jasig/phpcas Version ~1.3
symfony/security-bundle Version ~4.0
symfony/framework-bundle Version ~4.0