Hi
I have a strange problem with hazelcast cluster.
when logout RoutingContext.clearUser() is called in AuthHandle.authenticate then RoutingContext.reroute to restart the context is called but next it will still have the user assigned old value and it will go through the same cycle infinitely.
<code>
authProvider.authenticate(credentials, authResultHanlder -> {
if (routingContext.user() != null) { routingContext.session().destroy();
routingContext.removeCookie(SESSION_COOKIE_NAME);
routingContext.clearUser();
routingContext.reroute(routingContext.request().path()); // restart current Router. It will create new session
} else { // assign new user and
// authorize(...)
// routingContext.next
}
});
</code>
this code is executed inside MyAuthHandlerImpl handle method
in cluster mode, the reroute will cause this method to be called again but user will still be assigned, so it will go into infinite loops of calling.
while in normal mode, next call the user is gone and processing goes without any problem
for now to solve the problem I did this
routingContext.session().destroy();
routingContext.removeCookie(WebConfig.SESSION_COOKIE_NAME);
routingContext.clearUser();
if (routingContext.vertx()!=null && routingContext.vertx().isClustered()) { // checking routingContext.vertx()!=null is necessary for unit test
routingContext.response().putHeader("Refresh", "0").end();
} else {
routingContext.reroute(routingContext.request().path()); // restart current Router. It will create new session
}
but this is not ideal
any thoughts about this
thanks