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

fix: toggle oidc login via settings #4588

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

connoratrug
Copy link
Contributor

@connoratrug connoratrug commented Jan 6, 2025

What are the main changes you did

  • Keep state in settings ( like the other settings)
  • only check props once ( on system start )
  • always include isOidcEnabled setting on settings request

Closes #4587

How to test

  • explain here what to do to test this (or point to unit tests)

Checklist

  • updated docs in case of new feature
  • added/updated tests
  • added/updated testplan to include a test for this fix, including ref to bug using # notation

- Keep state in settings ( like the other settings)
- only check props once ( on system start )
- always include isOidcEnabled setting on settings request
@connoratrug connoratrug marked this pull request as ready for review January 6, 2025 14:05
@connoratrug connoratrug requested a review from mswertz January 6, 2025 14:58
Copy link
Member

@mswertz mswertz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code and approach looks okay. But how to test?

this.isOidcEnabled = Boolean.parseBoolean(isOidcEnabledSetting);
} else {
Object envSetting =
EnvironmentProperty.getParameter(Constants.MOLGENIS_OIDC_CLIENT_ID, null, STRING);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should at some point have some way to find out about oidc errors but this is probably not the way.

@mswertz mswertz requested a review from harmbrugge January 7, 2025 08:35
Copy link
Member

@harmbrugge harmbrugge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always getting the oidc enabled via settings looks fine, but don't we want a check to see if the settings are complete before enabling it?

if (!this.isOidcEnabled) return;

// check if OIDC settings are complete otherwise log error and set to false
if (!isValidOidcSettings()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't check if OIDC settings are complete, when enabled? This is fine by me, but I made it because it was requested

@connoratrug
Copy link
Contributor Author

@mswertz @harmbrugge this is a cross service feature, i suggest to keep the setting part as simple ( and stateless ) as possible. The combination of oo programming, globals via statics and caching makes it hard to track the state. We can extend the ci setup to test the config code ( enabling and disabling the oidc login) ( other pr ) , a service check would need some polling ( e2e on prod setup ) per service instance , we do not have a setup for this.

Copy link
Contributor

@dtroelofsprins dtroelofsprins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally tested:

isOidcEnabled = false:

  • apps/central => SignUp, SignIn buttons
  • schema level => SignUp, SignIn buttons

isOidcEnabled = true:

  • apps/central => only SignIn button
  • schema level => only SignIn button

@connoratrug connoratrug merged commit 44e7daf into master Jan 8, 2025
7 checks passed
@connoratrug connoratrug deleted the fix/4587-toggle-oidc--via-settings branch January 8, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: OIDC SignIn button not shown in case landing page resolves to an App
4 participants