com.atlassian.user.security.password
Class Credential

java.lang.Object
  extended by com.atlassian.user.security.password.Credential

public final class Credential
extends java.lang.Object

Represents a user's password. Allows the same methods to take both encrypted and unencrypted credentials.


Field Summary
static Credential NONE
          The null or empty credential, which is encrypted and has an invalid hash so it can never be authenticated against.
 
Method Summary
static Credential encrypted(java.lang.String hash)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getValue()
          Returns the password, either in plain text if isEncrypted() returns false, or as a SHA1-512 hash if isEncrypted() returns true.
 int hashCode()
           
 boolean isEncrypted()
          Returns true if the string returned by getValue() is an encrypted hash of the password, rather than the plaintext password itself.
static Credential unencrypted(java.lang.String password)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final Credential NONE
The null or empty credential, which is encrypted and has an invalid hash so it can never be authenticated against.

Method Detail

encrypted

public static Credential encrypted(java.lang.String hash)

unencrypted

public static Credential unencrypted(java.lang.String password)

isEncrypted

public boolean isEncrypted()
Returns true if the string returned by getValue() is an encrypted hash of the password, rather than the plaintext password itself.


getValue

public java.lang.String getValue()
Returns the password, either in plain text if isEncrypted() returns false, or as a SHA1-512 hash if isEncrypted() returns true.


equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2005-2015 Atlassian. All Rights Reserved.