Class CustomUser

java.lang.Object
org.springframework.security.core.userdetails.User
org.craftercms.engine.util.spring.security.CustomUser
All Implemented Interfaces:
Serializable, org.springframework.security.core.CredentialsContainer, org.springframework.security.core.userdetails.UserDetails
Direct Known Subclasses:
ProfileUser

public class CustomUser extends org.springframework.security.core.userdetails.User
Extension of User that includes custom attributes for site personalization

Note: This class should be used by all authentication providers to integrate with features like targeting

Since:
3.1.5
Author:
joseross
See Also:
  • Nested Class Summary

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected Map<String,Object>
     
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
     
    <T> T
     
     
    int
     
    void
    setAttribute(String name, Object value)
     
    void
     
     

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

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

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • CustomUser

      public CustomUser(String username, String password, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
    • CustomUser

      public CustomUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
  • Method Details

    • getAttribute

      public <T> T getAttribute(String name)
    • setAttribute

      public void setAttribute(String name, Object value)
    • getAttributes

      public Map<String,Object> getAttributes()
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class org.springframework.security.core.userdetails.User
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.springframework.security.core.userdetails.User
    • toString

      public String toString()
      Overrides:
      toString in class org.springframework.security.core.userdetails.User