public class

UserDetailsWrapper

extends Object
implements UserDetails
java.lang.Object
   ↳ org.springframework.security.access.hierarchicalroles.UserDetailsWrapper

This class is deprecated.
use a RoleHierarchyVoter or RoleHierarchyAuthoritiesMapper instead.

Class Overview

This class wraps Spring Security's UserDetails in a way that its getAuthorities() method is delegated to RoleHierarchy.getReachableGrantedAuthorities. All other methods are delegated to the UserDetails implementation.

Summary

Public Constructors
UserDetailsWrapper(UserDetails userDetails, RoleHierarchy roleHierarchy)
Public Methods
Collection<? extends GrantedAuthority> getAuthorities()
Returns the authorities granted to the user.
String getPassword()
Returns the password used to authenticate the user.
UserDetails getUnwrappedUserDetails()
String getUsername()
Returns the username used to authenticate the user.
boolean isAccountNonExpired()
Indicates whether the user's account has expired.
boolean isAccountNonLocked()
Indicates whether the user is locked or unlocked.
boolean isCredentialsNonExpired()
Indicates whether the user's credentials (password) has expired.
boolean isEnabled()
Indicates whether the user is enabled or disabled.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.security.core.userdetails.UserDetails

Public Constructors

public UserDetailsWrapper (UserDetails userDetails, RoleHierarchy roleHierarchy)

Public Methods

public Collection<? extends GrantedAuthority> getAuthorities ()

Returns the authorities granted to the user. Cannot return null.

Returns
  • the authorities, sorted by natural key (never null)

public String getPassword ()

Returns the password used to authenticate the user. Cannot return null.

Returns
  • the password (never null)

public UserDetails getUnwrappedUserDetails ()

public String getUsername ()

Returns the username used to authenticate the user. Cannot return null.

Returns
  • the username (never null)

public boolean isAccountNonExpired ()

Indicates whether the user's account has expired. An expired account cannot be authenticated.

Returns
  • true if the user's account is valid (ie non-expired), false if no longer valid (ie expired)

public boolean isAccountNonLocked ()

Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.

Returns
  • true if the user is not locked, false otherwise

public boolean isCredentialsNonExpired ()

Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.

Returns
  • true if the user's credentials are valid (ie non-expired), false if no longer valid (ie expired)

public boolean isEnabled ()

Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.

Returns
  • true if the user is enabled, false otherwise