Skip to content

Commit

Permalink
Merge pull request #12 from openeuropa/OPENEUROPA-1159
Browse files Browse the repository at this point in the history
OPENEUROPA-1159: Rename Auth to Authentification
  • Loading branch information
ademarco authored Aug 20, 2018
2 parents fb67a00 + 2f62269 commit 5e5b616
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
workspace:
base: /test
path: oe_auth
path: oe_authentication

services:
web:
image: fpfis/httpd-php-dev:7.1
environment:
- DOCUMENT_ROOT=/test/oe_auth
- DOCUMENT_ROOT=/test/oe_authentication
mysql:
image: percona/percona-server:5.6
environment:
Expand Down
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Change Log

## [0.2.0](https://github.com/openeuropa/oe_auth/tree/0.2.0) (2018-06-25)
[Full Changelog](https://github.com/openeuropa/oe_auth/compare/0.1.0...0.2.0)
## [0.2.0](https://github.com/openeuropa/oe_authentication/tree/0.2.0) (2018-06-25)
[Full Changelog](https://github.com/openeuropa/oe_authentication/compare/0.1.0...0.2.0)

**Merged pull requests:**

- OPENEUROPA-679: Make authentication service endpoint configurable [\#6](https://github.com/openeuropa/oe_auth/pull/6) ([voidtek](https://github.com/voidtek))
- OPENEUROPA-679: Make authentication service endpoint configurable [\#6](https://github.com/openeuropa/oe_authentication/pull/6) ([voidtek](https://github.com/voidtek))

## [0.1.0](https://github.com/openeuropa/oe_auth/tree/0.1.0) (2018-06-19)
## [0.1.0](https://github.com/openeuropa/oe_authentication/tree/0.1.0) (2018-06-19)
**Merged pull requests:**

- Add CHANGELOG.md for 0.1.0 release. [\#5](https://github.com/openeuropa/oe_auth/pull/5) ([ademarco](https://github.com/ademarco))
- OPENEUROPA-657: Update license and make it compliant with packagist.org's recommandations [\#4](https://github.com/openeuropa/oe_auth/pull/4) ([drupol](https://github.com/drupol))
- OPENEUROPA-657: Rename from eu\_login to oe\_auth. [\#3](https://github.com/openeuropa/oe_auth/pull/3) ([drupol](https://github.com/drupol))
- OPENEUROPA-657: Rename the module from eu\_login to oe\_auth. [\#2](https://github.com/openeuropa/oe_auth/pull/2) ([drupol](https://github.com/drupol))
- OPENEUROPA-204: Initial work [\#1](https://github.com/openeuropa/oe_auth/pull/1) ([sandervd](https://github.com/sandervd))
- Add CHANGELOG.md for 0.1.0 release. [\#5](https://github.com/openeuropa/oe_authentication/pull/5) ([ademarco](https://github.com/ademarco))
- OPENEUROPA-657: Update license and make it compliant with packagist.org's recommandations [\#4](https://github.com/openeuropa/oe_authentication/pull/4) ([drupol](https://github.com/drupol))
- OPENEUROPA-657: Rename from eu\_login to oe\_auth. [\#3](https://github.com/openeuropa/oe_authentication/pull/3) ([drupol](https://github.com/drupol))
- OPENEUROPA-657: Rename the module from eu\_login to oe\_auth. [\#2](https://github.com/openeuropa/oe_authentication/pull/2) ([drupol](https://github.com/drupol))
- OPENEUROPA-204: Initial work [\#1](https://github.com/openeuropa/oe_authentication/pull/1) ([sandervd](https://github.com/sandervd))



Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# OpenEuropa Auth
# OpenEuropa Authentication

[![Build Status](https://drone.fpfis.eu/api/badges/openeuropa/oe_auth/status.svg?branch=master)](https://drone.fpfis.eu/openeuropa/oe_auth)
[![Build Status](https://drone.fpfis.eu/api/badges/openeuropa/oe_authentication/status.svg?branch=master)](https://drone.fpfis.eu/openeuropa/oe_authentication)

The OpenEuropa Auth module allows to authenticate against the European Commission login service.
The OpenEuropa Authentication module allows to authenticate against the European Commission login service.

**Table of contents:**

Expand All @@ -15,18 +15,18 @@ The OpenEuropa Auth module allows to authenticate against the European Commissio

## Installation

The recommended way of installing the OpenEuropa Auth module is via a [Composer][2].
The recommended way of installing the OpenEuropa Authentication module is via a [Composer][2].

```bash
composer require openeuropa/oe_auth
composer require openeuropa/oe_authentication
```

Before being able to use the module, you will need to specify the ECAS service base URL
in your Drupal installation's `./sites/default/default.services.yml` file as shown below:

```
parameters:
oe_auth.pcas.base_url: http://my-ecas-service.com
oe_authentication.pcas.base_url: http://my-ecas-service.com
```

For more information about how to override service parameters in Drupal 8
Expand All @@ -37,12 +37,12 @@ check the [related documentation page](https://www.drupal.org/docs/8/api/service
In order to enable the module in your project run:

```
$ ./vendor/bin/drush en oe_auth
$ ./vendor/bin/drush en oe_authentication
```

## Development

The OpenEuropa Auth project contains all the necessary code and tools for an effective development process,
The OpenEuropa Authentication project contains all the necessary code and tools for an effective development process,
such as:

- All PHP development dependencies (Drupal core included) are required by [composer.json](composer.json)
Expand Down Expand Up @@ -72,7 +72,7 @@ $ ./vendor/bin/run drupal:site-setup

This will:

- Symlink the theme in `./build/modules/custom/oe_auth` so that it's available for the test site
- Symlink the theme in `./build/modules/custom/oe_authentication` so that it's available for the test site
- Setup Drush and Drupal's settings using values from `./runner.yml.dist`
- Setup PHPUnit and Behat configuration files using values from `./runner.yml.dist`

Expand All @@ -85,7 +85,7 @@ $ ./vendor/bin/run drupal:site-install
This will:

- Install the test site
- Enable the OpenEuropa Auth module
- Enable the OpenEuropa Authentication module

Then setup the mock servers dependencies by running:
```
Expand Down Expand Up @@ -114,7 +114,7 @@ $ docker-compose exec web composer install
$ docker-compose exec web ./vendor/bin/run drupal:site-install
```

To be able to interact with the OpenEuropa Auth mock container you need to add the internal container hostname to the hosts file _of your host OS_.
To be able to interact with the OpenEuropa Authentication mock container you need to add the internal container hostname to the hosts file _of your host OS_.
```
$ echo "127.0.1.1 oeauth-server" >> /etc/hosts
```
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openeuropa/oe_auth",
"description": "Authentication against the OpenEuropa Auth service.",
"name": "openeuropa/oe_authentication",
"description": "Authentication against the OpenEuropa Authentication service.",
"type": "drupal-module",
"license": "EUPL-1.2",
"minimum-stability": "dev",
Expand Down Expand Up @@ -37,12 +37,12 @@
},
"autoload": {
"psr-4": {
"Drupal\\oe_auth\\": "./src/"
"Drupal\\oe_authentication\\": "./src/"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Tests\\oe_auth\\": "./tests/"
"Drupal\\Tests\\oe_authentication\\": "./tests/"
}
},
"extra": {
Expand Down
5 changes: 0 additions & 5 deletions oe_auth.info.yml

This file was deleted.

21 changes: 0 additions & 21 deletions oe_auth.services.yml

This file was deleted.

5 changes: 5 additions & 0 deletions oe_authentication.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: OE Authentication
description: Authentication against the OpenEuropa Authentication service.
package: OpenEuropa
type: module
core: 8.x
21 changes: 21 additions & 0 deletions oe_authentication.services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
oe_authentication.pcas.base_url: ~
services:
oe_authentication.authentication:
class: \Drupal\oe_authentication\Authentication\Provider\OeAuthentication
arguments: ['@oe_authentication.pcas.factory', '@oe_authentication.user_provider']
tags:
- { name: authentication_provider, provider_id: 'oe_authentication', priority: -10, global: TRUE }

oe_authentication.user_provider:
class: \Drupal\oe_authentication\UserProvider
arguments: ['@entity_type.manager']

oe_authentication.route_subscriber:
class: \Drupal\oe_authentication\Routing\RouteSubscriber
tags:
- { name: event_subscriber }

oe_authentication.pcas.factory:
class: OpenEuropa\pcas\PCasFactory
arguments: ['@session', '%oe_authentication.pcas.base_url%']
4 changes: 2 additions & 2 deletions runner.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ drupal:
password: ""
post_install:
- "./vendor/bin/drush en config_devel -y"
- "./vendor/bin/drush en oe_auth -y"
- "./vendor/bin/drush en oe_authentication -y"
- "./vendor/bin/drush cr"
settings:
settings:
Expand All @@ -32,7 +32,7 @@ commands:
drupal:site-setup:
- { task: "mkdir", dir: "${drupal.root}/profiles" }
- { task: "mkdir", dir: "${drupal.root}/themes" }
- { task: "symlink", from: "../../..", to: "${drupal.root}/modules/custom/oe_auth" }
- { task: "symlink", from: "../../..", to: "${drupal.root}/modules/custom/oe_authentication" }
- { task: "run", command: "drupal:drush-setup" }
- { task: "run", command: "drupal:settings-setup" }
- { task: "run", command: "setup:phpunit" }
Expand Down
2 changes: 1 addition & 1 deletion services.yml.dist
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
parameters:
oe_auth.pcas.base_url: ${authentication.server.base_url}
oe_authentication.pcas.base_url: ${authentication.server.base_url}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

declare(strict_types = 1);

namespace Drupal\oe_auth\Authentication\Provider;
namespace Drupal\oe_authentication\Authentication\Provider;

use Drupal\Core\Authentication\AuthenticationProviderInterface;
use Drupal\oe_auth\UserProvider;
use Drupal\oe_authentication\UserProvider;
use OpenEuropa\pcas\PCasFactory;
use Symfony\Component\HttpFoundation\Request;

/**
* Cookie based authentication provider.
*/
class OeAuth implements AuthenticationProviderInterface {
class OeAuthentication implements AuthenticationProviderInterface {

/**
* The pCas variable.
Expand All @@ -24,16 +24,16 @@ class OeAuth implements AuthenticationProviderInterface {
/**
* The user provider variable.
*
* @var Drupal\oe_auth\UserProvider
* @var Drupal\oe_authentication\UserProvider
*/
protected $userProvider;

/**
* OeAuth constructor.
* OeAuthentication constructor.
*
* @param OpenEuropa\pcas\PCasFactory $pCasFactory
* The pCas variable.
* @param Drupal\oe_auth\UserProvider $userProvider
* @param Drupal\oe_authentication\UserProvider $userProvider
* The user provider variable.
*/
public function __construct(PCasFactory $pCasFactory, UserProvider $userProvider) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace Drupal\oe_auth\Controller;
namespace Drupal\oe_authentication\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Session\AccountProxyInterface;
Expand All @@ -12,9 +12,9 @@
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

/**
* Returns responses for OE Auth routes.
* Returns responses for OE Authentication routes.
*/
class OeAuthController extends ControllerBase {
class OeAuthenticationController extends ControllerBase {

/**
* The request stack.
Expand Down Expand Up @@ -52,7 +52,7 @@ public function __construct(RequestStack $requestStack, PCas $pcas, AccountProxy
public static function create(ContainerInterface $container) {
return new static(
$container->get('request_stack'),
$container->get('oe_auth.pcas.factory')->getPCas(),
$container->get('oe_authentication.pcas.factory')->getPCas(),
$container->get('current_user')
);
}
Expand All @@ -65,7 +65,8 @@ public static function create(ContainerInterface $container) {
*/
public function login() {
// There is no access to this route for authenticated users,
// Therefore we can directly redirect the user to the OE Auth path.
// Therefore we can directly redirect the user to
// the OE Authentication path.
if ($response = $this->pCas->login()) {
return $response;
}
Expand Down Expand Up @@ -102,7 +103,7 @@ protected function doDrupalLogout() {
}

/**
* Get the redirect object to the OE Auth logout URL.
* Get the redirect object to the OE Authentication logout URL.
*
* @param string[] $query
* The query strings if any.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

declare(strict_types = 1);

namespace Drupal\oe_auth;
namespace Drupal\oe_authentication;

use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Drupal\Core\DependencyInjection\ContainerBuilder;

/**
* Discovery for the OE Auth library settings.
* Discovery for the OE Authentication library settings.
*/
class OeAuthServiceProvider extends ServiceProviderBase {
class OeAuthenticationServiceProvider extends ServiceProviderBase {

/**
* {@inheritdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Routing/RouteSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace Drupal\oe_auth\Routing;
namespace Drupal\oe_authentication\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
Expand All @@ -20,13 +20,13 @@ protected function alterRoutes(RouteCollection $collection) {
if ($route = $collection->get('user.login')) {
$defaults = $route->getDefaults();
unset($defaults['_form']);
$defaults['_controller'] = '\Drupal\oe_auth\Controller\OeAuthController::login';
$defaults['_controller'] = '\Drupal\oe_authentication\Controller\OeAuthenticationController::login';
$route->setDefaults($defaults);
}

// Replace the core logout route.
if ($route = $collection->get('user.logout')) {
$route->setDefault('_controller', '\Drupal\oe_auth\Controller\OeAuthController::logout');
$route->setDefault('_controller', '\Drupal\oe_authentication\Controller\OeAuthenticationController::logout');
}
// Remove these routes as to generate fatal errors wherever
// functionality is missing.
Expand Down
6 changes: 3 additions & 3 deletions src/UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types = 1);

namespace Drupal\oe_auth;
namespace Drupal\oe_authentication;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\user\UserInterface;
Expand Down Expand Up @@ -84,12 +84,12 @@ protected function attachRoles(UserInterface $account, PCasUserInterface $pCasUs
protected function doLoadAccount(PCasUserInterface $pCasUser) {
$mail = $pCasUser->get('cas:email');
if (empty($mail)) {
throw new \Exception('Email address not provided by OE Auth.');
throw new \Exception('Email address not provided by OE Authentication.');
}
$accounts = $this->userStorage->loadByProperties(['mail' => $mail]);
if (empty($accounts)) {
// Account does not exist, creation of new accounts is handled in.
// @see \Drupal\oe_auth\Controller\OeAuthController::login.
// @see \Drupal\oe_authentication\Controller\OeAuthenticationController::login.
return FALSE;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/features/login.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@api
Feature: Login through OE Auth
Feature: Login through OE Authentication
In order to be able to access the CMS backend
As user of the system
I need to login through OE Auth
I need to login through OE Authentication

Scenario: Login
Given I am on the homepage
Then I click "Log in"
# We are redirected to the mock OE Auth server at this point.
# We are redirected to the mock OE Authentication server at this point.
Then I fill in "User" with "Dr. Lektroluv"
Then I fill in "Nickname" with "The Man with the Green Mask"
Then I fill in "Password" with "Em0lotion"
Expand Down

0 comments on commit 5e5b616

Please sign in to comment.