Spring Data Core

org.springframework.data.authentication
Class UserCredentials

java.lang.Object
  extended by org.springframework.data.authentication.UserCredentials

public class UserCredentials
extends Object

Class used to provide credentials for username/password authentication

Author:
Thomas Risberg, Oliver Gierke

Field Summary
static UserCredentials NO_CREDENTIALS
           
 
Constructor Summary
UserCredentials(String username, String password)
          Creates a new UserCredentials instance from the given username and password.
 
Method Summary
 boolean equals(Object obj)
           
 String getObfuscatedPassword()
          Returns the password in obfuscated fashion which means everthing except the first and last character replaced by stars.
 String getPassword()
          Get the password to use for authentication.
 String getUsername()
          Get the username to use for authentication.
 int hashCode()
           
 boolean hasPassword()
          Returns whether the credentials contain a password.
 boolean hasUsername()
          Returns whether the credentials contain a username.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_CREDENTIALS

public static final UserCredentials NO_CREDENTIALS
Constructor Detail

UserCredentials

public UserCredentials(String username,
                       String password)
Creates a new UserCredentials instance from the given username and password. Empty Strings provided will be treated like no username or password set.

Parameters:
username -
password -
Method Detail

getUsername

public String getUsername()
Get the username to use for authentication.

Returns:
the username

getPassword

public String getPassword()
Get the password to use for authentication.

Returns:
the password

hasUsername

public boolean hasUsername()
Returns whether the credentials contain a username.

Returns:

hasPassword

public boolean hasPassword()
Returns whether the credentials contain a password.

Returns:

getObfuscatedPassword

public String getObfuscatedPassword()
Returns the password in obfuscated fashion which means everthing except the first and last character replaced by stars. If the password is one or two characters long we'll obfuscate it entirely.

Returns:
the obfuscated password

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.