Class User
java.lang.Object
ntnu.idatt2016.v233.SmartMat.entity.user.User
- All Implemented Interfaces:
Serializable
,org.springframework.security.core.userdetails.UserDetails
@Entity(name="users")
public class User
extends Object
implements org.springframework.security.core.userdetails.UserDetails
User is a class representing a user in the system.
It implements the UserDetails interface.
- Version:
- 2.0.3
- Author:
- Anders, Birk, Pedro
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllergy
(Allergy allergy) adds an allergy to the uservoid
addGroup
(UserGroupAsso userGroupTable) adds a group to the uservoid
adds a recipe to the userboolean
deleteAllergy
(Allergy allergy) Deletes the specified allergy from this user's list of allergies.boolean
Collection<? extends org.springframework.security.core.GrantedAuthority>
used when created jwts and validating user authoritygetter for the user password used in userdetails servicegetter for the user username used in userdetails serviceint
hashCode()
boolean
not usedboolean
not usedboolean
not usedboolean
used in authentication
-
Constructor Details
-
User
public User()
-
-
Method Details
-
addAllergy
adds an allergy to the user- Parameters:
allergy
- the allergy to add to the user
-
deleteAllergy
Deletes the specified allergy from this user's list of allergies.- Parameters:
allergy
- the allergy to delete- Returns:
- true if the allergy was successfully deleted, false otherwise
-
addRecipe
adds a recipe to the user- Parameters:
recipe
- the recipe to add to the user
-
addGroup
adds a group to the user- Parameters:
userGroupTable
- the userGroupTable to add to the user
-
getAuthorities
used when created jwts and validating user authority- Specified by:
getAuthorities
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the users authority
-
getPassword
getter for the user password used in userdetails service- Specified by:
getPassword
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the users password
-
getUsername
getter for the user username used in userdetails service- Specified by:
getUsername
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the users username
-
isAccountNonExpired
public boolean isAccountNonExpired()not used- Specified by:
isAccountNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the account is not expired
-
isAccountNonLocked
public boolean isAccountNonLocked()not used- Specified by:
isAccountNonLocked
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the account is not locked
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()not used- Specified by:
isCredentialsNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the credentials are not expired
-
isEnabled
public boolean isEnabled()used in authentication- Specified by:
isEnabled
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the user is enabled
-
equals
-
hashCode
public int hashCode()
-