Repository navigation
Replies: 2 comments
|
8000 Hi, I'm from fintech IT firm and I’ve come across your experience with Keycloak through some of your posts, and I was wondering if you could help us by sharing quick feedback from teams using Keycloak (SSO/IAM, etc.). We’re aiming to understand real-world pain points and feature needs. The survey is anonymous and takes less than five minutes to complete. Your input would really help us shape better enterprise solutions. 👉 Please find the survey here: Would it be possible for you to share this with your groups as well, so we can gather more responses? Thanks a lot! 😊 |
|
Found a workaround using infinispan with persistence. Added <infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:15.0 http://www.infinispan.org/schemas/infinispan-config-15.0.xsd"
xmlns="urn:infinispan:config:15.0">
<cache-container name="keycloak">
<transport lock-timeout="60000"/>
<local-cache name="keycloak-attributes">
<remote-store xmlns="urn:infinispan:config:store:remote:15.0"
cache="keycloak-attributes"
purge="false"
preload="false"
segmented="false"
shared="true"
raw-values="true">
<remote-server host="${env.KC_CACHE_REMOTE_HOST:my.infinispan.host}"
port="${env.KC_CACHE_REMOTE_PORT:11222}" />
<security>
<authentication>
<digest username="${env.KC_CACHE_REMOTE_USERNAME:keycloak}"
password="${env.KC_CACHE_REMOTE_PASSWORD:password}"
realm="default" />
</authentication>
</security>
</remote-store>
</local-cache>
</cache-container>
</infinispan>Set the flags for the remote cache: KC_CACHE : ispn
KC_CACHE_CONFIG_FILE : cache/cache-ispn.xml
KC_CACHE_REMOTE_HOST : my.infinispan.host
KC_CACHE_REMOTE_PASSWORD : ...
KC_CACHE_REMOTE_PORT : 11222
KC_CACHE_REMOTE_TLS_ENABLED : false
KC_CACHE_REMOTE_USERNAME : keycloakAnd invoked the cache in the mapper: var InfinispanConnectionProvider = Java.type('org.keycloak.connections.infinispan.InfinispanConnectionProvider');
var provider = keycloakSession.getProvider(InfinispanConnectionProvider.class);
var cache = provider.getCache('keycloak-attributes')
var assertion = cache.get(jti);
// ... if not found, search in POST params or query params, etc...
if (!assertion) {
return null;
}
cache.put(jti, assertion);Which worked. However, I am still not sure about if this is a good solution. For example, I am not sure about |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
We plan to use the "lightweight access token" feature, and use Token Introspection to fetch all the claims.
However, before we did this, I tested the Token Introspection without an "lightweight access token" and found a weird behavior where the given JWT and claims from the introspection doesn't reflect the access token claims at issuance.
The setup is the following:
In our use-case, we want the claim
embed_contextfrom the assertion JWT to be mapped to the access token. Since the JWT Authorization Grant Identity Provider doesn't have any mapper to map claims from the assertion JWT to the access token, we did a JS Custom Protocol Mapper, which looks like this:embed-context-mapper.js (click me)
Basically, it fetches the
assertionin the request parameter, which is given during JWT Authorization Grant, parse the JWT, fetch theembed_contextclaim and put it in the access token usingexports = ....The mapper DOES work at the access token issuance (POST /protocol/openid-connect/token). But the introspection doesn't (POST /protocol/openid-connect/token/introspect).
Here's a demo:
example.py (click me)
The results is something like this (prettyfied):
(
tenant_idcomes from an hardcoded claim mapper from theembedscope).As you can see, the JWT given from the introspection is not the same from the issuance and is missing the
embed_contextclaim. Based on the logs I suspect the mapper is re-executed at introspection (I think?), which doesn't have theassertionparameter in thehttpRequestobject.Is there a way to persist the claims mapped when the access token is issued, so that they can be sent back during introspection? Or do I need to use some kind of external storage to properly map the claim?
If there is no way, can I request for such feature (being able to store properties per access token)?
I tried to store the claims in notes in
userSession,keycloakSessiongetContext().getAuthenticationSession(), and define claims intoken(global variable ID Token in JS Protocol Mapper) ortokenResponse, but without success, probably because a Client Credentials authentication doesn't create any session.All reactions