Download the PHP package l3/cas-bundle without Composer
On this page you can find all versions of the php package l3/cas-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download l3/cas-bundle
More information about l3/cas-bundle
Files in l3/cas-bundle
Package cas-bundle
Short Description PHPCas wrapper for Symfony2, Symfony3, Symfony4, Symfony5
License LGPL-3.0-or-later
Homepage https://github.com/l3-team/CasBundle
Informations about the package cas-bundle
Symfony Cas Bundle
This bundle is a dependancy based wrapper for the classic jasig/phpCAS library.
Supports Single Sign Out (no support in BeSimpleSSoBundle).
(For Symfony 6, please refer to the l3/cas-guard-bundle package.)
Installation
Install the Bundle with this command :
Declaration of the Bundle in the Kernel of Symfony
For Symfony2 or Symfony3, add the Bundle in app/AppKernel.php
For Symfony4 and Symfony5, 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 and Symfony5, add the variables in your config file (.env and .env.dist) :
And add the parameters in your config/services.yml file (under parameters) :
Security Configuration
For Symfony2 or Symfony3 or Symfony4 or Symfony5, 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 Symfony 5, replace anonymous: true with lazy: true like this :
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 and Symfony5, add parameters cas_host and cas_login_target in your config/services.yaml under parameters (NOT under l3_cas)
For Symfony 2, Symfony 3 and Symfony 4, create a login route and force route in your DefaultController in your application:
For Symfony 5, 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 :
In Symfony 5, you must create a logout route in your DefaultController in your application:
Logout handler
In somes applications like EasyAdminBundle, you can need use a logout success handler in order to the call /logout by EasyAdmin use this logout success handler.
-
create src/Handler/AuthenticationHandler.php with this code :
-
in config/services.yaml add this line under "services:"
- in config/packages/security.yaml add this lines (for firewalls under cas: true)
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 :
Annotations
The Route annotations run if you install this package :
All versions of cas-bundle with dependencies
apereo/phpcas Version 1.3.8
symfony/security-bundle Version ~5.0
symfony/framework-bundle Version ~5.0