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
|
@Transactional
|
||||||
public Optional<User> authenticate(String username, String password) {
|
public Optional<User> authenticate(String username, String password) {
|
||||||
if (username == null || password == null) return Optional.empty();
|
if (username == null || password == null) return Optional.empty();
|
||||||
String trimmed = username.trim();
|
User user = User.findByUsernameCaseInsensitive(username.trim());
|
||||||
LOG.infof("authenticate: username=%s trimmed=%s pw.len=%d", trimmed, trimmed, password.length());
|
if (user == null) return Optional.empty();
|
||||||
User user = User.findByUsernameCaseInsensitive(trimmed);
|
if (!BcryptUtil.matches(password, user.passwordHash)) return Optional.empty();
|
||||||
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.lastLoginAt = Instant.now();
|
user.lastLoginAt = Instant.now();
|
||||||
user.persist();
|
user.persist();
|
||||||
return Optional.of(user);
|
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.username=sa
|
||||||
quarkus.datasource.password=
|
quarkus.datasource.password=
|
||||||
quarkus.hibernate-orm.database.generation=create-drop
|
quarkus.hibernate-orm.database.generation=create-drop
|
||||||
quarkus.hibernate-orm.log.sql=true
|
quarkus.hibernate-orm.log.sql=false
|
||||||
quarkus.log.category."org.hibernate.SQL".level=DEBUG
|
|
||||||
quarkus.log.category."com.l2.shots.auth".level=DEBUG
|
|
||||||
|
|
||||||
# JWT
|
# JWT
|
||||||
mp.jwt.verify.issuer=shot-crafter-calculator
|
mp.jwt.verify.issuer=shot-crafter-calculator
|
||||||
|
|||||||
Reference in New Issue
Block a user