com.xpn.xwiki.objects.classes
Class PasswordClass

java.lang.Object
  extended by com.xpn.xwiki.objects.BaseElement<R>
      extended by com.xpn.xwiki.objects.BaseCollection<ClassPropertyReference>
          extended by com.xpn.xwiki.objects.classes.PropertyClass
              extended by com.xpn.xwiki.objects.classes.StringClass
                  extended by com.xpn.xwiki.objects.classes.PasswordClass
All Implemented Interfaces:
PropertyClassInterface, ElementInterface, ObjectInterface, PropertyInterface, Serializable, Cloneable, Comparable<PropertyClass>

public class PasswordClass
extends StringClass

See Also:
Serialized Form

Field Summary
protected static String CRYPT_IDENTIFIER
           
protected static String DEFAULT_CRYPT_ALGORITHM
           
protected static String DEFAULT_HASH_ALGORITHM
           
protected static String DEFAULT_STORAGE
           
protected static String FORM_PASSWORD_PLACEHODLER
           
protected static String HASH_IDENTIFIER
           
protected static org.slf4j.Logger LOGGER
           
protected static String SEPARATOR
           
 
Fields inherited from class com.xpn.xwiki.objects.classes.PropertyClass
cachedCustomDisplayer
 
Fields inherited from class com.xpn.xwiki.objects.BaseCollection
currentReferenceDocumentReferenceResolver, fields, fieldsToRemove, number, relativeEntityReferenceResolver
 
Fields inherited from class com.xpn.xwiki.objects.BaseElement
localEntityReferenceSerializer, referenceCache
 
Constructor Summary
PasswordClass()
           
