Package org.openwms.core.uaa.impl
Class UserWrapper
java.lang.Object
org.openwms.core.uaa.impl.UserWrapper
- All Implemented Interfaces:
Serializable
,UserHolder
,org.springframework.security.core.userdetails.UserDetails
- Direct Known Subclasses:
SystemUserWrapper
public class UserWrapper
extends Object
implements org.springframework.security.core.userdetails.UserDetails, UserHolder, Serializable
An UserWrapper is used as an adapter between
Role
s, SecurityObject
s and Spring's GrantedAuthority
objects.- Author:
- Tina Russell
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate Collection
<org.springframework.security.core.GrantedAuthority> private static final long
private final User
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDefaultGrants
(Collection<org.springframework.security.core.GrantedAuthority> authz) Subclasses can set a collection of grants that are always available for an User.boolean
Collection
<org.springframework.security.core.GrantedAuthority> getUser()
Return the wrappedUser
instance.int
hashCode()
boolean
boolean
boolean
boolean
toString()
Return the Users username.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
user
-
authorities
-
-
Constructor Details
-
UserWrapper
Create a new UserWrapper.- Parameters:
user
- The User to wrap
-
-
Method Details
-
addDefaultGrants
protected void addDefaultGrants(Collection<org.springframework.security.core.GrantedAuthority> authz) Subclasses can set a collection of grants that are always available for an User. This is useful for administrative accounts.- Parameters:
authz
- A collection of grants (authorities) where the default grants are added to
-
getUser
Return the wrappedUser
instance.- Specified by:
getUser
in interfaceUserHolder
- Returns:
- The wrapped
User
-
getAuthorities
- Specified by:
getAuthorities
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the authorities, sorted by natural key (never null)
-
getPassword
- Specified by:
getPassword
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the password (never null)
-
getUsername
- Specified by:
getUsername
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- the username (never null)
-
isAccountNonExpired
public boolean isAccountNonExpired()- Specified by:
isAccountNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the user's account is valid (ie non-expired), false if no longer valid (ie expired)
-
isAccountNonLocked
public boolean isAccountNonLocked()- Specified by:
isAccountNonLocked
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the user is not locked, false otherwise
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()- Specified by:
isCredentialsNonExpired
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the user's credentials are valid (ie non-expired), false if no longer valid (ie expired)
- See Also:
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceorg.springframework.security.core.userdetails.UserDetails
- Returns:
- true if the user is enabled, false otherwise
-
hashCode
public int hashCode()Uses authorities and user for calculation.
-
equals
Uses authorities and user for comparison.
-
toString
Return the Users username.
-