All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.lsn.spring.auth.authentication.strategy.SimpleUsernamePasswordAuthenticationStrategy Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy