in.hocg.sso.server.sample.UserDetailsServiceImpl Maven / Gradle / Ivy
package in.hocg.sso.server.sample;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* Created by hocgin on 2020/1/9.
* email: [email protected]
*
* @author hocgin
*/
@Component
public class UserDetailsServiceImpl implements org.springframework.security.core.userdetails.UserDetailsService {
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
List roles = List.of(new SimpleGrantedAuthority("ROLE_HAS"));
return new User(username, "{noop}hocgin", roles);
}
}