Class CustomUserDetails

java.lang.Object
org.springframework.security.core.userdetails.User
com.is.findyourplace.controller.gestioneUtenza.CustomUserDetails
All Implemented Interfaces:
Serializable, org.springframework.security.core.CredentialsContainer, org.springframework.security.core.userdetails.UserDetails

public class CustomUserDetails extends org.springframework.security.core.userdetails.User
Gestisce la creazione di un Custom User in spring boot security.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.security.core.userdetails.User

    org.springframework.security.core.userdetails.User.UserBuilder
  • Constructor Summary

    Constructors
    Constructor
    Description
    CustomUserDetails(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
    Costruttore CustomUserDetails.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map Utente fields to UserDetails Authorities based on the isAdmin flag All users have the "USER" role, Admins have both "USER" and "ADMIN" roles.

    Methods inherited from class org.springframework.security.core.userdetails.User

    builder, equals, eraseCredentials, getAuthorities, getPassword, getUsername, hashCode, isAccountNonExpired, isAccountNonLocked, isCredentialsNonExpired, isEnabled, toString, withDefaultPasswordEncoder, withUserDetails, withUsername

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CustomUserDetails

      public CustomUserDetails(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
      Costruttore CustomUserDetails.
      Parameters:
      username - String - Username Utente
      password - String - Password Utente;
      enabled - boolean
      accountNonExpired - boolean
      credentialsNonExpired - boolean
      accountNonLocked - boolean
      authorities - Lista di ruoli personalizzati
  • Method Details

    • fromUtente

      public static CustomUserDetails fromUtente(Utente utente)
      Map Utente fields to UserDetails Authorities based on the isAdmin flag All users have the "USER" role, Admins have both "USER" and "ADMIN" roles.
      Parameters:
      utente - Utente
      Returns:
      CustomUserDetails con ruoli personalizzati