Repository navigation
OpenId Federation OP back end - #41419
cgeorgilakis wants to merge 3 commits into
Conversation
|
Information for testing this PR.
After you could execute the request : For jwt you could use the signed JWT Federation Entity Configuration of our OpenID Federation RP signed JWT Entity Configuration, enrolled in the mentioned Trust Anchor (https://trust-anchor.sandbox.eosc.grnet.gr). This Trust Anchor is a docker deployment of an Trust Anchor implementation (see lighthouse deployment instructions. After successfully request, an OIDC Client will be created, with only the difference that it will contain the attribute
|
|
I want here to mention that our proposed implementation is based on EntityStatement which is the default body parameter described in the specification (see chapters 12.2 and 10, appendix A.3.2). |
431a482 to
b107ae6
Compare
There was a problem hiding this comment.
I didn't review the business logic as it is not my area of expertise. Added some suggestions here and there.
Related to Infinispan, I suspect the TaskCancellationEvent is broken when running in a clustered environment.
c63cc6e to
7ab9481
Compare
|
I have made the following changes:
|
There was a problem hiding this comment.
It looks good to me from the Infinispan perspective. I notice some warning reports from IntelliJ during code analysis.
| try { | ||
| statement = trustChainProcessor.parseAndValidateSelfSigned(body); | ||
| } catch (InvalidTrustChainException ex) { | ||
| ex.printStackTrace(); |
There was a problem hiding this comment.
Don't print the stack trace to System.out. Log an error message.
| } | ||
| } | ||
| } catch (Exception ex) { | ||
| ex.printStackTrace(); |
| jwtProcessor.process(token, null); | ||
|
|
||
| } catch(IOException | ParseException | BadJOSEException | JOSEException ex) { | ||
| ex.printStackTrace(); |
| private AdminPermissionEvaluator auth; | ||
| private AdminEventBuilder adminEvent; |
| } | ||
|
|
||
| private ConfigurableJWTProcessor<SecurityContext> produceJwtProcessor(JSONWebKeySet jwks) throws IOException, ParseException { | ||
| String jsonKey = om.writeValueAsString(jwks); |
There was a problem hiding this comment.
I'm unsure but I think you can remove om static field and use
| String jsonKey = om.writeValueAsString(jwks); | |
| String jsonKey = JsonSerialization.mapper.writeValueAsString(jwks); |
There was a problem hiding this comment.
I could use JsonSerialization similar methods. I have removed om ObjectMapper.
| package org.keycloak.models; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.ArrayList; |
| @@ -54,6 +56,7 @@ | |||
| import org.keycloak.storage.UserStorageUtil; | |||
| import org.keycloak.storage.client.ClientStorageProvider; | |||
|
|
|||
| import java.util.ArrayList; | |||
| @@ -33,6 +33,8 @@ | |||
| import jakarta.persistence.NamedQuery; | |||
| import jakarta.persistence.OneToMany; | |||
| import jakarta.persistence.Table; | |||
|
|
|||
| import java.util.ArrayList; | |||
| @@ -17,13 +17,15 @@ | |||
|
|
|||
| package org.keycloak.models; | |||
|
|
|||
| import java.util.ArrayList; | |||
| } catch (IllegalArgumentException e) { | ||
| return null; | ||
| } | ||
| } else if (alg instanceof String string) { |
There was a problem hiding this comment.
Intellij reports alg instanceof String string is always false. If so, it can be removed.
4c1401f to
a93b5a2
Compare
I have made the requested changes. See my extra comment. |
Closes keycloak#40511 Signed-off-by: cgeorgilakis-grnet <cgeorgilakis@admin.grnet.gr>
54f4346 to
1937821
Compare
| public void setOpenIdFederationList(List<OpenIdFederationEntity> openIdFederationList) { | ||
| this.openIdFederationList.clear(); | ||
| if (openIdFederationList != null && !openIdFederationList.isEmpty()) { | ||
| this.openIdFederationList.addAll(openIdFederationList); |
There was a problem hiding this comment.
With my test code for Automatic Client Registration, an exception below is thrown here.
java.lang.UnsupportedOperationException
at java.base/java.util.ImmutableCollections.uoe(ImmutableCollections.java:142)
at java.base/java.util.ImmutableCollections$AbstractImmutableCollection.addAll(ImmutableCollections.java:148)
at org.hibernate.collection.spi.PersistentBag.addAll(PersistentBag.java:435)
at org.keycloak.models.jpa.entities.RealmEntity.setOpenIdFederationList(RealmEntity.java:619)
at org.keycloak.models.jpa.RealmAdapter.setOpenIdFederationGeneralConfig(RealmAdapter.java:1178)
One of the way for you to fix that is the modification of line 153
List<OpenIdFederationEntity> openIdFederationList = List.of();
to
List<OpenIdFederationEntity> openIdFederationList = new ArrayList<>();
There was a problem hiding this comment.
You are right. I have fixed it.
|
PR is closed, as it is old and we are reviewing our code with LLM for security fixes. |
Closes #40511
This is the initial PR for supporting OpenID Federation with Keycloak being an OP and explicit registration, accepting only Entity Statement. Ui will be a separate PR, documentation will be enhanced based on it. Some code parts are taken from the OpenID Federation extensions, taking into account that we are in core Keycloak, needed bug fixes and code improvements , compliant with latest OpenID Federation specification version.
Some key points for the PR:
For more opened issues related to explicit client registration in an OP, you could see the epic issues.