Repository navigation
Replies: 2 comments
|
There's a helper for exactly this in KeycloakModelUtils.suspendJtaTransaction(session.getKeycloakSessionFactory(), () -> {
// your REST call here, no JTA transaction attached while it runs
});It suspends the current JTA transaction, runs your code, then resumes it (see To get the result into the token, store it on the auth session in your authenticator, e.g. I'd also put a short timeout on the HTTP client and maybe cache the response, since the login still waits on that call even though the transaction isn't held open anymore. |
|
For your load test, I'd check what stays open during the REST call before relying on In 26.8.1, that helper suspends the thread's JTA transaction, runs the callback, then resumes it in For the client-credentials part, you can pass the returned value through a custom context.getClientAuthAttributes().put("ext_data", value);Here Then configure a User Session Note mapper on the client, or a client scope effective for this request: read note Which Keycloak version are you running, and what fails first under load: the database pool, database lock waits, or outbound HTTP/request capacity? I checked these source paths in 26.8.1; I haven't reproduced your load test. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello,
We have a need to call external service during the authentication flow and add returned data into the token which is being created. However the problem is that this is currently running under the transaction inside
org.keycloak.authentication.Authenticatorand obviously when running performance tests it escalates quickly. Is there any mechanism how to have the external rest call outside of the transaction but then forward the requested data back to authenticator? We'd like to work it out for all types of authentication (browser, client, ...).Thanks in advance
All reactions