I'm transitioning for Spring to Quarkus and wanted to try to code a simple login/register backend. The registration part works perfectly, but I have no clue how I can manually log in the user. Using spring I just used to have an endpoint that received the username and the password:
public void login(HttpServletRequest req, String user, String pass) {
var authReq = new UsernamePasswordAuthenticationToken(user, pass);
var auth = authManager.authenticate(authReq);
var sc = SecurityContextHolder.getContext();
sc.setAuthentication(auth);
var session = req.getSession(true);
session.setAttribute(SPRING_SECURITY_CONTEXT_KEY, sc);
}
But with Quarkus there doesn't seem to be a way to do that. What am I supposed to do? What I have so far:
new AuthenticationBuilder().addUsername(username).addPassword(password).build().digest(AuthenticationDigest.forRepository());
But I have no clue how to continue
As far as I know, there is no implementation of session-based authentication (SBA) in Quarkus. In the official security documentation of the framework there are no references to SBA.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With