Enable clients to enforce an ACR via client attribute#33205
Enable clients to enforce an ACR via client attribute#33205mposolda merged 2 commits intokeycloak:mainfrom
Conversation
4c39528 to
7cfc43a
Compare
bb0a216 to
6fe433b
Compare
Unreported flaky test detectedIf 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.webauthn.registration.passwordless.PwdLessPubKeySignRegTest#publicKeySignaturesNonExistingKeycloak CI - WebAuthn IT (chrome) |
|
Q1) My vote is to go with "Minimal ACR" instead of "Forced ACR" . IMO it is fine if client (or user) requests bigger value with the
And then client uses I can see that if we go with "Minimal ACR", we can use single value rather than list? I can also see that "Minimal ACR" will be the default level used in case that acr is not requested by client application and there are not @sonOfRa Does this work for you? Q2) My vote is to avoid realm-level for now. We can maybe add it as a follow-up if there is a need (maybe with the client policy as suggested by @thomasdarimont)? I can imagine that realm-level adds some additional complexity. Also if we go with the "Minimal ACR" approach (which is my preference), then I don't see much value in realm-level at all as administrator can always set the authentication flows in a way that this minimal level is the lowest one allowed by the authentication flow? Q3) I agree with the @sonOfRa that we need to keep the "default ACR" as it is supported by OIDC client registration specification. @thomasdarimont I am sorry as I forgot that this is specification thing when we discussed on the KeyConf and when I mentioned the possibility that this can be removed. Considering that this is specification thing, we will probably need to keep it. +1 to the following points mentioned by @sonOnfRa :
@sonOfRa I suggest to remove all the changes in |
|
That plan sounds good to me, our needs are covered by implementing it this way. Before I get started rewriting this PR, I have some questions/points on how the implementation should behave:
|
|
@sonOfRa Thanks for the discussion and for raising the follow-up clarifications! I am adding some answers inline, but overally, your ideas look nice to me.
+1
This is interesting concern. My vote is that:
For the second case, I don't have much preference between
+1
+1 to not doing this expensive operation. I think we may already have this issue because if realm ACR-to-Loa mapping is updated, the client
+1 for the Keycloak default behaviour. ATM it is already done in a way that if non-existing claim is requested as "essential", we reject the request. If non-essential, we log the warning and continue https://github.com/keycloak/keycloak/blob/26.0.0/services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java#L329-L338
+1 for remove it from
+1 |
|
Just pushed a starting point for the discussed changes. Currently writing some tests, but manual testing failed because the head of main branch currently won't start for me due to an exception: |
6bc3728 to
dca2963
Compare
mposolda
left a comment
There was a problem hiding this comment.
@sonOfRa Thanks for the updates!
Added some minor comment inline about possibly removing the comment in AcrProtocolMapper (if you want to move checks to AuthorizationEndpointChecker, it is welcome, but just if you feel strongly that it should be done in this PR :-)
Besides that: Is it possible to add tests for:
- Scenario that authentication request fails when requested essential claim with lower value than the "minimum" level?
- Scenario when attempt to update client fails with the attempt to use the "minimum" value, which is not mapped to any level?
|
@thomasdarimont Do you want to review as well? |
| deleteConfirmGroup_other=Are you sure you want to delete these groups. | ||
| scopePermissions.users.manage-description=Policies that decide if an administrator can manage all users in the realm | ||
| defaultACRValuesHelp=Default values to be used as voluntary ACR in case that there is no explicit ACR requested by 'claims' or 'acr_values' parameter in the OIDC request. | ||
| minimumACRValueHelp=Minimum ACR to be enforced by keycloak. Overrides lower ACRs explicitly requested via 'acr_values' or 'claims', unless marked they are essential |
There was a problem hiding this comment.
Shouldn't this be "minimumACRValuesHelp"?
There was a problem hiding this comment.
It's a singular value, but I just realized in the UI part of the PR I added it as a MultiLine input. That was a copy-pasting accident from a previous version of this PR where it was multiple values. I'll adjust the input type.
I'll write some additional tests for those scenarios |
Signed-off-by: Simon Levermann <[email protected]>
|
Added the requested additional tests (and some more that seemed to make sense to me). Found a minor bug in the process where I only took into account numerical ACRs that directly match LoAs from authentication flows, which is fixed with the introduction of the Also changed the input to be a |
Unreported flaky test detectedIf 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.KcOidcBrokerTest#testPostBrokerLoginFlowWithOTP_bruteForceEnabledKeycloak CI - Java Distribution IT (windows-latest - temurin - 17) |
mposolda
left a comment
There was a problem hiding this comment.
@sonOfRa Thanks for all the updates! I hope to merge if tests are OK
@agagancarczyk Also thanks to you for the review!
closes #16884
This is a possible implementation of #16884 using a client attribute in order to enforce a specific ACR on a client.
This enables users to enforce 2FA via ACR even when the client application does not support scanning the received tokens for the desired ACR level