Class EncryptingCredentialEncoder
java.lang.Object
com.atlassian.crowd.directory.ldap.credential.EncryptingCredentialEncoder
- All Implemented Interfaces:
LDAPCredentialEncoder,LDAPCredentialEncoder.LDAPCredentialToStringEncoder
public class EncryptingCredentialEncoder
extends Object
implements LDAPCredentialEncoder.LDAPCredentialToStringEncoder
Translates a clear-text password into an encrypted one if it isn't already encrypted, using the encryption method
specified by the directory settings.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.crowd.directory.ldap.credential.LDAPCredentialEncoder
LDAPCredentialEncoder.LDAPCredentialToByteArrayEncoder, LDAPCredentialEncoder.LDAPCredentialToStringEncoder -
Constructor Summary
ConstructorsConstructorDescriptionEncryptingCredentialEncoder(PasswordEncoderFactory passwordEncoderFactory, String encryptionAlgorithm) -
Method Summary
Modifier and TypeMethodDescriptionencodeCredential(PasswordCredential passwordCredential) Given an plain-text password, encodes/encrypts it according to the settings required by the particular directory connector which this encoder is intended to be used with.boolean
-
Constructor Details
-
EncryptingCredentialEncoder
public EncryptingCredentialEncoder(PasswordEncoderFactory passwordEncoderFactory, String encryptionAlgorithm)
-
-
Method Details
-
encodeCredential
public String encodeCredential(PasswordCredential passwordCredential) throws InvalidCredentialException Description copied from interface:LDAPCredentialEncoderGiven an plain-text password, encodes/encrypts it according to the settings required by the particular directory connector which this encoder is intended to be used with. Return type MUST be either String or byte[].- Specified by:
encodeCredentialin interfaceLDAPCredentialEncoder- Specified by:
encodeCredentialin interfaceLDAPCredentialEncoder.LDAPCredentialToStringEncoder- Parameters:
passwordCredential- The password credential to be encoded, guanteed to be non-null. If the subclass supports encrypting the given passwordCredential, it should NOT do so ifPasswordCredential.isEncryptedCredential()returnstrue(although it may still encode the credential to the format required by the directory). The value ofPasswordCredential.getCredential()is also guaranteed to be non-null.- Returns:
- String instead of Object
- Throws:
PasswordEncoderNotFoundException- (runtime exception) if the encoder for the specified encryption method cannot be foundInvalidCredentialException- If the password could not be encoded.- See Also:
-
supportsSettingEncryptedPasswords
public boolean supportsSettingEncryptedPasswords()- Specified by:
supportsSettingEncryptedPasswordsin interfaceLDAPCredentialEncoder- Returns:
trueif the LDAP directory supports client-side encryption of passwords.
-
getPasswordEncoderFactory
-
getEncryptionAlgorithm
-