Skip to content
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

Custom OIDC provider #24

Closed
vladimirdulov opened this issue Feb 16, 2024 · 5 comments
Closed

Custom OIDC provider #24

vladimirdulov opened this issue Feb 16, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@vladimirdulov
Copy link

Could you implement an ability to setup a custom OIDC provider?

I think the following settings need to be implemented:

DISPLAY_NAME to specify custom provider name on the button
OIDC_AUTH_ENDPOINT e.g. https://my-oidc-provider.url/openid/auth
OIDC_TOKEN_ENDPOINT e.g. https://my-oidc-provider.url/openid/token
OIDC_PROFILE_ENDPOINT e.g. https://my-oidc-provider.url/openid/me
OIDC_CLIENT_ID
OIDC_CLIENT_SECRET
OIDC_SCOPE e.g. "openid,profile,email"
OIDC_UID_FIELD e.g. "sub"
OIDC_NAME_FIELD e.g. "name"
OIDC_EMAIL_FIELD e.g. "email"

@picman picman added the enhancement New feature or request label Feb 16, 2024
@vladimirdulov
Copy link
Author

I've submitted a PR to implement an ability to setup a custom OIDC provider.
@picman please review.
#25

Looking forward to use your add-on (OIDC auth) in redmine app for Cloudron.

@gramakri
Copy link
Contributor

gramakri commented Mar 4, 2024

@picman now that #25 is merged, possible to make a new release? Also, this ticket can possibly be closed. Thanks!

@picman picman closed this as completed Mar 4, 2024
@picman
Copy link
Collaborator

picman commented Mar 5, 2024

A few issues before the release:
1.

oauth_custom_uid_field_info: UID field (default - sub)

What do you mean with 'sub'?
If I open the plugin's settings page and switch to the new Custom provider, the field is preset to 'preferred_username' which doesn't correspond with 'sub'.

  1. app/views/hooks/view_account_login_bottom.html.erb: I suggest the following change in the code to prevent nil.strip when Setting.plugin_redmine_oauth[:custom_name] is not set.
-- <%= l(:oauth_login_via, oauth: Setting.plugin_redmine_oauth[:custom_name].strip.empty? ? Setting.plugin_redmine_oauth[:oauth_name] : Setting.plugin_redmine_oauth[:custom_name]).html_safe %>
++ <%= l(:oauth_login_via, oauth: Setting.plugin_redmine_oauth[:custom_name].blank? ? Setting.plugin_redmine_oauth[:oauth_name] : Setting.plugin_redmine_oauth[:custom_name]).html_safe %>
  1. Shouldn't be the new settings field initialized in the init.rb too?

@picman picman reopened this Mar 5, 2024
@picman picman added this to the 2.2.0 milestone Mar 5, 2024
@vladimirdulov
Copy link
Author

vladimirdulov commented Mar 5, 2024

A few issues before the release: 1.

oauth_custom_uid_field_info: UID field (default - sub)

What do you mean with 'sub'? If I open the plugin's settings page and switch to the new Custom provider, the field is preset to 'preferred_username' which doesn't correspond with 'sub'.

sub is the identity of the user, called subject in OpenID.
I think preferred_username also works well as the default value.

https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

  1. app/views/hooks/view_account_login_bottom.html.erb: I suggest the following change in the code to prevent nil.strip when Setting.plugin_redmine_oauth[:custom_name] is not set.
-- <%= l(:oauth_login_via, oauth: Setting.plugin_redmine_oauth[:custom_name].strip.empty? ? Setting.plugin_redmine_oauth[:oauth_name] : Setting.plugin_redmine_oauth[:custom_name]).html_safe %>
++ <%= l(:oauth_login_via, oauth: Setting.plugin_redmine_oauth[:custom_name].blank? ? Setting.plugin_redmine_oauth[:oauth_name] : Setting.plugin_redmine_oauth[:custom_name]).html_safe %>

Good point, agree.

  1. Shouldn't be the new settings field initialized in the init.rb too?

Probably you are absolutely correct, sorry I missed it (tbh I'm not a ruby/redmine dev).

just created a new PR for the suggested changes.
#27

@picman
Copy link
Collaborator

picman commented Mar 5, 2024

Thanks.

@picman picman closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants