8000 Adding ConditionalClientScopeAuthenticator by mposolda · Pull Request #36020 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Adding ConditionalClientScopeAuthenticator - #36020

Merged
mposolda merged 2 commits into
keycloak:mainfrom
mposolda:10250-otp
Dec 20, 2024
Merged

mposolda merged 2 commits into
keycloak:mainfrom
mposolda:10250-otp

Conversation

@mposolda
@mposolda mposolda commented Dec 18, 2024 •
Copy link
Copy Markdown
Contributor

closes #36081

  • Adding conditional client scope authenticator. It is a new condition in the authentication flow, which evaluates to true if a configured client scope is present as a client scope of the client requesting authentication. Supported both default client scopes and optional client scopes (in the 2nd case client scope need to be requested by the scope parameter during authentication).

  • Adding the test in the KcOidcPostBrokerLoginTest as I've wanted to test the authenticator in the use-case of identity brokering, which was the original use-case in the GH issue. However the authenticator is not specific to identity brokering and it has use-cases for the default flows like browser as well (I recall some similar cases in the past when I was thinking that something like this might be useful). I moved some existing tests to the new class from KcOidcBrokerLoginTest, which was quite big.

  • Adding the documentation. Also added the documentation for Post login flow as we did yet have any documentation for it and hence this functionality was maybe a bit hidden (Added few examples to it with the example of the new client scope condition used).

@mposolda mposolda self-assigned this Dec 18, 2024
@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the 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.broker.KcOidcBrokerTokenExchangeTest#testInternalExternalTokenExchangeStoredToken

Keycloak CI - Base IT (2)

java.lang.AssertionError: 

Expected: a value greater than <5L>
     but: <5L> was equal to <5L>
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@mposolda mposolda changed the title ConditionalClientScopeAuthenticator - WiP Adding ConditionalClientScopeAuthenticator Dec 19, 2024
@mposolda
mposolda marked this pull request as ready for review December 19, 2024 09:56
@mposolda
mposolda requested review from a team as code owners December 19, 2024 09:56
@mposolda
mposolda requested a review from andymunro December 19, 2024 10:06
@rmartinc rmartinc left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mposolda LGTM! Just a comment about a copy/paste leftover.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy/paste issue 😄. Just change to for conditional client scope authenticator or similar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, Thanks :-) Updated.

closes keycloak#10250

Signed-off-by: mposolda <mposolda@gmail.com>
@rmartinc rmartinc left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mposolda! LGTM!

@andymunro andymunro left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mposolda Looks good with a few changes.

@cgeorgilakis
Copy link
Copy Markdown
Contributor

My comment in my related PR was :

The most important for as is that Keycloak as a proxy must support MFA for federated users. My PR is trying to fix this together with other client flow specific actions like OTP, deny access with continuing flow after user is login via IdP.
Based on OpenID Connect Core 1.0, JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens and OAuth 2.0 Step Up Authentication Challenge Protocol MFA in id token, access token and token introspection should be able to requested via :

As I understand Keycloak will supports all these ways in version 26.1 . We will investigate further this later and details are out of scope of this PR.
However, @mposolda Keycloak version 26.1 will support all the supported MFA ways also for federated users? Will it be done via development / configuration? How?
I believe that this is the important investigation action related to the proposed solution.
I have forgoten to mentioned that each client may (or may not) use MFA in differnet way.

So, in order to close the issue #10250, will MFA (step-up authentication) work with acr and acr_values for federated user? Adding a post flow like mentioned in Creating a browser login flow with step-up mechanism will be enough?

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
Signed-off-by: Marek Posolda <mposolda@gmail.com>
@mposolda
Copy link
Copy Markdown
Contributor Author

@rmartinc @andymunro Thanks for the reviews!

@mposolda
mposolda merged commit a3fd076 into keycloak:main Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authentication flow condition for client scope

4 participants

0