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
ConstructorsConstructorDescriptionCustomUserDetails(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 TypeMethodDescriptionstatic CustomUserDetailsfromUtente(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.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
-
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 Utentepassword- String - Password Utente;enabled- booleanaccountNonExpired- booleancredentialsNonExpired- booleanaccountNonLocked- booleanauthorities- Lista di ruoli personalizzati
-
-
Method Details
-
fromUtente
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
-