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 Details

    • User

      public User()
  • Method Details

    • addAllergy

      public void addAllergy(Allergy allergy)
      adds an allergy to the user
      Parameters:
      allergy - the allergy to add to the user
    • deleteAllergy

      public boolean deleteAllergy(Allergy allergy)
      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

      public void addRecipe(Recipe recipe)
      adds a recipe to the user
      Parameters:
      recipe - the recipe to add to the user
    • addGroup

      public void addGroup(UserGroupAsso userGroupTable)
      adds a group to the user
      Parameters:
      userGroupTable - the userGroupTable to add to the user
    • getAuthorities

      public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
      used when created jwts and validating user authority
      Specified by:
      getAuthorities in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      the users authority
    • getPassword

      public String getPassword()
      getter for the user password used in userdetails service
      Specified by:
      getPassword in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      the users password
    • getUsername

      public String getUsername()
      getter for the user username used in userdetails service
      Specified by:
      getUsername in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      the users username
    • isAccountNonExpired

      public boolean isAccountNonExpired()
      not used
      Specified by:
      isAccountNonExpired in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the account is not expired
    • isAccountNonLocked

      public boolean isAccountNonLocked()
      not used
      Specified by:
      isAccountNonLocked in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the account is not locked
    • isCredentialsNonExpired

      public boolean isCredentialsNonExpired()
      not used
      Specified by:
      isCredentialsNonExpired in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the credentials are not expired
    • isEnabled

      public boolean isEnabled()
      used in authentication
      Specified by:
      isEnabled in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user is enabled
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object