Skip to content

Commit c9d58e8

Browse files
committed
SAML cleanup
1 parent 9ab11f4 commit c9d58e8

File tree

3 files changed

+1
-54
lines changed

3 files changed

+1
-54
lines changed

web/profiles/custom/os2loop/modules/os2loop_user_login/README.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OS2Loop user login
22

3-
Log in via OpenID Connect and SAML.
3+
Log in via OpenID Connect.
44

55
Go to Administration › Configuration › OS2Loop › OS2Loop user login settings
66
(`/admin/config/os2loop/os2loop_user_login/settings`) to enable login methods.
@@ -123,27 +123,6 @@ Check your overwrites by running
123123
vendor/bin/drush config:get --include-overridden openid_connect.settings
124124
```
125125

126-
## SAML
127-
128-
The [SAML Authentication](https://www.drupal.org/project/samlauth) module is
129-
used for SAML authentication (!).
130-
131-
```php
132-
// web/sites/*/settings.local.php
133-
$config['samlauth.authentication']['sp_entity_id'] = 'os2loop;
134-
$config['samlauth.authentication']['wsp_name_id_format'] = '';
135-
// Folder containing `certs` folder with files `sp.{crt,key}`.
136-
$config['samlauth.authentication']['sp_cert_folder'] = __DIR__.'/../../..';
137-
$config['samlauth.authentication']['idp_entity_id'] = …; // Get this from you IdP metadata.
138-
$config['samlauth.authentication']['idp_single_sign_on_service'] = …; // Get this from you IdP metadata.
139-
$config['samlauth.authentication']['idp_x509_certificate'] = …; // Get this from you IdP metadata.
140-
$config['samlauth.authentication']['unique_id_attribute'] = 'upn';
141-
$config['samlauth.authentication']['create_users'] = TRUE;
142-
$config['samlauth.authentication']['user_name_attribute'] = 'name';
143-
$config['samlauth.authentication']['user_mail_attribute'] = 'mail';
144-
$config['samlauth.authentication']['sp_name_id_format'] = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress';
145-
```
146-
147126
### Translations
148127

149128
On the login form, the OpenID Connect login buttons will show a generic “Log in

web/profiles/custom/os2loop/modules/os2loop_user_login/src/Form/SettingsForm.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
9696
),
9797
];
9898

99-
$form['show_saml_login'] = [
100-
'#type' => 'checkbox',
101-
'#title' => $this->t('Show SAML login'),
102-
'#default_value' => $config->get('show_saml_login'),
103-
'#description' => $this->t(
104-
'Show SAML login button on user login page. Set up proper <a href="@config_url">SAML configuration</a> before enabling this.',
105-
[
106-
'@config_url' => Url::fromRoute('samlauth.samlauth_configure_form')->toString(),
107-
]
108-
),
109-
];
110-
11199
$options['oidc'] = $this->t('OpenID Connect');
112-
// @todo handle SAML
113-
// $options['saml'] = $this->t('SAML');
114100
$form['default_login_method'] = [
115101
'#type' => 'select',
116102
'#title' => $this->t('Default login method'),
@@ -137,7 +123,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
137123
$this->configFactory->getEditable(static::SETTINGS_NAME)
138124
->set('show_drupal_login', $form_state->getValue('show_drupal_login'))
139125
->set('show_oidc_login', $form_state->getValue('show_oidc_login'))
140-
->set('show_saml_login', $form_state->getValue('show_saml_login'))
141126
->set('default_login_method', $form_state->getValue('default_login_method'))
142127
->set('hide_logout_menu_item', $form_state->getValue('hide_logout_menu_item'))
143128
->save();

web/profiles/custom/os2loop/modules/os2loop_user_login/src/Helper/Helper.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Drupal\Core\Path\CurrentPathStack;
1111
use Drupal\Core\Session\AccountInterface;
1212
use Drupal\Core\StringTranslation\StringTranslationTrait;
13-
use Drupal\Core\Url;
1413
use Drupal\os2loop_settings\Settings;
1514
use Drupal\os2loop_user_login\Form\SettingsForm;
1615
use Drupal\user\UserInterface;
@@ -114,18 +113,6 @@ public function alterForm(&$form, FormStateInterface $form_state, $form_id) {
114113
'#attributes' => ['id' => 'drupal-login'],
115114
];
116115
}
117-
118-
if ($this->config->get('show_saml_login')) {
119-
$form['saml_login'] = [
120-
'#weight' => -100,
121-
'#type' => 'link',
122-
'#title' => $this->t('Log in with SAML'),
123-
'#url' => Url::fromRoute('samlauth.saml_controller_login'),
124-
'#attributes' => [
125-
'class' => ['btn', 'btn-primary'],
126-
],
127-
];
128-
}
129116
}
130117
}
131118

@@ -156,10 +143,6 @@ public function preprocessBlock(array &$variables) {
156143
case 'oidc':
157144
$variables['default_login_form_id'] = 'openid-connect-login-form';
158145
break;
159-
160-
case 'saml':
161-
// @todo Handle SAML redirect
162-
break;
163146
}
164147
}
165148
}

0 commit comments

Comments
 (0)