PasswordClass(PropertyMetaClass wclass)
           
 
Method Summary
 void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
 void displayHidden(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
 void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
 BaseProperty fromString(String value)
           
 String getAlgorithmFromPassword(String password)
           
 String getCryptAlgorithm()
           
 String getEquivalentPassword(String storedPassword, String plainPassword)
          Transforms a plain text password so that it has the same encryption as a password stored in the database.
 String getHashAlgorithm()
           
 String getPasswordCrypt(String password)
           
 String getPasswordCrypt(String password, String algorithmName)
           
 String getPasswordHash(String password)
           
 String getPasswordHash(String password, String algorithmName)
           
 String getProcessedPassword(String password)
           
 String getStorageType()
           
 
Methods inherited from class com.xpn.xwiki.objects.classes.StringClass
getSize, isPicker, newProperty, setPicker, setSize
 
Methods inherited from class com.xpn.xwiki.objects.classes.PropertyClass
clone, compareTo, createReference, displayCustom, displayEdit, displayEdit, displayHidden, displayHidden, displayView, displayView, flushCache, fromStringArray, fromValue, fromXML, getCachedDefaultCustomDisplayer, getClassName, getClassType, getCustomDisplay, getDefaultCustomDisplayer, getFieldFullName, getFullQueryPropertyName, getId, getName, getNumber, getObject, getPrettyName, getPrettyName, getTooltip, getTooltip, getTranslatedPrettyName, getValidationMessage, getValidationRegExp, getXClass, getxWikiClass, initLazyCollections, isCustomDisplayed, isDisabled, isUnmodifiable, isValidColumnTypes, newPropertyfromXML, setClassType, setCustomDisplay, setDisabled, setId, setName, setNumber, setObject, setPrettyName, setTooltip, setUnmodifiable, setValidationMessage, setValidationRegExp, setxWikiClass, toFormString, toString, toXML, toXML, validateProperty
 
Methods inherited from class com.xpn.xwiki.objects.BaseCollection
addField, addPropertyForRemoval, apply, equals, get, getCustomMappingMap, getDateValue, getDiff, getDoubleValue, getField, getFieldList, getFieldsToRemove, getFloatValue, getIntValue, getIntValue, getLargeStringValue, getListValue, getLongValue, getProperties, getPropertyList, getPropertyNames, getRelativeXClassReference, getSetValue, getSortedIterator, getStringValue, getXClassReference, merge, merge, put, removeField, safeget, safeput, setClassName, setDateValue, setDBStringListValue, setDocumentReference, setDoubleValue, setFields, setFieldsToRemove, setFloatValue, setIntValue, setLargeStringValue, setLongValue, setSetValue, setStringListValue, setStringValue, setXClassReference, toString, toXMLString
 
Methods inherited from class com.xpn.xwiki.objects.BaseElement
getDocumentReference, getLocalKey, getLocalUidStringEntityReferenceSerializer, getReference, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xpn.xwiki.objects.ObjectInterface
get, put, safeget, safeput
 
Methods inherited from interface com.xpn.xwiki.objects.ElementInterface
apply, getDocumentReference, getReference, merge, setDocumentReference, toString
 

Field Detail

LOGGER

protected static org.slf4j.Logger LOGGER

DEFAULT_STORAGE

protected static final String DEFAULT_STORAGE
See Also:
Constant Field Values

DEFAULT_HASH_ALGORITHM

protected static final String DEFAULT_HASH_ALGORITHM
See Also:
Constant Field Values

DEFAULT_CRYPT_ALGORITHM

protected static final String DEFAULT_CRYPT_ALGORITHM
See Also:
Constant Field Values

HASH_IDENTIFIER

protected static final String HASH_IDENTIFIER
See Also:
Constant Field Values

CRYPT_IDENTIFIER

protected static final String CRYPT_IDENTIFIER
See Also:
Constant Field Values

SEPARATOR

protected static final String SEPARATOR
See Also:
Constant Field Values

FORM_PASSWORD_PLACEHODLER

protected static final String FORM_PASSWORD_PLACEHODLER
See Also:
Constant Field Values
Constructor Detail

PasswordClass

public PasswordClass(PropertyMetaClass wclass)

PasswordClass

public PasswordClass()
Method Detail

fromString

public BaseProperty fromString(String value)
Specified by:
fromString in interface PropertyClassInterface
Overrides:
fromString in class StringClass

displayHidden

public void displayHidden(StringBuffer buffer,
                          String name,
                          String prefix,
                          BaseCollection object,
                          XWikiContext context)
Specified by:
displayHidden in interface PropertyClassInterface
Overrides:
displayHidden in class PropertyClass

displayView

public void displayView(StringBuffer buffer,
                        String name,
                        String prefix,
                        BaseCollection object,
                        XWikiContext context)
Specified by:
displayView in interface PropertyClassInterface
Overrides:
displayView in class PropertyClass

displayEdit

public void displayEdit(StringBuffer buffer,
                        String name,
                        String prefix,
                        BaseCollection object,
                        XWikiContext context)
Specified by:
displayEdit in interface PropertyClassInterface
Overrides:
displayEdit in class StringClass

getStorageType

public String getStorageType()
Returns:
One of 'Clear', 'Hash' or 'Encrypt'.

getHashAlgorithm

public String getHashAlgorithm()
Returns:
The hash algorithm configured for this XProperty.

getCryptAlgorithm

public String getCryptAlgorithm()
Returns:
The encryption algorithm configured for this XProperty.

getAlgorithmFromPassword

public String getAlgorithmFromPassword(String password)
Parameters:
password -
Returns:
The algorithm used for the given password.

getEquivalentPassword

public String getEquivalentPassword(String storedPassword,
                                    String plainPassword)
Transforms a plain text password so that it has the same encryption as a password stored in the database. The current configuration for this password XProperty cannot be used, as the user might have a different encryption mechanism (for example, if the user was imported, or the password was not yet upgraded).

Parameters:
storedPassword - The stored password, which gives the storage type and algorithm.
plainPassword - The plain text password to be encrypted.
Returns:
The input password, encrypted with the same mechanism as the stored password.

getProcessedPassword

public String getProcessedPassword(String password)

getPasswordCrypt

public String getPasswordCrypt(String password)

getPasswordCrypt

public String getPasswordCrypt(String password,
                               String algorithmName)

getPasswordHash

public String getPasswordHash(String password)

getPasswordHash

public String getPasswordHash(String password,
                              String algorithmName)


Copyright © 2004-2013 XWiki. All Rights Reserved.