package com.agendaestudantil.seguranca; import com.agendaestudantil.entidade.Estudante; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import java.util.Collection; import java.util.Collections; public class DetalhesUsuarioPersonalizado implements UserDetails { private final Estudante estudante; public DetalhesUsuarioPersonalizado(Estudante estudante) { this.estudante = estudante; } @Override public Collection getAuthorities() { return Collections.singleton(new SimpleGrantedAuthority("ROLE_USER")); } @Override public String getPassword() { return estudante.getSenha(); } @Override public String getUsername() { return estudante.getId(); } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }