Skip to content

Commit

Permalink
Merge pull request #10 from Alexandre-T/dev
Browse files Browse the repository at this point in the history
Compatibility for Symfony 4.4 and 5.0
  • Loading branch information
Alexandre-T committed May 14, 2020
2 parents 0ef8b8f + 56d9586 commit 8c9cfad
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#lock files
composer.lock
symfony.lock

# PHPUnit
/phpunit.xml

Expand Down
34 changes: 33 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ php:
- "7.1"
- "7.2"
- "7.3"
- "7.4"

# The Symfony version implies that you require the full framework, not single components
# Requiring single components is much harder to do... And probably not flexible enough, even if it's lighter.
Expand All @@ -32,32 +33,63 @@ matrix:
env: SYMFONY_VERSION="3.4.x"
- php: "7.3"
env: SYMFONY_VERSION="3.4.x"
- php: "7.4"
env: SYMFONY_VERSION="3.4.x"
- php: "7.1"
env: SYMFONY_VERSION="4.0.x"
- php: "7.2"
env: SYMFONY_VERSION="4.0.x"
- php: "7.3"
env: SYMFONY_VERSION="4.0.x"
- php: "7.4"
env: SYMFONY_VERSION="4.0.x"
- php: "7.1"
env: SYMFONY_VERSION="4.1.x"
- php: "7.2"
env: SYMFONY_VERSION="4.1.x"
- php: "7.3"
env: SYMFONY_VERSION="4.1.x"
- php: "7.4"
env: SYMFONY_VERSION="4.1.x"
- php: "7.1"
env: SYMFONY_VERSION="4.2.x"
- php: "7.2"
env: SYMFONY_VERSION="4.2.x"
- php: "7.3"
env: SYMFONY_VERSION="4.2.x"
- php: "7.4"
env: SYMFONY_VERSION="4.2.x"
- php: "7.1"
env: SYMFONY_VERSION="4.3.x"
- php: "7.2"
env: SYMFONY_VERSION="4.3.x"
- php: "7.3"
env: SYMFONY_VERSION="4.3.x"
- php: "7.4"
env: SYMFONY_VERSION="4.3.x"
- php: "7.1"
env: SYMFONY_VERSION="4.4.x"
- php: "7.2"
env: SYMFONY_VERSION="4.4.x"
- php: "7.3"
env: SYMFONY_VERSION="4.4.x"
- php: "7.4"
env: SYMFONY_VERSION="4.4.x"
#Symfony 5.0 cannot be installed with PHP 7.1
- php: "7.2"
env: SYMFONY_VERSION="5.0.x"
- php: "7.3"
env: SYMFONY_VERSION="5.0.x"
- php: "7.4"
env: SYMFONY_VERSION="5.0.x"
allow_failures:
- php: "7.1"
# Jan 2019: End of support for security fixes for Sf4.0
- env: SYMFONY_VERSION="4.0.x"
- env: SYMFONY_VERSION="4.3.x"
# Jul 2019: End of support for security fixes for Sf4.1
- env: SYMFONY_VERSION="4.1.x"
# Jan 2020: End of support for security fixes for Sf4.2
- env: SYMFONY_VERSION="4.2.x"

# Update composer, and update Symfony version depending on the matrix
before_install:
Expand Down
11 changes: 9 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\HttpKernel\Kernel;

/**
* This is the class that validates and merges configuration from your app/config files.
Expand Down Expand Up @@ -88,8 +89,14 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('cas_guard');
$rootNode = $treeBuilder->root('cas_guard');
if (1 === version_compare('4.2.0', Kernel::VERSION)) {
//Version 3.4
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cas_guard');
} else {
$treeBuilder = new TreeBuilder('cas_guard');
$rootNode = $treeBuilder->getRootNode();
}
$rootNode
->children()
->scalarNode('certificate')
Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ to authenticate your users.
[![Coverage Status](https://coveralls.io/repos/github/Alexandre-T/casguard/badge.svg)](https://coveralls.io/github/Alexandre-T/casguard?branch=master)
[![Build Status](https://travis-ci.org/Alexandre-T/casguard.svg)](https://travis-ci.org/Alexandre-T/casguard)

Travis is helping me to confirm that this bundle can be used with PHP 7.1, 7.2 and 7.3.

For Symfony 3.4+, 4.1, 4.2 and 4.3 PHP 7.1, 7.2 and 7.3, you can use [this 1.* version](https://github.com/Alexandre-T/casguard)

For PHP5.6, PHP 7.0 and Symfony 2.8 and 3.4, your can use [0.2.* version](https://github.com/Alexandre-T/casguard/releases/tag/0.2.1)

Installation
============

Expand All @@ -35,7 +29,7 @@ of the Composer documentation.
Step 2: Enable the Bundle
-------------------------

For **Symfony 3.4+**, enable the bundle by adding it to the list of registered bundles
Enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:

```php
Expand All @@ -50,7 +44,7 @@ return [
Step 3: Enable the Security
----------------------------

For **Symfony 3.4+**, update your `config\packages\security.yaml` file:
Update your `config\packages\security.yaml` file:

```yaml
#http://symfony.com/doc/current/reference/configuration/security.html#full-default-configuration
Expand All @@ -76,15 +70,15 @@ security:

Since Symfony 2.8, Guard is providing a new and excellent way to authenticate. I recommend you to have a look
on [this excellent tutorial](https://knpuniversity.com/screencast/symfony-security) to understand guard features.
This tutorial explain how to generate a standard authentication using **guard** and a **login form**. When you
understand it, you only have to disabled the call to the login form authenticator implemented in
This tutorial explains how to generate a standard authentication using **guard** and a **login form**. When you
understand it, you only have to disable the call to the login form authenticator implemented in
[the chapter 5](https://knpuniversity.com/screencast/symfony-security/login-form-authenticator) and replace it by
the `phpcasguard.cas_authenticator` declared inside this bundle.

Step 4: Configure the Bundle
----------------------------

For **Symfony 3.4+**, create a `config\packages\cas_guard.yaml` file:
Create a `config\packages\cas_guard.yaml` file:

```yaml
cas_guard:
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"require": {
"php": "^7.1.3",
"jasig/phpcas": "~1.3",
"symfony/security-guard": "~3.4|~4.0|~4.1|~4.2",
"symfony/config": "~3.4|~4.0|~4.1|~4.2",
"symfony/dependency-injection": "~3.4|~4.0|~4.1|~4.2",
"symfony/routing": "~3.4|~4.0|~4.1|~4.2",
"symfony/yaml": "~3.4|~4.0|~4.1|~4.2"
"symfony/security-guard": "~3.4|4.*|~5.0",
"symfony/config": "~3.4|4.*|~5.0",
"symfony/dependency-injection": "~3.4|4.*|~5.0",
"symfony/routing": "~3.4|4.*|~5.0",
"symfony/yaml": "~3.4|4.*|~5.0"
},
"autoload": {
"psr-4": { "AlexandreT\\Bundle\\CasGuardBundle\\": "" }
Expand All @@ -32,7 +32,7 @@
"require-dev": {
"codeception/aspect-mock": "*",
"phpunit/phpunit": "~7.5",
"symfony/debug": "~3.4|~4.0|~4.1|~4.2",
"symfony/phpunit-bridge": "~3.4|~4.0|~4.1|~4.2"
"symfony/debug": "~3.4|4.*|~5.0",
"symfony/phpunit-bridge": "~3.4|4.*|~5.0"
}
}

0 comments on commit 8c9cfad

Please sign in to comment.