org.randomcoder.security.userdetails
Class UserDetailsImpl

java.lang.Object
  extended by org.randomcoder.security.userdetails.UserDetailsImpl
All Implemented Interfaces:
Serializable, UserDetails

public final class UserDetailsImpl
extends Object
implements UserDetails

Acegi UserDetails implementation.

 Copyright (c) 2006, Craig Condit. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
   * Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
     
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 

See Also:
Serialized Form

Constructor Summary
UserDetailsImpl(User user)
          Creates a new UserDetailsImpl.
UserDetailsImpl(User user, String password)
          Creates a new UserDetailsImpl with an explicit password.
 
Method Summary
 GrantedAuthority[] getAuthorities()
          Gets a list of authorities granted to the current user.
 String getPassword()
          Gets the password for this user.
 String getUsername()
          Gets the username for this user.
 boolean isAccountNonExpired()
          Always returns true because randomcoder.org users do not expire.
 boolean isAccountNonLocked()
          Always returns true because randomcoder.org users are not locked.
 boolean isCredentialsNonExpired()
          Always returns true because randomcoder.org credentials do not expire.
 boolean isEnabled()
          Determines if the current user is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDetailsImpl

public UserDetailsImpl(User user)
Creates a new UserDetailsImpl.

Parameters:
user - User to read properties from.

UserDetailsImpl

public UserDetailsImpl(User user,
                       String password)
Creates a new UserDetailsImpl with an explicit password.

This is most often used for specifying non-password tokens such as those used with CardSpace, etc.

Parameters:
user - User to read properties from.
password - overriden password
Method Detail

getAuthorities

public GrantedAuthority[] getAuthorities()
Gets a list of authorities granted to the current user.

Specified by:
getAuthorities in interface UserDetails
Returns:
array of granted authorities

getPassword

public String getPassword()
Gets the password for this user.

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

getUsername

public String getUsername()
Gets the username for this user.

Specified by:
getUsername in interface UserDetails
Returns:
user name (never null)

isAccountNonExpired

public boolean isAccountNonExpired()
Always returns true because randomcoder.org users do not expire.

Specified by:
isAccountNonExpired in interface UserDetails
Returns:
always true

isAccountNonLocked

public boolean isAccountNonLocked()
Always returns true because randomcoder.org users are not locked.

Specified by:
isAccountNonLocked in interface UserDetails
Returns:
always true

isCredentialsNonExpired

public boolean isCredentialsNonExpired()
Always returns true because randomcoder.org credentials do not expire.

Specified by:
isCredentialsNonExpired in interface UserDetails
Returns:
always true

isEnabled

public boolean isEnabled()
Determines if the current user is enabled.

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


Copyright © 2006-2010 Craig Condit. All Rights Reserved.