io.lsn.spring.auth.authentication.strategy.SimpleUsernamePasswordAuthenticationStrategy Maven / Gradle / Ivy
package io.lsn.spring.auth.authentication.strategy;
import io.lsn.spring.auth.PasswordEncoder;
import io.lsn.spring.auth.entity.User;
import org.springframework.stereotype.Component;
/**
* @author Patryk Szlagowski
*/
@Component
public class SimpleUsernamePasswordAuthenticationStrategy implements AuthenticationStrategy {
public static String NAME = "PASSWORD";
@Override
public boolean supports(String name) {
return SimpleUsernamePasswordAuthenticationStrategy.NAME.equals(name);
}
@Override
public boolean authenticate(User user, String password) {
return PasswordEncoder.match(password, user);
}
}