Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

How do we Validate a User? #676

Answered by knjk04
ZackHollander asked this question in Q&A
Apr 14, 2021 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

The bearer token validation should work. I think you're trying to check whether the encoded password stored for the user matches the cleartext (unencrypted) password passed in, which is different

        if (userService.getCurrentUser().getPassword().equals(passwordEncoder.encode(password))) {

If we look at the method description for encode() in the Spring documentation, we can see the following:

Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or greater hash combined with an 8-byte or greater randomly generated salt.

In particular, note that the BCryptPasswordEncoder also uses a randomly generated salt (emphasis mine). As we don't want know what the salt i…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@knjk04
Comment options

@knjk04
Comment options

@ZackHollander
Comment options

@knjk04
Comment options

Answer selected by knjk04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants