-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update OIDC configuration UI #16935
Update OIDC configuration UI #16935
Conversation
4082d8e
to
7738bb7
Compare
1af6673
to
47d66f7
Compare
2abcc93
to
7d89e79
Compare
8764daa
to
8b4c7d8
Compare
<fieldset class="form--fieldset"> | ||
<legend class="form--fieldset-legend"><%= I18n.t(:'settings.authentication.single_sign_on') %></legend> | ||
<div class="form--field"> | ||
<% providers = AuthProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 6 lines should really go into a helper and not live in a template.
options | ||
.select { |key, _| Saml::Provider.stored_attributes[:options].include?(key.to_s) } | ||
.each do |key, value| | ||
model.public_send(:"#{key}=", value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing necessary for the triumph of evil is for good men to do nothing.
I have to at least denounce this indentation for the record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️
It is not relevant for the configured? check
otherwise they will appear incomplete, even though they are complete
It is defined in the omnaiuth gem already (however with different bits)
7e76f60
to
6ac6af4
Compare
require "spec_helper" | ||
|
||
require Rails.root.join("modules/openid_connect/db/migrate/20240829140616_migrate_oidc_settings_to_providers.rb") | ||
RSpec.describe MigrateOidcSettingsToProviders, type: :model do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🙏
Ticket
https://community.openproject.org/wp/57677
https://community.openproject.org/wp/58437
https://community.openproject.org/wp/58451
Screenshots
Sign in screen.
OIDC providers table.
Custom form
Peek.2024-10-14.15-45.mp4
Google and Microsoft Entra form
Peek.2024-10-14.16-33.mp4
What approach did you choose and why?
Create new UI to configure OIDC providers.
TODO:
Setting.plugin_openproject_openid_connect
.modules/openid_connect/app/seeders/env_data/openid_connect/provider_seeder.rb
. Accessible throughSetting.seed_openid_connect_provider
. Env alias is:OPENPROJECT_OPENID__CONNECT
auth_providers
table. UseOpenIDConnect::Provider
model to manipulate it. This model is used to work with three types of OIDC providers: Google, Entra, Custom.OpenIDConnect::Provider#oidc_provider
is used for distinguishing between them.modules/openid_connect/app/services/openid_connect/providers/update_service.rb
. The request is done for all three types, but UI allows to fill it in only for Custom case. For Google the URL is static. For Microsoft it is derived from tenant.See https://www.openproject.org/docs/installation-and-operations/misc/custom-openid-connect-providers/#attribute-mapping for env variable usage example.
It is used here, for example: https://github.com/opf/openproject/blob/dev/app/services/authentication/omniauth_service.rb#L263.
Rough plan:
OpenIDConnect::Provider
modules/openid_connect/app/services/openid_connect/sync_service.rb
which is used in the migration and seeder.OpenIDConnect::Provider#to_h
and make sure it is available in appropriate OmniAuth::OpenIDConnect::Provider instance returned byOpenProject::OpenIDConnect.providers
.