Currently the user federation instances are not maintained by the Keycloak session so they're not always closed. This is not strictly a bug as it was intended to be like this. We'll probably improve this in the future and have instances managed by the Keycloak session so there's only one per session/request and it's closed when the session is closed. We're currently discussing how to do this. In the mean time enlistForClose should work.

On 29 June 2016 at 23:21, Brian Watson <> wrote:
Would I be correct in thinking that I should call "session.enlistForClose(provider)" in the getInstance() method of my factory to ensure close() is called?

keycloak-dev mailing list