public class PasswordClass extends StringClass
Modifier and Type | Field and Description |
---|---|
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 |
cachedCustomDisplayer
currentReferenceDocumentReferenceResolver, fields, fieldsToRemove, number, relativeEntityReferenceResolver
documentReference, ownerDocument, referenceCache
Constructor and Description |
---|
PasswordClass() |
PasswordClass(PropertyMetaClass wclass) |
getSize, isPicker, newProperty, setPicker, setSize
clone, compareTo, createReference, displayCustom, displayEdit, displayEdit, displayHidden, displayHidden, displayView, displayView, flushCache, fromStringArray, fromValue, fromXML, getCachedDefaultCustomDisplayer, getClassName, getClassType, getCustomDisplay, getDefaultCustomDisplayer, getFieldFullName, getFullQueryPropertyName, getHint, getId, getName, getNumber, getObject, getPrettyName, getPrettyName, getTooltip, getTooltip, getTranslatedPrettyName, getValidationMessage, getValidationRegExp, getXClass, getxWikiClass, initLazyCollections, isCustomDisplayed, isDisabled, isUnmodifiable, isValidColumnTypes, mergeProperty, newPropertyfromXML, renderContentInContext, renderContentInContext, setClassType, setCustomDisplay, setDisabled, setHint, setId, setName, setNumber, setObject, setPrettyName, setTooltip, setUnmodifiable, setValidationMessage, setValidationRegExp, setxWikiClass, toFormString, toString, toXML, toXML, validateProperty
addField, addPropertyForRemoval, apply, equals, get, getCurrentReferenceDocumentReferenceResolver, getCustomMappingMap, getDateValue, getDiff, getDoubleValue, getField, getFieldList, getFieldsToRemove, getFloatValue, getIntValue, getIntValue, getLargeStringValue, getListValue, getLongValue, getProperties, getPropertyList, getPropertyNames, getRelativeEntityReferenceResolver, getRelativeXClassReference, getSetValue, getSortedIterator, getStringValue, getXClassReference, merge, merge, mergeField, put, removeField, safeget, safeput, setClassName, setDateValue, setDBStringListValue, setDocumentReference, setDoubleValue, setFields, setFieldsToRemove, setFloatValue, setIntValue, setLargeStringValue, setLongValue, setOwnerDocument, setSetValue, setStringListValue, setStringValue, setXClassReference, toXMLString
fromXML, getDocumentReference, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getOwnerDocument, getReference, getXWikiContext, hashCode, localizePlain, localizePlainOrKey, toString, toXMLString
finalize, getClass, notify, notifyAll, wait, wait, wait
displayView
get, put, safeget, safeput
apply, getDocumentReference, getReference, merge, setDocumentReference, toString
protected static org.slf4j.Logger LOGGER
protected static final String DEFAULT_STORAGE
protected static final String DEFAULT_HASH_ALGORITHM
protected static final String DEFAULT_CRYPT_ALGORITHM
protected static final String HASH_IDENTIFIER
protected static final String CRYPT_IDENTIFIER
protected static final String SEPARATOR
protected static final String FORM_PASSWORD_PLACEHODLER
public PasswordClass(PropertyMetaClass wclass)
public PasswordClass()
public BaseProperty fromString(String value)
fromString
in interface PropertyClassInterface
fromString
in class StringClass
public void displayHidden(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayHidden
in interface PropertyClassInterface
displayHidden
in class PropertyClass
public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayView
in interface PropertyClassInterface
displayView
in class StringClass
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayEdit
in interface PropertyClassInterface
displayEdit
in class StringClass
public String getStorageType()
public void setStorageType(String storageType)
storageType
- One of 'Clear', 'Hash' or 'Encrypt'public String getHashAlgorithm()
public String getCryptAlgorithm()
public String getAlgorithmFromPassword(String password)
password
- public String getSaltFromPassword(String password)
password
- public String getEquivalentPassword(String storedPassword, String plainPassword)
storedPassword
- The stored password, which gives the storage type and algorithm.plainPassword
- The plain text password to be encrypted.public String getPasswordHash(String password)
password
- the password to hash.hash:<algorithmName>:<salt>:<hexStrignHash>
, where <algorithmName>
is
the default hashing algorithm (see DEFAULT_HASH_ALGORITHM
), <salt>
is a random 64 character
salt and <hexStrignHash>
is the salted hash of the given password, using the given hashing algorithm.public String getPasswordHash(String password, String algorithmName)
password
- the password to hash.algorithmName
- the name of the hashing algorithm to use. See MessageDigest.getInstance(String)
.hash:<algorithmName>:<salt>:<hexStrignHash>
, where <salt>
is a random
64 character salt and <hexStrignHash>
is the salted hash of the given password, using the given
hashing algorithm.public String getPasswordHash(String password, String algorithmName, String salt)
password
- the password to hash.algorithmName
- the name of the hashing algorithm to use. See MessageDigest.getInstance(String)
.salt
- the string to pad the password with before hashing. If null
, a random 64 character salt will
be used. To disable salting, use an empty (""
) salt string.hash:<algorithmName>:<salt>:<hexStrignHash>
, where <hexStrignHash>
is
the salted hash of the given password, using the given hashing algorithm.public static String randomSalt()
Copyright © 2004–2022 XWiki. All rights reserved.