Skip to content

Commit 3443b47

Browse files
authored
Merge branch 'release/d11-prepare' into feature/cache-settings
2 parents 7a7f50b + c36a66c commit 3443b47

10 files changed

Lines changed: 92 additions & 217 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
1010

1111
- [PR-387](https://github.com/itk-dev/os2loop/pull/387)
1212
Disabled caching of error pages
13+
- [PR-385](https://github.com/itk-dev/os2loop/pull/385)
14+
Cleaned up OpenID Connect settings and removed some obsolete custom settings
1315
- [PR-384](https://github.com/itk-dev/os2loop/pull/384)
1416
Set access permission on search view
1517
- [PR-383](https://github.com/itk-dev/os2loop/pull/383)

config/sync/openid_connect.client.generic.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ settings:
1010
client_secret: '[client-secret]'
1111
iss_allowed_domains: ''
1212
issuer_url: ''
13-
authorization_endpoint: 'https://idp-citizen.os2loop.local.itkdev.dk/connect/authorize'
14-
token_endpoint: 'https://idp-citizen.os2loop.local.itkdev.dk/connect/token'
13+
authorization_endpoint: 'https://idp-employee.os2loop.local.itkdev.dk/oauth2/authorize'
14+
token_endpoint: 'http://idp-employee:9400/oauth2/token'
1515
userinfo_endpoint: ''
16-
end_session_endpoint: 'https://idp-citizen.os2loop.local.itkdev.dk/connect/endsession'
16+
end_session_endpoint: 'https://idp-employee.os2loop.local.itkdev.dk/oauth2/end_session'
1717
scopes:
1818
- openid
1919
- email
20+
prompt:
21+
- login

config/sync/openid_connect.client.windows_aad.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

config/sync/openid_connect.settings.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ always_save_userinfo: true
22
connect_existing_users: true
33
override_registration_settings: true
44
end_session_enabled: true
5-
user_login_display: above
5+
user_login_display: replace
66
redirect_login: /user
77
redirect_logout: /
88
userinfo_mappings:
9-
timezone: zoneinfo
10-
os2loop_user_family_name: family_name
11-
os2loop_user_given_name: given_name
9+
os2loop_user_city: family_name
10+
os2loop_user_external_list: given_name
1211
role_mappings:
1312
os2loop_user_administrator:
1413
- administrator
@@ -28,3 +27,4 @@ role_mappings:
2827
- post_author
2928
os2loop_user_user_administrator:
3029
- user_administrator
30+
autostart_login: true

docker-compose.oidc.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
services:
2+
idp-employee:
3+
image: ghcr.io/geigerzaehler/oidc-provider-mock:latest
4+
networks:
5+
- app
6+
- frontend
7+
labels:
8+
- "traefik.enable=true"
9+
- "traefik.docker.network=frontend"
10+
- "traefik.http.routers.idp-employee_${COMPOSE_PROJECT_NAME:?}.rule=Host(`idp-employee.${COMPOSE_DOMAIN:?}`)"
11+
- "traefik.http.services.idp-employee_${COMPOSE_PROJECT_NAME:?}.loadbalancer.server.port=9400"
12+
command:
13+
[
14+
"--user-claims",
15+
'{"sub": "user", "email": "user@example.com", "groups": ["authenticated"]}',
16+
"--user-claims",
17+
'{"sub": "administrator", "email": "administrator@example.com", "groups": ["os2loop_user_administrator"]}',
18+
"--user-claims",
19+
'{"sub": "user_administrator", "email": "user_administrator@example.com", "groups": ["os2loop_user_user_administrator"]}',
20+
"--user-claims",
21+
'{"sub": "manager", "email": "manager@example.com", "groups": ["os2loop_user_manager"]}',
22+
"--user-claims",
23+
'{"sub": "documentation_coordinator", "email": "documentation_coordinator@example.com", "groups": ["os2loop_user_documentation_coordinator"]}',
24+
"--user-claims",
25+
'{"sub": "document_collection_editor", "email": "document_collection_editor@example.com", "groups": ["os2loop_user_document_collection_editor"]}',
26+
"--user-claims",
27+
'{"sub": "document_author", "email": "document_author@example.com", "groups": ["os2loop_user_document_author"]}',
28+
"--user-claims",
29+
'{"sub": "external_sources_editor", "email": "external_sources_editor@example.com", "groups": ["os2loop_user_external_sources_editor"]}',
30+
"--user-claims",
31+
'{"sub": "post_author", "email": "post_author@example.com", "groups": ["os2loop_user_post_author"]}',
32+
"--user-claims",
33+
'{"sub": "read_only", "email": "read_only@example.com", "groups": ["os2loop_user_read_only"]}',
34+
]

docker-compose.override.yml

Lines changed: 3 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
include:
2+
- docker-compose.oidc.yml
3+
14
services:
25
node:
36
image: node:20
@@ -16,123 +19,3 @@ services:
1619
environment:
1720
# Match PHP_MAX_EXECUTION_TIME above
1821
- NGINX_FASTCGI_READ_TIMEOUT=300
19-
20-
idp-citizen:
21-
image: ghcr.io/soluto/oidc-server-mock:0.8.6
22-
profiles:
23-
- oidc
24-
- test
25-
# Let this container be accessible both internally and externally on the same domain.
26-
container_name: idp-citizen.${COMPOSE_DOMAIN}
27-
networks:
28-
- app
29-
- frontend
30-
ports:
31-
# https://github.com/Soluto/oidc-server-mock?tab=readme-ov-file#https
32-
# - '80'
33-
- "443"
34-
volumes:
35-
- .:/tmp/config:ro
36-
labels:
37-
- "traefik.enable=true"
38-
- "traefik.docker.network=frontend"
39-
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}_idp-citizen.rule=Host(`idp-citizen.${COMPOSE_DOMAIN}`)"
40-
- "traefik.http.services.${COMPOSE_PROJECT_NAME}_idp-citizen.loadbalancer.server.port=443"
41-
- "traefik.http.services.${COMPOSE_PROJECT_NAME}_idp-citizen.loadbalancer.server.scheme=https"
42-
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}_idp-citizen.middlewares=redirect-to-https"
43-
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
44-
45-
environment:
46-
# https://github.com/Soluto/oidc-server-mock?tab=readme-ov-file#https
47-
ASPNETCORE_URLS: https://+:443;http://+:80
48-
ASPNETCORE_Kestrel__Certificates__Default__Password: mock
49-
ASPNETCORE_Kestrel__Certificates__Default__Path: /tmp/config/.docker/oidc-server-mock/cert/docker.pfx
50-
51-
ASPNETCORE_ENVIRONMENT: Development
52-
SERVER_OPTIONS_INLINE: |
53-
AccessTokenJwtType: JWT
54-
Discovery:
55-
ShowKeySet: true
56-
Authentication:
57-
CookieSameSiteMode: Lax
58-
CheckSessionCookieSameSiteMode: Lax
59-
60-
LOGIN_OPTIONS_INLINE: |
61-
{
62-
"AllowRememberLogin": false
63-
}
64-
65-
LOGOUT_OPTIONS_INLINE: |
66-
{
67-
"AutomaticRedirectAfterSignOut": true
68-
}
69-
70-
CLIENTS_CONFIGURATION_INLINE: |
71-
- ClientId: client-id
72-
ClientSecrets: [client-secret]
73-
Description: Mock IdP
74-
AllowedGrantTypes:
75-
# - client_credentials
76-
# - implicit
77-
- authorization_code
78-
# https://github.com/Soluto/oidc-server-mock/issues/46#issuecomment-704963181
79-
RequireClientSecret: false
80-
AllowAccessTokensViaBrowser: true
81-
# https://github.com/Soluto/oidc-server-mock/issues/26#issuecomment-705022941
82-
AlwaysIncludeUserClaimsInIdToken: true
83-
AllowedScopes:
84-
- openid
85-
- profile
86-
- email
87-
ClientClaimsPrefix: ''
88-
RedirectUris:
89-
- '*'
90-
# https://github.com/Soluto/oidc-server-mock/issues/60
91-
PostLogoutRedirectUris:
92-
- '*'
93-
# https://github.com/Soluto/oidc-server-mock/issues/46#issuecomment-704845375
94-
RequirePkce: false
95-
96-
# Needed to set custom claim types in "profile"
97-
# https://github.com/Soluto/oidc-server-mock/issues/123#issuecomment-1427129278
98-
# https://github.com/Soluto/oidc-server-mock/blob/master/README.md#simple-configuration
99-
# https://docs.docker.com/compose/compose-file/compose-file-v3/#environment
100-
OVERRIDE_STANDARD_IDENTITY_RESOURCES: "true"
101-
IDENTITY_RESOURCES_INLINE: |
102-
# https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claims
103-
- Name: openid
104-
ClaimTypes:
105-
- sub
106-
- Name: email
107-
ClaimTypes:
108-
- email
109-
- Name: profile
110-
ClaimTypes:
111-
# Add your custom claims here
112-
- dk_ssn
113-
- name
114-
- email
115-
- zip
116-
- uuid
117-
118-
USERS_CONFIGURATION_INLINE: |
119-
- SubjectId: 1
120-
Username: citizen1
121-
Password: citizen1
122-
Claims:
123-
# Claims added here must be defined above in IDENTITY_RESOURCES_INLINE
124-
- Type: dk_ssn
125-
Value: '1111111111'
126-
ValueType: string
127-
- Type: name
128-
Value: 'Anders And'
129-
ValueType: string
130-
- Type: email
131-
Value: admin@example.com
132-
ValueType: string
133-
- Type: zip
134-
Value: '1111'
135-
ValueType: string
136-
- Type: uuid
137-
Value: '11111111-1111-1111-1111-111111111111'
138-
ValueType: string

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ Go to Administration › Configuration › OS2Loop › OS2Loop user login settin
77

88
## OpenID Connect
99

10-
The modules [OpenID Connect](https://www.drupal.org/project/openid_connect) and
11-
[OpenID Connect Microsoft Azure Active Directory
12-
client](https://www.drupal.org/project/openid_connect_windows_aad) are used for
13-
OpenID Connect login. *Note*: Eventhough it's called “OpenID Connect Microsoft
14-
Azure Active Directory client” it also work with other OpenID Connect identity
15-
providers.
16-
17-
In the default configuration both login methods assume that the identitity
10+
The module [OpenID Connect](https://www.drupal.org/project/openid_connect) is
11+
used for OpenID Connect login.
12+
13+
In the default configuration the login method assumes that the identitity
1814
provider returns a `name` claim which is used as the Drupal user name and that a
1915
`groups` claim is a list of groups that can be mapped to Drupal roles.
2016

@@ -83,12 +79,16 @@ $config['openid_connect.client.generic']['settings']['authorization_endpoint'] =
8379
$config['openid_connect.client.generic']['settings']['token_endpoint'] = …; // Get this from your OpenID Connect Discovery endpoint
8480
// Optional
8581
$config['openid_connect.client.generic']['settings']['end_session_endpoint'] = …; // Get this from your OpenID Connect Discovery endpoint
82+
83+
// Disable "Autostart login process"
84+
$config['openid_connect.settings']['autostart_login'] = false;
8685
```
8786

8887
Check your overwrites by running
8988

9089
```sh
9190
vendor/bin/drush config:get --include-overridden openid_connect.client.generic
91+
vendor/bin/drush config:get --include-overridden openid_connect.settings
9292
```
9393

9494
#### Groups to roles mapping

web/profiles/custom/os2loop/modules/os2loop_user_login/os2loop_user_login.module

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@
55
* The module file for os2loop_user_login.
66
*/
77

8-
use Drupal\Core\Form\FormStateInterface;
98
use Drupal\user\UserInterface;
109

11-
/**
12-
* Implements hook_form_alter().
13-
*
14-
* @see \Drupal\os2loop_user_login\Helper\Helper::alterForm()
15-
*/
16-
function os2loop_user_login_form_alter(&$form, FormStateInterface $form_state, $form_id) {
17-
Drupal::service('os2loop_user_login.helper')->alterForm($form, $form_state, $form_id);
18-
}
19-
2010
/**
2111
* Implements hook_menu_local_tasks_alter().
2212
*

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,37 +73,43 @@ public function buildForm(array $form, FormStateInterface $form_state) {
7373
$form['show_drupal_login'] = [
7474
'#type' => 'checkbox',
7575
'#title' => $this->t('Show Drupal login'),
76-
'#default_value' => $config->get('show_drupal_login'),
76+
'#default_value' => FALSE,
77+
'#disabled' => TRUE,
7778
'#description' => $this->t(
78-
'Show Drupal (username and password) login on user login page. If not enabled, the login form will still be visible if <a href="@login_url"><code>#drupal-login</code></a> is appended to the url (<a href="@login_url">@login_url</a>).',
79+
'This option has been removed. This is now controlled by the "@config_title" setting in the <a href=":config_url">OpenID Connect settings</a>.',
7980
[
80-
'@login_url' => Url::fromRoute('user.login', [], [
81-
'absolute' => TRUE,
82-
'fragment' => 'drupal-login',
83-
])->toString(),
84-
]),
81+
'@config_title' => $this->t('OpenID buttons display in user login form'),
82+
':config_url' => Url::fromRoute('openid_connect.admin_settings')->toString(),
83+
],
84+
),
8585
];
8686

8787
$form['show_oidc_login'] = [
8888
'#type' => 'checkbox',
8989
'#title' => $this->t('Show OpenID Connect login'),
90-
'#default_value' => $config->get('show_oidc_login'),
90+
'#default_value' => FALSE,
91+
'#disabled' => TRUE,
9192
'#description' => $this->t(
92-
'Show OpenID Connect login button on user login page. Set up proper <a href="@config_url">OpenID Connect configuration</a> before enabling this.',
93+
'This option has been removed. This is now controlled by the "@config_title" setting in the <a href=":config_url">OpenID Connect settings</a>.',
9394
[
94-
'@config_url' => Url::fromRoute('openid_connect.admin_settings')->toString(),
95-
]
95+
'@config_title' => $this->t('OpenID buttons display in user login form'),
96+
':config_url' => Url::fromRoute('openid_connect.admin_settings')->toString(),
97+
],
9698
),
9799
];
98100

99-
$options['oidc'] = $this->t('OpenID Connect');
100101
$form['default_login_method'] = [
101102
'#type' => 'select',
102103
'#title' => $this->t('Default login method'),
103-
'#options' => $options,
104-
'#empty_value' => '',
105-
'#default_value' => $config->get('default_login_method'),
106-
'#description' => $this->t('The default login method to use. If specified, anonymous users will automatically be logged in with this method.'),
104+
'#default_value' => FALSE,
105+
'#disabled' => TRUE,
106+
'#description' => $this->t(
107+
'This option has been removed. This is now controlled by the "@config_title" setting in the <a href=":config_url">OpenID Connect settings</a>.',
108+
[
109+
'@config_title' => $this->t('Autostart login process'),
110+
':config_url' => Url::fromRoute('openid_connect.admin_settings')->toString(),
111+
],
112+
),
107113
];
108114

109115
$form['hide_logout_menu_item'] = [
@@ -121,9 +127,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
121127
*/
122128
public function submitForm(array &$form, FormStateInterface $form_state) {
123129
$this->configFactory->getEditable(static::SETTINGS_NAME)
124-
->set('show_drupal_login', $form_state->getValue('show_drupal_login'))
125-
->set('show_oidc_login', $form_state->getValue('show_oidc_login'))
126-
->set('default_login_method', $form_state->getValue('default_login_method'))
127130
->set('hide_logout_menu_item', $form_state->getValue('hide_logout_menu_item'))
128131
->save();
129132

0 commit comments

Comments
 (0)