Junior — Middle
Describe the approach you used to implement user verification in your last project.
sobes.tech AI
Answer from AI
In my last project for user verification, I used the following approach:
-
Authentication: implemented login and password verification using a database where passwords were stored as salted hashes (for example, using BCrypt).
-
Authorization: after successful authentication, a JWT token was issued to the user with specific access rights.
-
Data validation: before user verification, data was validated on the server side to prevent SQL injections and other vulnerabilities.
-
Security: used HTTPS to protect data transmission and limited login attempts to prevent brute-force attacks.
Example of password verification code in Java using BCrypt:
import org.mindrot.jbcrypt.BCrypt;
public boolean checkPassword(String candidate, String hashed) {
return BCrypt.checkpw(candidate, hashed);
}