UserDetails without password(SpringBoot)

I have this code

public class ClienteSecurity implements UserDetails {

    private Long idCliente;
    private String numeroDocumento;
    private Date fechaNacimiento;
    private Date fechaExpedicion;
    private Date fechaCreacion;
    private String primerNombre;
    private String primerApellido;
    private String celular;
    private String credencialPrueba;
    private TiposDocumento tp;

    public ClienteSecurity() {
    }

    public Long getIdCliente() {
        return idCliente;
    }

    public void setIdCliente(Long idCliente) {
        this.idCliente = idCliente;
    }

    public String getNumeroDocumento() {
        return numeroDocumento;
    }

    public void setNumeroDocumento(String numeroDocumento) {
        this.numeroDocumento = numeroDocumento;
    }

    public Date getFechaNacimiento() {
        return fechaNacimiento;
    }

    public void setFechaNacimiento(Date fechaNacimiento) {
        this.fechaNacimiento = fechaNacimiento;
    }

    public Date getFechaExpedicion() {
        return fechaExpedicion;
    }

    public void setFechaExpedicion(Date fechaExpedicion) {
        this.fechaExpedicion = fechaExpedicion;
    }

    public Date getFechaCreacion() {
        return fechaCreacion;
    }

    public void setFechaCreacion(Date fechaCreacion) {
        this.fechaCreacion = fechaCreacion;
    }

    public String getPrimerNombre() {
        return primerNombre;
    }

    public void setPrimerNombre(String primerNombre) {
        this.primerNombre = primerNombre;
    }

    public String getPrimerApellido() {
        return primerApellido;
    }

    public void setPrimerApellido(String primerApellido) {
        this.primerApellido = primerApellido;
    }

    public String getCelular() {
        return celular;
    }

    public void setCelular(String celular) {
        this.celular = celular;
    }

    public String getCredencialPrueba() {
        return credencialPrueba;
    }

    public void setCredencialPrueba(String credencialPrueba) {
        this.credencialPrueba = credencialPrueba;
    }

    public TiposDocumento getTp() {
        return tp;
    }

    public void setTp(TiposDocumento tp) {
        this.tp = tp;
    }
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        Set<Authority> autoridades = new HashSet<>();
        return autoridades;
    }

    @Override
    public String getPassword() {
        throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
    }

    @Override
    public String getUsername() {
        return numeroDocumento;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

}

How can I implements correctly my userDetails without password, my model doesn't need a password and the credential to log in is "numeroDocumento" variable

I hope some way to remove the password from this code, but I do not understand how I can do this, can you explain me?

Upvotes: 2

Views: 189

Answers (0)

Related Questions