class PasswordAuthenticationMethod implements AuthenticationMethod {

    public static final String NAME = "password";
    private final Roles roles;

    PasswordAuthenticationMethod(Roles roles) {
        this.roles = roles;
    }

    @Nullable
    @Override
    public Role authenticate(Credentials credentials, ConnectionProperties connProperties) {<FILL_FUNCTION_BODY>}

    @Override
    public String name() {
        return NAME;
    }
}

        var username = credentials.username();
        var password = credentials.password();
        assert username != null : "User name must be not null on password authentication method";
        Role user = roles.findUser(username);
        if (user != null && password != null && !password.isEmpty()) {
            SecureHash secureHash = user.password();
            if (secureHash != null && secureHash.verifyHash(password)) {
                return user;
            }
        }
        throw new RuntimeException("password authentication failed for user \"" + username + "\"");
    
<no_super_class>