KEYCLOAK-2577 Rollback session in KeycloakSessionServletFilter if not committed by KeycloakTransactionCommitter
This commit is contained in:
parent
402feb9710
commit
2edb7f6831
1 changed files with 6 additions and 0 deletions
|
@ -77,6 +77,12 @@ public class KeycloakSessionServletFilter implements Filter {
|
||||||
try {
|
try {
|
||||||
filterChain.doFilter(servletRequest, servletResponse);
|
filterChain.doFilter(servletRequest, servletResponse);
|
||||||
} finally {
|
} finally {
|
||||||
|
// KeycloakTransactionCommitter is responsible for committing the transaction, but if an exception is thrown it's not invoked and transaction
|
||||||
|
// should be rolled back
|
||||||
|
if (session.getTransaction() != null && session.getTransaction().isActive()) {
|
||||||
|
session.getTransaction().rollback();
|
||||||
|
}
|
||||||
|
|
||||||
session.close();
|
session.close();
|
||||||
ResteasyProviderFactory.clearContextData();
|
ResteasyProviderFactory.clearContextData();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue