1
1
.
.
5
5
P
P
a
a
s
s
s
s
w
w
o
o
r
r
d
d
E
E
n
n
c
c
o
o
d
d
e
e
r
r
s
s
I
I
n
n
f
f
o
o
Password Encoders are also known as Hash Algorithms.
Password Encoders are used to store encoded Password into DB (to protect them if somebody gets access to DB).
When User wants to Login/Authenticate he will enter Raw Password.
Spring then needs to compare Entered Raw Password with Stored Encoded Password.
Comparison is done by using matches() Method to compare Passwords
taking Entered Raw Password
apply encoding algorithm
using matches() Method to compare result with Stored Encoded Password
Compare Passwords
if(passwordEncoder.matches(password, encodedPassword1)) { System.out.println("Passwords match"); }
else { System.out.println("Passwords don't match"); }