Repository navigation
KEYCLOAK-16805 Client Policy : Support New Admin REST API (Implementation) - #7780
Conversation
Scope of this PRThis PR tries to realize External Interface - Admin REST API of the design document. However, this PR only covers part of it. The supported API by this PR are as follows.
The operations on each client profile and client policy described in the design document will be treated by other follow-up PR. |
Admin Console UIThe existing admin console UI for client policies will be treated by other follow-up PR relating to KEYCLOAK-14209 . As discussed in FAPI-SIG, we only support simple JSON editor for client policies and client profiles on the existing Admin Console. |
Default Built-in Client PoliciesThis PR supports the mechanism of default read-only built-in client profiles and policies. Those are enclosed in keycloak-service's jar file. However, the contents of these built-in client profiles/policies have not yet been determined. It will be determined and realized by other follow-up PR relating to KEYCLOAK-14208 Temporarily, this PR set the following built-in client profiles/policies. keycloak-default-client-profiles.json :
8000
div>
keycloak-default-client-policies.json : It means that keycloak rejects any client that does not use state or nonce parameter mentioned in KEYCLOAK-14206. However, this built-in client policy is disabled as default. |
Backward CompatibilityThe current keycloak has already supported client policies. Its implementation uses However, this PR's client policies implementation use pure JSON instead of The existing |
Resource, Representation, Model, Adapter, EntityUsually, keycloak's major concept is realized by resource, representation, model, adapter and entity. (e.g. realm, client, user) If we want to add a new concept to the realm, we may take the following formal way.
It is formal and rigid. Therefore we can take the following alternative way for using realm attribute on JPA.
This way can avoid adding and modifying schemas. In order to minimize the task we need to take, we can take the following alternative way for using realm attribute on Representation/Model/Adapter/JPA.
IMO, there is the one point that seems to be problem. For exporting/importing realm, the newly added concept (here, client policies and profiles) is set under "attributes" field and put onto String field as follows. It might be difficult to read/add/modify it in this style. To get around this issue, I can take the following alternative way for using realm attribute on Model/Adapter/JPA.
By doing them, the exporting/importing realm is represented as follow in the familiar style. There is the other reason why I took this way. Client profiles and policies are represented as JSON string at first. It is easy for the logic processing classes to treat client profiles and policies as POJO instead of JSON string. Therefore, I introduced representation as POJO for client profiles and policies JSON string. |
Realm Attribute Data Size in SchemaClient profiles and policies are persisted in realm attributes as JSON string. However, I'm not sure what is the appropriate size for realm attribute. This PR specifies 65535 bytes but I do not have confidence that 65535 bytes is appropriate. |
Condition/Executor ConfigurationThe current keycloak realizes condition/executor configuration by This PR makes conditions/executors hold its configuration by itself. The contents of this configuration itself is persisted on realm attribute schema and cached in Model layer. |
Client Policies Operation
|
650deb8 to
3837e22
Compare
Admin REST API Access ControlAs the same as other Admin REST API access, the following RBACs are imposed.
|
|
@mposolda I've revised code to remove unused codes and rename ambiguous classes. |
682d750 to
ba141d5
Compare
ba141d5 to
5a1c01b
Compare
|
@mposolda |
There was a problem hiding this comment.
@tnorimat Thanks a lot for the PR! And sorry for the delay in the review.
I've added some comments inline. Few points:
- I've did some changes directly on this PR and introduced my branch with some changes https://github.com/mposolda/keycloak/commits/KEYCLOAK-16805-client-policies-db-change . See the comments inline for the details.
- In general, I suggest to throw the errors in case of REST updates with the invalid JSON (or referencing name of invalid executor providers or invalid configuration options etc) instead of just print the WARNING. Added some comments inline regarding this, but in this PR, there are more such places (not just those, which I've referenced)
- We may need to update old admin console due the fact that new admin console probably won't be ready for RHSSO 7.5. However I suggest to do that as a follow-up PR to not block this PR anymore. Just a note to let you know.
|
@tnorimat Do you have the time to work on this in next days/weeks? I suppose it can be nice to have this PR sorted ASAP to have it available in Keycloak 13, so we are able to align the OIDC conformance testsuite inside the FAPI repo https://github.com/keycloak/kc-sig-fapi with the new format of client policies for Keycloak 13 once it is released. WDYT? I will be out from tomorrow (Thursday Apirl 1), but will return on Tuesday 6th April. I should have more time to help on the FAPI more actively from now on. If you don't need the help with this, perhaps I can maybe look at the admin console changes for new format of client policies? |
|
@mposolda Yes, it might be preferable for this PR to be in high priority in order to catch keycloak 13. I've already resolved almost all points you've commented except for quarkus related points. I will push additional commits that resolves all point's you've commented before you return. Hopefully you could review them ASAP after you return. And as you've pointed out, we need to revise the FAPI conformance test settings after this PR being merged. I've already cleared the new Admin REST API version's client policies settings for FAPI conformance test. I'll revise FAPI-SIG's repository to do so after this PR is merged. For the existing Admin Console UI support for client policies, I will also try to do it. However, if you have spare time to do it, it is happy for me if you would work on it. IMO, all we need to do it add JSON editor to admin console for each entire profiles and policies. |
|
@mposolda I've resolved all points of your review comments we've discussed. Could you please check them? |
There was a problem hiding this comment.
@tnorimat Thanks for all your work on this!
+1 for update the FAPI repository with the new client policies. But I guess that we will probably need to wait until Keycloak 13 release until this is available in the released version of Keycloak, before we update the https://github.com/keycloak/kc-sig-fapi repository?
Regarding the admin console UI, I have some work for this week, but hopefully should be able to start on it on Thursday this week. Maybe we can sync on Thursday whoever from us can look into it based on who has time for it?
|
@mposolda Yes, we will discuss it on Thursday or later. If you do not have spare time to do it, I could work on supporting existing Admin Console UI. The following FAPI 1.0 advanced final version support related JIRA tickets might be started due to this PR being merged.
I will start working on them. For the conformance test run environment, as you stated, we will wait for the keycloak 13 release. After that, I will update this test run environment. I've already run the FAPI conformance tests against the latest keycloak locally built incorporating this PR and found that it could pass all tests. |
|
@tnorimat Cool, I've started some work on the old admin console. I hope to share something soon for the feedback. |
…tion) (keycloak#7780) * KEYCLOAK-16805 Client Policy : Support New Admin REST API (Implementation) * support tests using auth-server-quarkus * Configuration changes for ClientPolicyExecutorProvider * Change VALUE of table REALM_ATTRIBUTES to NCLOB * add author tag * incorporate all review comments Co-authored-by: mposolda <mposolda@gmail.com>
This PR is for KEYCLOAK-13933 Client Policies, also is the part of the project Client Policy Official Support of FAPI-SIG activity.
The details can be found in its design document and KEYCLOAK-16805.