From c262c101d6adb1dfb8d1172b63946544a9713700 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 14 Jan 2020 14:21:53 +0100 Subject: [PATCH] Migrate project to new organisation. --- .github/CODEOWNERS | 1 - .github/FUNDING.yml | 1 - .github/settings.yml | 28 ++---- .github/workflows/continuous-integration.yml | 89 ++++++++++--------- LICENSE | 29 ++++++ README.md | 27 +++--- .../config/packages/eulogin_cas_services.yaml | 4 +- composer.json | 19 ++-- docs/pages/installation.rst | 12 +-- docs/pages/tests.rst | 4 +- .../Security/Core/User/EuLoginUserSpec.php} | 8 +- src/{EuloginBundle.php => EuLoginBundle.php} | 6 +- .../User/{EuloginUser.php => EuLoginUser.php} | 12 +-- ...Interface.php => EuLoginUserInterface.php} | 8 +- ...erProvider.php => EuLoginUserProvider.php} | 18 ++-- .../User/EuLoginUserProviderInterface.php | 22 +++++ .../User/EuloginUserProviderInterface.php | 22 ----- 17 files changed, 162 insertions(+), 148 deletions(-) delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/FUNDING.yml create mode 100644 LICENSE rename spec/{drupol/EuloginBundle/Security/Core/User/EuloginUserSpec.php => EcPhp/EuLoginBundle/Security/Core/User/EuLoginUserSpec.php} (95%) rename src/{EuloginBundle.php => EuLoginBundle.php} (51%) rename src/Security/Core/User/{EuloginUser.php => EuLoginUser.php} (95%) rename src/Security/Core/User/{EuloginUserInterface.php => EuLoginUserInterface.php} (90%) rename src/Security/Core/User/{EuloginUserProvider.php => EuLoginUserProvider.php} (67%) create mode 100644 src/Security/Core/User/EuLoginUserProviderInterface.php delete mode 100644 src/Security/Core/User/EuloginUserProviderInterface.php diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 529c034..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @drupol diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index b4c89d9..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: drupol diff --git a/.github/settings.yml b/.github/settings.yml index b630415..299ea1f 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,19 +1,5 @@ # https://github.com/probot/settings -branches: - - name: master - protection: - enforce_admins: false - required_pull_request_reviews: - dismiss_stale_reviews: true - require_code_owner_reviews: true - required_approving_review_count: 1 - required_status_checks: - contexts: - - "Grumphp" - strict: false - restrictions: null - labels: - name: bug color: ee0701 @@ -36,15 +22,19 @@ labels: repository: allow_merge_commit: true allow_rebase_merge: false - allow_squash_merge: false + allow_squash_merge: true default_branch: master - description: "Symfony bundle to authenticate users against EU Login." - homepage: https://eulogin-bundle.readthedocs.io - topics: authentication,cas,psr,single-sign-on + description: "EU Login bundle, a standard Symfony bundle to authenticate users against EU Login." + homepage: https://ecphp-eu-login-bundle.readthedocs.io + topics: authentication,cas,ecas,eulogin,single-sign-on has_downloads: true has_issues: true has_pages: false has_projects: false has_wiki: false - name: eulogin-bundle + name: eu-login-bundle private: false + +teams: + - name: core + permission: push \ No newline at end of file diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a4fdee3..e224937 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,51 +1,52 @@ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions on: - - pull_request - - push + - pull_request + - push name: "Continuous Integration" jobs: - run: - name: "Grumphp" - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - operating-system: [ubuntu-latest, windows-latest, macOS-latest] - php-versions: ['7.1', '7.2', '7.3', '7.4'] - - steps: - - name: Checkout - uses: actions/checkout@master - with: - fetch-depth: 1 - - - name: Install PHP - uses: shivammathur/setup-php@master - with: - php-version: ${{ matrix.php-versions }} - extensions: xdebug - - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - - - name: Run Grumphp - run: vendor/bin/grumphp run - env: - STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} - - - name: Scrutinizer - run: vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + run: + name: "Grumphp" + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macOS-latest] + php-versions: ['7.2', '7.3', '7.4'] + + steps: + - name: Checkout + uses: actions/checkout@master + with: + fetch-depth: 1 + + - name: Install PHP + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extensions: xdebug,mbstring + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + + - name: Run Grumphp + run: vendor/bin/grumphp run + env: + STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} + + - name: Scrutinizer + run: vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + continue-on-error: true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb9ba02 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2020, ECPHP +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 00173aa..d3432d8 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ -[![Latest Stable Version](https://img.shields.io/packagist/v/drupol/eulogin-bundle.svg?style=flat-square)](https://packagist.org/packages/drupol/eulogin-bundle) - [![GitHub stars](https://img.shields.io/github/stars/drupol/eulogin-bundle.svg?style=flat-square)](https://packagist.org/packages/drupol/eulogin-bundle) - [![Total Downloads](https://img.shields.io/packagist/dt/drupol/eulogin-bundle.svg?style=flat-square)](https://packagist.org/packages/drupol/eulogin-bundle) - [![Build Status](https://img.shields.io/travis/drupol/eulogin-bundle/master.svg?style=flat-square)](https://travis-ci.org/drupol/eulogin-bundle) - [![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/drupol/eulogin-bundle/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/eulogin-bundle/?branch=master) - [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/drupol/eulogin-bundle/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/eulogin-bundle/?branch=master) - [![Mutation testing badge](https://badge.stryker-mutator.io/github.com/drupol/eulogin-bundle/master)](https://stryker-mutator.github.io) - [![Read the Docs](https://img.shields.io/readthedocs/eulogin-bundle?style=flat-square)](https://eulogin-bundle.readthedocs.io/) - [![License](https://img.shields.io/packagist/l/drupol/eulogin-bundle.svg?style=flat-square)](https://packagist.org/packages/drupol/eulogin-bundle) - [![Say Thanks!](https://img.shields.io/badge/Say-thanks-brightgreen.svg?style=flat-square)](https://saythanks.io/to/drupol) - [![Donate!](https://img.shields.io/badge/Donate-Paypal-brightgreen.svg?style=flat-square)](https://paypal.me/drupol) - -# EU login bundle +[![Latest Stable Version](https://img.shields.io/packagist/v/ecphp/eu-login-bundle.svg?style=flat-square)](https://packagist.org/packages/ecphp/eu-login-bundle) + [![GitHub stars](https://img.shields.io/github/stars/ecphp/eu-login-bundle.svg?style=flat-square)](https://packagist.org/packages/ecphp/eu-login-bundle) + [![Total Downloads](https://img.shields.io/packagist/dt/ecphp/eu-login-bundle.svg?style=flat-square)](https://packagist.org/packages/ecphp/eu-login-bundle) + [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ecphp/eu-login-bundle/Continuous%20Integration/master?style=flat-square)](https://github.com/ecphp/eu-login-bundle/actions) + [![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/ecphp/eu-login-bundle/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/ecphp/eu-login-bundle/?branch=master) + [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/ecphp/eu-login-bundle/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/ecphp/eu-login-bundle/?branch=master) + [![Read the Docs](https://img.shields.io/readthedocs/ecphp-eu-login-bundle?style=flat-square)](https://ecphp-eu-login-bundle.readthedocs.io/) + [![License](https://img.shields.io/packagist/l/ecphp/eu-login-bundle.svg?style=flat-square)](https://packagist.org/packages/ecphp/eu-login-bundle) -A EU login bundle for Symfony 4 & 5. +# EU Login bundle -Read more on the dedicated documentation site: https://eulogin-bundle.readthedocs.io/ \ No newline at end of file +EU Login bundle for Symfony 4 & 5. + +Read more on the dedicated documentation site: https://ecphp-eu-login-bundle.readthedocs.io/ \ No newline at end of file diff --git a/Resources/config/packages/eulogin_cas_services.yaml b/Resources/config/packages/eulogin_cas_services.yaml index 37fae9d..9932a88 100644 --- a/Resources/config/packages/eulogin_cas_services.yaml +++ b/Resources/config/packages/eulogin_cas_services.yaml @@ -1,8 +1,8 @@ services: eulogin.userprovider: - class: drupol\EuloginBundle\Security\Core\User\EuloginUserProvider + class: EcPhp\EuLoginBundle\Security\Core\User\EuLoginUserProvider cas: - class: drupol\ecas\Ecas + class: EcPhp\Ecas\Ecas arguments: $serverRequest: '@cas.psrrequest' $properties: '@cas.configuration' diff --git a/composer.json b/composer.json index 64540fc..e6cd75a 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "drupol/eulogin-bundle", + "name": "ecphp/eu-login-bundle", "type": "symfony-bundle", "description": "A bundle for Symfony 4 & 5, providing authentication against European Commission authentication service.", "keywords": [ @@ -11,30 +11,29 @@ "single sign-on", "sso" ], - "license": "MIT", + "license": "BSD-3-Clause", "require": { "php": ">= 7.2.5", "ext-json": "*", "ext-simplexml": "*", - "drupol/cas-bundle": "dev-master || 4.4.x-dev", - "drupol/ecas": "dev-master", + "ecphp/cas-bundle": "dev-master || 4.4.x-dev", + "ecphp/ecas": "dev-master", "symfony/framework-bundle": "^5" }, "require-dev": { - "drupol/php-conventions": "^1.6.11", + "drupol/php-conventions": "^1.6.12", "friends-of-phpspec/phpspec-code-coverage": "^4.3.2", - "infection/infection": "^0.13.6", - "nyholm/psr7-server": "^0.4.1", - "phpspec/phpspec": "^5.1.2" + "infection/infection": "^0.15.0", + "phpspec/phpspec": "^6.1.1" }, "autoload": { "psr-4": { - "drupol\\EuloginBundle\\": "src/" + "EcPhp\\EuLoginBundle\\": "src/" } }, "autoload-dev": { "psr-4": { - "spec\\drupol\\EuloginBundle\\": "./spec/drupol/EuloginBundle/" + "spec\\EcPhp\\EuLoginBundle\\": "spec/EcPhp/EuLoginBundle/" } }, "minimum-stability": "dev", diff --git a/docs/pages/installation.rst b/docs/pages/installation.rst index 8730b61..e09a448 100644 --- a/docs/pages/installation.rst +++ b/docs/pages/installation.rst @@ -15,7 +15,7 @@ The easiest way to install it is through Composer_ .. code-block:: bash - composer require drupol/eulogin-bundle + composer require ecphp/eu-login-bundle Step 2 ~~~~~~ @@ -26,23 +26,23 @@ You should see a line that looks like the following: .. code-block:: php - drupol\\EuloginBundle\\EuloginBundle::class => ['all' => true], + EcPhp\\EuLoginBundle\\EuLoginBundle::class => ['all' => true], Step 3 ~~~~~~ -As this package depends on the package `drupol/cas-bundle`, you will need to copy +As this package depends on the package `ecphp/cas-bundle`, you will need to copy some configuration files from that package first. .. code-block:: bash - cp -ar vendor/drupol/cas-bundle/Resources/config/* config/ + cp -ar vendor/ecphp/cas-bundle/Resources/config/* config/ -Then, copy the configuration files from the bundle `drupol/eulogin-bundle` in your application +Then, copy the configuration files from the bundle `ecphp/eu-login-bundle` in your application .. code-block:: bash - cp -ar vendor/drupol/eulogin-bundle/Resources/config/* config/ + cp -ar vendor/ecphp/eu-login-bundle/Resources/config/* config/ .. warning:: It is important to play those commands in the proper order. diff --git a/docs/pages/tests.rst b/docs/pages/tests.rst index eee84d5..76f7295 100644 --- a/docs/pages/tests.rst +++ b/docs/pages/tests.rst @@ -47,8 +47,8 @@ will check your code .. _PSR-12: https://www.php-fig.org/psr/psr-12/ .. _drupol/php-conventions: https://github.com/drupol/php-conventions -.. _Travis CI: https://travis-ci.org/drupol/cas-bundle/builds -.. _Github Actions: https://github.com/drupol/cas-bundle/actions +.. _Travis CI: https://travis-ci.org/ecphp/cas-bundle/builds +.. _Github Actions: https://github.com/ecphp/cas-bundle/actions .. _PHPSpec: http://www.phpspec.net/ .. _PHPInfection: https://github.com/infection/infection .. _Grumphp: https://github.com/phpro/grumphp \ No newline at end of file diff --git a/spec/drupol/EuloginBundle/Security/Core/User/EuloginUserSpec.php b/spec/EcPhp/EuLoginBundle/Security/Core/User/EuLoginUserSpec.php similarity index 95% rename from spec/drupol/EuloginBundle/Security/Core/User/EuloginUserSpec.php rename to spec/EcPhp/EuLoginBundle/Security/Core/User/EuLoginUserSpec.php index 2288dab..07ed888 100644 --- a/spec/drupol/EuloginBundle/Security/Core/User/EuloginUserSpec.php +++ b/spec/EcPhp/EuLoginBundle/Security/Core/User/EuLoginUserSpec.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace spec\drupol\EuloginBundle\Security\Core\User; +namespace spec\EcPhp\EuLoginBundle\Security\Core\User; -use drupol\EuloginBundle\Security\Core\User\EuloginUser; +use EcPhp\EuLoginBundle\Security\Core\User\EuLoginUser; use PhpSpec\ObjectBehavior; -class EuloginUserSpec extends ObjectBehavior +class EuLoginUserSpec extends ObjectBehavior { public function it_can_get_specific_attribute() { @@ -131,7 +131,7 @@ public function it_can_get_the_attributes_only() public function it_is_initializable() { - $this->shouldHaveType(EuloginUser::class); + $this->shouldHaveType(EuLoginUser::class); } public function let() diff --git a/src/EuloginBundle.php b/src/EuLoginBundle.php similarity index 51% rename from src/EuloginBundle.php rename to src/EuLoginBundle.php index 3a8dfc4..e260798 100644 --- a/src/EuloginBundle.php +++ b/src/EuLoginBundle.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace drupol\EuloginBundle; +namespace EcPhp\EuLoginBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; /** - * Class EuloginBundle. + * Class EuLoginBundle. */ -class EuloginBundle extends Bundle +class EuLoginBundle extends Bundle { } diff --git a/src/Security/Core/User/EuloginUser.php b/src/Security/Core/User/EuLoginUser.php similarity index 95% rename from src/Security/Core/User/EuloginUser.php rename to src/Security/Core/User/EuLoginUser.php index 87617fc..6354407 100644 --- a/src/Security/Core/User/EuloginUser.php +++ b/src/Security/Core/User/EuLoginUser.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace drupol\EuloginBundle\Security\Core\User; +namespace EcPhp\EuLoginBundle\Security\Core\User; -use drupol\CasBundle\Security\Core\User\CasUser; +use EcPhp\CasBundle\Security\Core\User\CasUser; /** - * Class EuloginUser. + * Class EuLoginUser. */ -final class EuloginUser implements EuloginUserInterface +final class EuLoginUser implements EuLoginUserInterface { /** - * @var \drupol\CasBundle\Security\Core\User\CasUser + * @var \EcPhp\CasBundle\Security\Core\User\CasUser */ private $user; /** - * EuloginUser constructor. + * EuLoginUser constructor. * * @param array $data */ diff --git a/src/Security/Core/User/EuloginUserInterface.php b/src/Security/Core/User/EuLoginUserInterface.php similarity index 90% rename from src/Security/Core/User/EuloginUserInterface.php rename to src/Security/Core/User/EuLoginUserInterface.php index 942bf2f..5274b93 100644 --- a/src/Security/Core/User/EuloginUserInterface.php +++ b/src/Security/Core/User/EuLoginUserInterface.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace drupol\EuloginBundle\Security\Core\User; +namespace EcPhp\EuLoginBundle\Security\Core\User; -use drupol\CasBundle\Security\Core\User\CasUserInterface; +use EcPhp\CasBundle\Security\Core\User\CasUserInterface; /** - * Interface EuloginUserInterface. + * Interface EuLoginUserInterface. */ -interface EuloginUserInterface extends CasUserInterface +interface EuLoginUserInterface extends CasUserInterface { /** * @return string|null diff --git a/src/Security/Core/User/EuloginUserProvider.php b/src/Security/Core/User/EuLoginUserProvider.php similarity index 67% rename from src/Security/Core/User/EuloginUserProvider.php rename to src/Security/Core/User/EuLoginUserProvider.php index e7a3445..3f2accd 100644 --- a/src/Security/Core/User/EuloginUserProvider.php +++ b/src/Security/Core/User/EuLoginUserProvider.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace drupol\EuloginBundle\Security\Core\User; +namespace EcPhp\EuLoginBundle\Security\Core\User; -use drupol\CasBundle\Security\Core\User\CasUserInterface; -use drupol\psrcas\Introspection\Introspector; +use EcPhp\CasBundle\Security\Core\User\CasUserInterface; +use EcPhp\CasLib\Introspection\Introspector; use Psr\Http\Message\ResponseInterface; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\User\UserInterface; @@ -13,19 +13,19 @@ use function get_class; /** - * Class EuloginUserProvider. + * Class EuLoginUserProvider. */ -class EuloginUserProvider implements EuloginUserProviderInterface +class EuLoginUserProvider implements EuLoginUserProviderInterface { /** * {@inheritdoc} */ public function loadUserByResponse(ResponseInterface $response): CasUserInterface { - /** @var \drupol\psrcas\Introspection\Contract\ServiceValidate $introspect */ + /** @var \EcPhp\CasLib\Introspection\Contract\ServiceValidate $introspect */ $introspect = Introspector::detect($response); - return new EuloginUser($introspect->getParsedResponse()['serviceResponse']['authenticationSuccess']); + return new EuLoginUser($introspect->getParsedResponse()['serviceResponse']['authenticationSuccess']); } /** @@ -41,7 +41,7 @@ public function loadUserByUsername(string $username) */ public function refreshUser(UserInterface $user) { - if (!$user instanceof EuloginUserInterface) { + if (!$user instanceof EuLoginUserInterface) { throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user))); } @@ -53,6 +53,6 @@ public function refreshUser(UserInterface $user) */ public function supportsClass(string $class) { - return EuloginUser::class === $class; + return EuLoginUser::class === $class; } } diff --git a/src/Security/Core/User/EuLoginUserProviderInterface.php b/src/Security/Core/User/EuLoginUserProviderInterface.php new file mode 100644 index 0000000..c4757e4 --- /dev/null +++ b/src/Security/Core/User/EuLoginUserProviderInterface.php @@ -0,0 +1,22 @@ +