Spring Security Framework

org.springframework.security.userdetails.ldap
Class LdapUserDetailsImpl

java.lang.Object
  extended by org.springframework.security.userdetails.ldap.LdapUserDetailsImpl
All Implemented Interfaces:
Serializable, LdapUserDetails, UserDetails
Direct Known Subclasses:
Person

public class LdapUserDetailsImpl
extends Object
implements LdapUserDetails

A UserDetails implementation which is used internally by the Ldap services. It also contains the user's distinguished name and a set of attributes that have been retrieved from the Ldap server.

An instance may be created as the result of a search, or when user information is retrieved during authentication.

An instance of this class will be used by the LdapAuthenticationProvider to construct the final user details object that it returns.

Version:
$Id$
Author:
Luke Taylor
See Also:
Serialized Form

Nested Class Summary
static class LdapUserDetailsImpl.Essence
          Variation of essence pattern.
 
Constructor Summary
protected LdapUserDetailsImpl()
           
 
Method Summary
 Attributes getAttributes()
          The attributes for the user's entry in the directory (or a subset of them, depending on what was retrieved from the directory).
 GrantedAuthority[] getAuthorities()
          Returns the authorities granted to the user.
 String getDn()
          The DN of the entry for this user's account.
 String getPassword()
          Returns the password used to authenticate the user.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LdapUserDetailsImpl

protected LdapUserDetailsImpl()
Method Detail

getAttributes

public Attributes getAttributes()
Description copied from interface: LdapUserDetails
The attributes for the user's entry in the directory (or a subset of them, depending on what was retrieved from the directory).

Specified by:
getAttributes in interface LdapUserDetails
Returns:
the user's attributes, or an empty array if none were obtained, never null.

getAuthorities

public GrantedAuthority[] getAuthorities()
Description copied from interface: UserDetails
Returns the authorities granted to the user. Cannot return null.

Specified by:
getAuthorities in interface UserDetails
Returns:
the authorities, sorted by natural key (never null)

getDn

public String getDn()
Description copied from interface: LdapUserDetails
The DN of the entry for this user's account.

Specified by:
getDn in interface LdapUserDetails
Returns:
the user's DN

getPassword

public String getPassword()
Description copied from interface: UserDetails
Returns the password used to authenticate the user. Cannot return null.

Specified by:
getPassword in interface UserDetails
Returns:
the password (never null)

getUsername

public String getUsername()
Description copied from interface: UserDetails
Returns the username used to authenticate the user. Cannot return null.

Specified by:
getUsername in interface UserDetails
Returns:
the username (never null)

isAccountNonExpired

public boolean isAccountNonExpired()
Description copied from interface: UserDetails
Indicates whether the user's account has expired. An expired account cannot be authenticated.

Specified by:
isAccountNonExpired in interface UserDetails
Returns:
true if the user's account is valid (ie non-expired), false if no longer valid (ie expired)

isAccountNonLocked

public boolean isAccountNonLocked()
Description copied from interface: UserDetails
Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.

Specified by:
isAccountNonLocked in interface UserDetails
Returns:
true if the user is not locked, false otherwise

isCredentialsNonExpired

public boolean isCredentialsNonExpired()
Description copied from interface: UserDetails
Indicates whether the user's credentials (password) has expired. Expired credentials prevent authentication.

Specified by:
isCredentialsNonExpired in interface UserDetails
Returns:
true if the user's credentials are valid (ie non-expired), false if no longer valid (ie expired)

isEnabled

public boolean isEnabled()
Description copied from interface: UserDetails
Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.

Specified by:
isEnabled in interface UserDetails
Returns:
true if the user is enabled, false otherwise

toString

public String toString()
Overrides:
toString in class Object

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.