I'm trying to deploy a wicket-6 application into a kubernetes cluster in order to increase availability and distribute the load of the web application a bit better.
This is a stateful web application in the sense that I'm extending AuthenticatedWebSession. It's this session object that I would like to store in a distributed cache like Apache Ignite so that I don't need sticky session on my load balancer.
The issue is that my implementation has the AuthenticationManager injected into the AuthenticatedWebSession so the authManager can be used in the authenticate(username, password) method.
@SpringBean(name = "webAuthenticationManager")
private AuthenticationManager authManager;
@Override
public boolean authenticate(String username, String password) {
boolean authenticated = false;
try {
authentication = authManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));
authenticated = true;
} catch (AuthenticationException e) {
authenticated = false;
}
return authenticated;
}
Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to read field [name=authManager]
at org.apache.ignite.internal.binary.BinaryFieldAccessor.read(BinaryFieldAccessor.java:192)
at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:875)
The issue arrises when Ignite tries to serialise / deserialise the authManager field. I actually don't need the manager itself to be stored in the cache.
Is there a way to re-inject that object when the session is restored from the cache?
Maybe I'm handling this completely wrong. Kind feel like I'm going down a rabbit hole here :)