Auties01
Auties01

Reputation: 54

Manually log in user using 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

Upvotes: 3

Views: 1780

Answers (1)

CFV
CFV

Reputation: 792

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.

Upvotes: 2

Related Questions