-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from openeuropa/OPENEUROPA-1501
OPENEUROPA-1501: Implement configuration UI for Authentication.
- Loading branch information
Showing
11 changed files
with
202 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
oe_authentication.settings: | ||
title: Authentication settings | ||
description: 'Configure Authentication settings.' | ||
route_name: oe_authentication.settings | ||
parent: system.admin_config_system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
administer authentication configuration: | ||
title: 'Administer Authentication configuration' | ||
restrict access: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
oe_authentication.settings: | ||
path: '/admin/config/system/oe_authentication' | ||
defaults: | ||
_form: 'Drupal\oe_authentication\Form\AuthenticationSettingsForm' | ||
_title: 'Authentication settings' | ||
requirements: | ||
_permission: 'administer authentication configuration' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Drupal\oe_authentication\Form; | ||
|
||
use Drupal\Core\Form\ConfigFormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Settings form for module. | ||
*/ | ||
class AuthenticationSettingsForm extends ConfigFormBase { | ||
|
||
/** | ||
* Name of the config being edited. | ||
*/ | ||
const CONFIG_NAME = 'oe_authentication.settings'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFormId() { | ||
return 'oe_authentication_settings'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$form['protocol'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Application authentication protocol'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('protocol'), | ||
]; | ||
$form['register_path'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Application register path'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('register_path'), | ||
]; | ||
$form['validation_path'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Application validation path'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('validation_path'), | ||
]; | ||
$form['assurance_level'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Application assurance levels'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('assurance_level'), | ||
]; | ||
$form['ticket_types'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Application available ticket types'), | ||
'#default_value' => $this->config(static::CONFIG_NAME)->get('ticket_types'), | ||
]; | ||
return parent::buildForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $form_state) { | ||
$this->config(static::CONFIG_NAME) | ||
->set('protocol', $form_state->getValue('protocol')) | ||
->set('register_path', $form_state->getValue('register_path')) | ||
->set('validation_path', $form_state->getValue('validation_path')) | ||
->set('assurance_level', $form_state->getValue('assurance_level')) | ||
->set('ticket_types', $form_state->getValue('ticket_types')) | ||
->save(); | ||
parent::submitForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getEditableConfigNames() { | ||
return ['oe_authentication.settings']; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@api | ||
Feature: Authentication | ||
As the site manager | ||
I need to be able to configure the settings | ||
|
||
Background: | ||
Given I am logged in as a user with the "administer authentication configuration" permission | ||
|
||
@DrupalLogin @BackupAuthConfigs | ||
Scenario: Configure Authentication settings | ||
Given I am on "the Authentication configuration page" | ||
Then I should see "Authentication settings" | ||
# Check for the default config is there. | ||
And the "Application authentication protocol" field should contain "eulogin" | ||
And the "Application register path" field should contain "eim/external/register.cgi" | ||
And the "Application validation path" field should contain "TicketValidationService" | ||
And the "Application assurance levels" field should contain "TOP" | ||
And the "Application available ticket types" field should contain "SERVICE,PROXY" | ||
# Change the configuration values. | ||
When I fill in "Application authentication protocol" with "something" | ||
And I fill in "Application register path" with "test/something" | ||
And I fill in "Application validation path" with "validation/path" | ||
And I fill in "Application assurance levels" with "assurance" | ||
And I fill in "Application available ticket types" with "ticket.test" | ||
And I press "Save configuration" | ||
Then I should see the message "The configuration options have been saved." | ||
And the "Application authentication protocol" field should contain "something" | ||
And the "Application register path" field should contain "test/something" | ||
And the "Application validation path" field should contain "validation/path" | ||
And the "Application assurance levels" field should contain "assurance" | ||
And the "Application available ticket types" field should contain "ticket.test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters