Conditional login through identity provider#20188
Conversation
…YCLOAK-19956): Conditional login through identity provider Added new fields in the OIDC settings page to specify an additional authentication check based on token claims: - one switch to toggle the check on and off: defaults to off - one field to define the token name (must be in the ID token section): defaults to empty string - one field to define the expected token value (with regex matching): defaults to empty string Latest two fields are hidden if the switch is turned off. Default values are provided in the IdentityProviderModel, which should guarantee proper upgrade of data from previous release. I have found no existing unit test on this area, so I did not include a new one for this feature. Updated Server Admin guide to reflect the change. Tested on local environment and also on OpenShift deployment.
|
Please create a new Github issue referencing the Jira issue so this feature can be discussed. |
Created #20191 |
edewit
left a comment
There was a problem hiding this comment.
I only looked at the frontend code, don't know about this feature
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
|
@pedroigor @mposolda could you take a look at this please? |
|
Had a quick look at this and couple notes from me:
|
mposolda
left a comment
There was a problem hiding this comment.
I've added few additional inline comments in addition to @stianst comment.
I am maring this as "missing tests". We have identity brokering tests in the testsuite in the package org.keycloak.testsuite.broker . Hope you can use some existing tests for the inspiration.
js/apps/admin-ui/public/locales/en/identity-providers-help.json
Outdated
Show resolved
Hide resolved
js/apps/admin-ui/src/identity-providers/add/AdvancedSettings.tsx
Outdated
Show resolved
Hide resolved
services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
Outdated
Show resolved
Hide resolved
services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
Outdated
Show resolved
Hide resolved
services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java
Outdated
Show resolved
Hide resolved
pedroigor
left a comment
There was a problem hiding this comment.
This looks somewhat related to https://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter.
However, the claims parameter is OPTIONAL and I'm not sure if OPs are supposed to not authenticate a user if a requested claim (and optionally its value) is not available for a given user.
I think it makes sense to at least make it more aligned with the idea of the claims parameter from the specification. Something like:
- Verify essential claim (ON/OFF. If enabled, ID tokens issued by the OP must have a specific claim. Otherwise, the user can not authenticate through this broker.)
- Essential claim (name)
- Essential claim value (value)
Even though not strictly related to claims support, using a similar terminology should help to understand what it does.
@pedroigor Agree that there is some relation to |
|
@mposolda while writing the test code I verified that |
…ation test methods
|
|
||
| Where `<name>` and `<value>` represent the attribute name and value, respectively. | ||
|
|
||
| = Essential claim configuration in OpenID Connect identity providers |
There was a problem hiding this comment.
@andymunro could you give this piece of text a look?
docs/documentation/server_admin/topics/identity-broker/configuration.adoc
Outdated
Show resolved
Hide resolved
…ration.adoc Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
|
@jonkoops @dmartionol Thanks for the updates, but I am not sure if test failures are just "instability" or if it's regression of this PR? Seems to me that issues in |
Now |
|
@dmartinol I think that those test failures are not caused by your PR, but rather some general instability as I see them also in some other PR #20621 (looks like exactly same test failures)... @jonkoops Could you please confirm? BTV. It can be helpful if you stop merging this PR with latest Keycloak main (without any changes in your PR) as it just re-triggers the build when the links to the old build would be lost. We can eventually re-trigger your jobs when needed and/or will ask you for rebase/merge. |
ghost
left a comment
There was a problem hiding this comment.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.forms.ResetPasswordTest#resetPasswordLinkKeycloak CI - Forms IT (firefox) |
|
@dmartinol I've updated the branch to latest Keycloak main. That should probably help to fix test failures (They were fixed in the meantime in Keycloak main by PR #21312 ). Hopefully we're finally very close to merge now :-) |
Closes #20191
Added new fields in the OIDC settings page to specify an additional authentication check based on token claims:
Latest two fields are hidden if the switch is turned off.
Default values are provided in the IdentityProviderModel, which should guarantee proper upgrade of data from previous release.
I have found no existing unit test on this area, so I did not include a new one for this feature.
Updated Server Admin guide to reflect the change.
Tested on local environment and also on OpenShift deployment.