Repository navigation
[OID4VCI] User self-issued credential: Issuance initiated from web po… - #46327
Conversation
9b877b0 to
a166b2d
Compare
89a0499 to
0ee18c0
Compare
|
The Is there a use case that requires a On a more general note, I wonder about the role/value of GUI functionality that is not backed by REST API. I was under the impression that Keycloak follows a REST API centric architecture. If it is not on the REST API, it can't work on the CLI either. It will also not work in deployments where GUI access is turned off. AFAIK, Keycloak is designed to work as a headless AS + IP. Unless I'm mistaken, all OAuth/OIDC message exchanges work against the REST API. Any http library or Perhaps we need to clarify this GUI vs. REST API approach - it would effect how we do things. I'm generally not against Application Initiated Actions (AIA) as long as they do not provide the only possible path to a given thing or prevent the REST API to access that thing. Anyway, I believe this PR should build on top of
|
Yes, the use-case is for example "User initiates Issuance from Keycloak Portal" from the use-cases created by @Captain-P-Goldfish here: #45626 . You have web portal, but at the same time, you have wallet, which is possibly on different device (typically mobile phone). You can use pre-authorized grant with your wallet, but it first needs to be ensured that user properly authenticated somewhere else (which might be authentication on different device). And when the page is displayed by the Keycloak, it is guaranteed that user authenticated. In other words, flow like this:
Note that university in this case doesn't have access to pre-authorized grant credential-offer, but just Keycloak and user himself have access to it. Which is actually huge advantage.
Keycloak is especially browser SSO. Lots of the things supported by Keycloak are not backed by REST API. For example, functionality like Note that application can request to authenticate, but does NOT have access to user's login credentials (password, OTP). In general: REST endpoints are in general useful when some other party (client application) needs to access some data/functionality of Keycloak. At the same time, in case that some data/functionality should be rather shared just to the user himself and not with client application, the REST endpoints might not be desired.
+1 to clarify GUI vs REST API approach. It seems we will need to document this once we add the proper documentation for OID4VCI to document when to use both approaches. I see the GUI as better alternative when possible as it does not require to share the pre-authorized code credential-offer with any other party (issuance portal client application, admin user) besides issuer(Keycloak) and user himself. Also it makes implicit consent of the user by making sure that Keycloak / issuer displayed the screen to the user: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-user-consent . Also the AIA based approach is in fact "user self-issuance" when REST API is also for the cases when someone else (administrator) created credential-offer in advance for the user. For administrator issuing credentials to the user, we may need to also support the use-case of credential-offer being sent by the email in addition to AIA and REST endpoint. Related issue: #46198 But I see credential-offer created by REST endpoint has also some use-cases, which GUI based approach might not always cover.
I don't consider this to be limited to
Yes, it has the same customization options as the login screen. Keycloak has the concept of "themes" https://www.keycloak.org/docs/latest/server_admin/index.html#_themes . And this screen is part of the "Login theme" . This means effectively same CSS etc are used as for normal Keycloak login screens. Administrators are able to deploy their own themes and hence customize the look and feel of the screens. |
0ee18c0 to
afe0b8c
Compare
The The |
Yes, I agree. I don't consider that
Yes, with pre-authorized_code grant, you don't need second login on the wallet. Also as you mentioned, the pre-authorized code grant is useful for the cases when the wallet on other device is not able to authenticate itself.
I don't consider AIA required as in some cases, I suppose that REST endpoint would be needed. But I see AIA useful even in some cases when the wallet cannot authorize itself. For example cases when:
But I suppose that there are likely use-cases where none of those may not fit ideally and hence REST endpoint approach will need to be used. Is it correct? |
Signed-off-by: mposolda <mposolda@gmail.com>
Signed-off-by: mposolda <mposolda@gmail.com>
Signed-off-by: mposolda <mposolda@gmail.com>
There was a problem hiding this comment.
Hello @mposolda - Thank you for the PR. I'm excited about this flow getting merged. I hope the ongoing discussion with @tdiesler on the topic will soon reach a consensus.
I tested the flow locally and confirm all works as expected.
I reviewed the changes and left some minor comments. Please could you check?
| * @return Credential offer as URI, which can be shared with the wallet | ||
| */ | ||
| public static String getOfferAsUri(KeycloakSession session, String nonce) { | ||
| String encodedOfferUri = URLEncoder.encode(OID4VCIssuerWellKnownProvider.getIssuer(session.getContext()) + "/protocol/" + OID4VCLoginProtocolFactory.PROTOCOL_ID + "/" + CREDENTIAL_OFFER_PATH + "/" + nonce, StandardCharsets.UTF_8); |
There was a problem hiding this comment.
Use KeycloakUrlBuilder?
| // Fallback | ||
| display = clientScope.getAttribute(CONFIGURATION_ID); |
There was a problem hiding this comment.
I suggest to always access these attributes via the CredentialScopeModel. For many of the available attributes, the wrapper provides defaults that we should use consistently.
| @FindBy(id = "continueVCOffer") | ||
| private WebElement continueButton; |
There was a problem hiding this comment.
For consistency?
| @FindBy(id = "continueVCOffer") | |
| private WebElement continueButton; | |
| @FindBy(id = "continue-vc-offer") | |
| private WebElement continueButton; |
| @@ -519,6 +519,12 @@ passkey-doAuthenticate=Sign in with Passkey | |||
| passkey-createdAt-label=Created | |||
| passkey-autofill-select=Select your passkey | |||
|
|
|||
| # OID4VCI | |||
| credentialOfferTitle=Claim your {0} | |||
| credentialOfferStep1=Claim your {0} by scanning the following QR code to your digital wallet in case that wallet is on different device. Alternatively open the Offer URL directly if your digital wallet is available on this device. | |||
There was a problem hiding this comment.
| credentialOfferStep1=Claim your {0} by scanning the following QR code to your digital wallet in case that wallet is on different device. Alternatively open the Offer URL directly if your digital wallet is available on this device. | |
| credentialOfferStep1=Claim your {0} by scanning the following QR code with your digital wallet in case it is on a different device. Alternatively, open the Offer URL directly if your digital wallet is available on this device. |
| <input type="submit" | ||
| class="${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonLargeClass!}" | ||
| id="continueVCOffer" value="${msg("doContinue")}" | ||
| /> | ||
| <button type="submit" | ||
| class="${properties.kcButtonClass!} ${properties.kcButtonDefaultClass!} ${properties.kcButtonLargeClass!} ${properties.kcButtonLargeClass!}" | ||
| id="cancelVCOffer" name="cancel-aia" value="true">${msg("doCancel")} | ||
| </button> |
There was a problem hiding this comment.
There was a problem hiding this comment.
Yes, it is comparable with other screens. Application actually has a way to figure if user cancelled the action as there is parameter kc_action_status=cancelled added to the redirect URI once user is redirected back to the application. This is documented in https://www.keycloak.org/docs/latest/server_admin/index.html#con-aia_server_administration_guide . So there is a way how to handle on the application side whether the "continue" or "cancel" button was pressed and display some message to the user according to which button he pressed.
However it is the question how much is usability gain as user usually knows whether he "submitted" or "cancelled" the action. For example, the built-in Keycloak account console currently doesn't have support for the kc_action_status parameter. For example when you "Update password" from the Keycloak account console and then you click "Cancel" on the page where user is updating his password, you are redirected back to the account console and UX looks the same (regardless of whether user updated his password by click "Submit" or whether he click "Cancel").
There was a problem hiding this comment.
That the app is informed of what action was taken changes everything. Thanks 👍
|
IMHO, we need to have support for |
@tdiesler Yes, I agree it should work with @IngridPuppet Thanks for the review and feedback! Will update the PR soon based on your comments. Will also need to rebase with Keycloak main (once "part 5 PR mentioned above is done), add support for |
afe0b8c to
df7d943
Compare
…rtal application and credential-offer displayed on Keycloak closes keycloak#46196 Signed-off-by: mposolda <mposolda@gmail.com>
…Code grant with OID4VCActionTest Signed-off-by: mposolda <mposolda@gmail.com>
df7d943 to
16c01af
Compare
|
@IngridPuppet Do you please have an opportunity to re-review? I've tried to incorporate and answer your comments. Updated the PR. The first PR is pretty much rebase on top of latest Keycloak main (as of today). The updates in the 2nd PR are especially:
|
There was a problem hiding this comment.
Thank you for the update. The PR looks good to me.
|
@IngridPuppet Thanks! |
keycloak#46327) closes keycloak#46196 Signed-off-by: mposolda <mposolda@gmail.com>
…rtal application and credential-offer displayed on Keycloak
closes #46196
PR for the flow described in the #46196 . Similar to what I've presented on OAuth SIG meeting on Feb 4 with the different that it is user self-initiated flow.
The initial OIDC authentication request sent from some "portal application" contains
kc_actionparameter (KC parameter used for application-initiated actions ). Thekc_actionparameter has format likeverifiable_credential_offer:eyJjcmVkZW50aWFsX2NvbmZpZ3VyYXRpb25faWQiOiJzZC1qd3QtY3JlZGVudGlhbC1jb25maWctaWQiLCJjbGllbnRfaWQiOiJ0ZXN0LWFwcCIsInByZV9hdXRob3JpemVkIjp0cnVlfQ. The first partverifiable_credential_offerdenotes the name of AIA. The parameter after:is the Base64-encoded value of the details, which should credential-offer has. In this case, it is something like{"credential_configuration_id":"sd-jwt-credential-config-id","client_id":"test-app","pre_authorized":true}So far, parameters like
credential_configuration_id,pre_authorizedandclient_idare supported. Those are same names like credential-offer creation endpoint is using (OID4VCIssuerEndpoint.getCredentialOfferURI)As a follow-up, this might be further improved, so that "dataholder / portal" application does not need to use Base64 with all the parameters, but can somehow reference the "configuration template", which would point to some pre-defined configuration on KC side. Also we might have built-in support for
scopeparameter, which could do this (Similar to what @Captain-P-Goldfish showed the demo on last OAuth SIG meeting), but that would be also a follow-up (not 100% sure if it could be supported OOTB or with custom authenticator, which would emulate addingkc_actionwith appropriate configuration to current request based on the value ofscopeparameter).