chore: revert debug logging after the auth issue was diagnosed
CI / Build Native (push) Successful in 6m24s
CI / Build Native (push) Successful in 6m24s
Found the actual issue was a stale Docker image in the LXC (the CI runner was stuck for ~30h starting at task 323 on Aug 14). The newly pulled image with all prior fixes (no @Authenticated, records w/ @RegisterForReflection, create-drop for tables) has been verified end-to-end: login returns 200, /me returns 200 with the user, change-password returns 200 after password validation. So we can drop the LOG statements and the SQL debug log without regressing anything.
This commit is contained in:
@@ -67,17 +67,9 @@ public class AuthService {
|
||||
@Transactional
|
||||
public Optional<User> authenticate(String username, String password) {
|
||||
if (username == null || password == null) return Optional.empty();
|
||||
String trimmed = username.trim();
|
||||
LOG.infof("authenticate: username=%s trimmed=%s pw.len=%d", trimmed, trimmed, password.length());
|
||||
User user = User.findByUsernameCaseInsensitive(trimmed);
|
||||
if (user == null) {
|
||||
LOG.warnf("authenticate: user '%s' NOT FOUND in DB", trimmed);
|
||||
return Optional.empty();
|
||||
}
|
||||
LOG.infof("authenticate: found user id=%s hash.len=%d hash.prefix=%s", user.id, user.passwordHash == null ? -1 : user.passwordHash.length(), user.passwordHash == null ? "null" : user.passwordHash.substring(0, Math.min(7, user.passwordHash.length())));
|
||||
boolean matches = BcryptUtil.matches(password, user.passwordHash);
|
||||
LOG.infof("authenticate: bcrypt.matches=%s for user=%s", matches, trimmed);
|
||||
if (!matches) return Optional.empty();
|
||||
User user = User.findByUsernameCaseInsensitive(username.trim());
|
||||
if (user == null) return Optional.empty();
|
||||
if (!BcryptUtil.matches(password, user.passwordHash)) return Optional.empty();
|
||||
user.lastLoginAt = Instant.now();
|
||||
user.persist();
|
||||
return Optional.of(user);
|
||||
|
||||
@@ -9,9 +9,7 @@ quarkus.datasource.jdbc.url=jdbc:h2:file:./data/shots;DB_CLOSE_DELAY=-1
|
||||
quarkus.datasource.username=sa
|
||||
quarkus.datasource.password=
|
||||
quarkus.hibernate-orm.database.generation=create-drop
|
||||
quarkus.hibernate-orm.log.sql=true
|
||||
quarkus.log.category."org.hibernate.SQL".level=DEBUG
|
||||
quarkus.log.category."com.l2.shots.auth".level=DEBUG
|
||||
quarkus.hibernate-orm.log.sql=false
|
||||
|
||||
# JWT
|
||||
mp.jwt.verify.issuer=shot-crafter-calculator
|
||||
|
||||
Reference in New Issue
Block a user