Replies: 3 comments 3 replies
-
|
+1 to have some "single point" in the Java code to create credential-offers as we would have more places from where the credential offers would be created (AIA , email sent by admin , REST endpoint you pointed). Maybe In regards to policies: It doesn't work if every Keycloak feature introduces it's own "policies" for various things. Instead, it is preferred to align with existing Keycloak features and capabilities. Keycloak has concept of client policies - those are in general used to enforce various things for multiple clients (or eventually for whole realm). The OID4VCI endpoints (including credential-offer creation) should be integrated with client policies instead of introducing it's own "policy framework" . I can see that client policies would allow ways like for example specify that pre-authorized grant is disabled for certain requests (or for whole realm). Or for example that "transaction code" is always required when pre-authorized grant is used. We can have dedicated client policy executors/conditions for those. Also Keycloak has concept of fine-grained admin permissions . This allows to specify that for example some administrator can manage (or create credential permission) for user It seems that endpoint for I am not seeing how "credential policies" would fit into this. If you prefer, I think it is OK if those policies are used as "internal thing", which is handled inside code, but it is primarily managed by some other settings and not directly exposed externally. For example for the first option for For the |
Beta Was this translation helpful? Give feedback.
-
|
For a quick recap ... the Client is the "application" that a user connects to when requesting a credential. A credential is defined in the issuer metadata by a For example: The University Realm has a Client for the Biology and another one for the Engineering Department. Each department can issue their distinct set of credentials and there may also be credentials issued by both Departments (e.g. Calculus, Statistics) Keycloak already has support for Client Policies. There is currently no such thing as "Client Scope Policies". Available is ... Lets consider the minimal set of policies from above
What effect would it have to define these policies on the ClientWithout further distinction, all credential types (a.k.a. scopes, credential_configuration_id) would be subject to the same set of Client Policies. For example, all credentials issued by the Biology Department would require a credential offer - the same credential from the Engineering Department would perhaps not require an offer. What effect would it have to define these policies on the Client ScopeWithout further distinction, a given credential type would be subject to a defined set of policies - regardless which Client is the issuer. For example, the Statistics Credential would require a credential offer no matter which Department it is offered by. Simple Client Scope Policies can be implemented using Client Scope attributes. Can Client Policies be applied in combination with Client Scope PoliciesYes, Client Policies can be defined/applied independent of Client Scope Policies. In other words, adopting #46262 would not preclude policy decisions that can already be defined on the Client (see Executor) Opinionated ConclusionI personally believe that there is merit in defining simple policies like |
Beta Was this translation helpful? Give feedback.
-
|
@mposolda @tdiesler I believe there is meaningful value in introducing VC policies. OID4VCI/Verifiable Credentials are not a typical small feature in Keycloak, this was one of the reasons previously mentioned for not promoting it in the same way as other features.. Given that OID4VCI will remain in the experimental phase for the next four months, this seems like a good opportunity to trial/experiment VC policies, better understand how they work in practice, and evaluate the value they bring. As @babisRoutis mentioned in the email, there are use cases where the Pre-authorized Code grant is only allowed (issuing PID) when issuance mandates the physical presence of the holder at an issuing desk. This further highlights the need to think carefully about policy controls. That said, I think it is important to gather broader feedback from the SIG. I suggest we put this proposal to a vote at the next SIG meeting, and ideally aim for lazy consensus if there are no strong objections. @Awambeng @babisRoutis @Ogenbertrand @Captain-P-Goldfish @forkimenjeckayang @thomasdarimont @francis-pouatcha @wistefan @IngridPuppet @tnorimat @pulsastrix I kindly request that you review the proposal ahead of the SIG meeting, if possible, and share any feedback or concerns you may have. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In this discussion, I introduce a new CredentialOfferProvider and how it enforces CredentialPolicies
Issue: #46262
Related: #46396 #46200
Lets first quickly summarize what the spec says about Credential Offers.
The basic assumption is, that the Issuer creates a Credential Offer and then passes it to the Wallet. This can be done
by
credential_offer_uri, by qr-code (for cross device flows), by a Wallet providedcredential_offer_endpointor by some other means (e.g. email, messaging, etc.).
The spec does not detail how to request a Credential Offer from an Issuer. In Keycloak, we provide an
/create-credential-offerendpoint that requires various access privileges depending on the offer that is to be created. Other means to create a Credential Offer may exist in the Admin Console.Depending on Credential Offer Policies for a given
credential_configuration_idand Issuing User, these requiredprivileges may be permissible enough to allow for a "self-issued" Credential Offer.
A Credential Offer contains a set of
credential_configuration_ids, which the Wallet can use to request a Credential as defined in the Issuer metadataCredential Offers come in two variants
authorization_codegrantpre-authorized_codegrantAuthorization Code Grant
With the
authorization_codegrant, the Wallet can send an Authorization Request that references one of thecredential_configuration_idsinauthorization_details. Part of theauthorization_codegrantis also some opaque
issuer_statethat the Wallet must include in the Authorization Request. This allows theIssuer to correlate the Authorization Request with a previously made Credential Offer.
The Wallet may also send an Authorization Request with a
scopeparameter and noauthorization_detailsnor
issuer_state. This by-passes the Credential Offer process completely - the Authorization Server maystill return an Authorization Code, which can then be used in an AccessToken request and ultimately grants access
to Credentials associated with that
scope.Whether the Authorization Server grants access or the Credential Endpoint actually returns the wanted Credential again
depends on the effective Credential Policies. These may require an existing Credential Offer for a given
credential_configuration_idand hence prevent such a Credential Request on scope alone.Pre-Authorized Code Grant
As the name suggests, this is a "pre-authorized" grant that the Wallet can use directly in an AccessToken Request. No
further authorization is required on part of the Wallet. It works for cases where the Wallet cannot be expected to use
an
authorization_codegrant. Since this is bearer grant that gives direct access to the Credentials referencedby
credential_configuration_ids, the party that creates such a Credential Offer must take upmost care abouthow to communicate that "pre-authorized" grant. As a second authorization factor, the Issuer can create a
tx_codetogether with the Credential Offer. The
tx_codeis to be communicated via an alternative channel (i.e. not together with the pre-authorized code).As noted above, we have a
/create-credential-offeras the primary entry point to initiate Credential Offer creation. This endpoint now delegates to the new CredentialOfferProvider to the actual creation of the internal CredentialOfferState. This an immutable instance that represents the CredentialOffer. It also holds theauthorization_detailsthat become part of the AccessToken response and the AccessToken JWT.Using CredentialOfferProvider as the single access point for CredentialOfferState is important. It can reason about whether an Issuing User actually has the required privileges to make the required offer.
Currently we enforce these general rules ...
credential_configuration_idmust existtargetUsermust exist and be enabledtargetUseris given, the Issuing User must hold thecredential_offer_createrole... these rules for
authorization_codegranttargetUseris not given - it is an "Anonymous" offer not bound to a specific target user... and these rules for
pre-authorized_codegranttargetUseris not given - it is a self-issued credential offerAdditionally, we now support theses Credential Policies ...
vc.policy.offer.requiredcredential_configuration_idrequires a Credential Offervc.policy.offer.pre-auth.allowedpre-authorized_codegrant are allowedvc.policy.offer.tx-code.requiredpre-authorized_codegrant require atx_codeThese policies an be set as Client Scope Attribute values.
In future may want to integrate fine grained role access to also cover the
joecan offerfootoalicecase. For now however, these three Credential Policies should be sufficient to deliver a "minimal viable product" (i.e. for oid4vci preview).Secure-by-Default could mean ...
vc.policy.offer.required=truevc.policy.offer.pre-auth.allowed=falsevc.policy.offer.tx-code.required=trueBeta Was this translation helpful? Give feedback.
All reactions