Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manually log in user using Quarkus

Tags:

java

quarkus

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

like image 294
Auties01 Avatar asked Feb 04 '26 04:02

Auties01


1 Answers

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.

like image 106
CFV Avatar answered Feb 06 '26 18:02

CFV



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!