Package com.storedobject.common
Class LDAP.User
java.lang.Object
com.storedobject.common.LDAP.User
-
Constructor Summary
ConstructorsConstructorDescriptionUser(Attributes attr) Constructs a new User instance by extracting values from the provided Attributes object. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangePassword(String oldPass, String newPass) Updates the password for the user stored in the LDAP directory.Retrieves the common name of the user.Retrieves the distinguished name of the user.Retrieves the user principal name for this user.toString()
-
Constructor Details
-
User
Constructs a new User instance by extracting values from the provided Attributes object.- Parameters:
attr- the Attributes object containing user attributes, such as user principal name, common name, and distinguished name. Must not be null, and must include the required attributes.- Throws:
NamingException- if an error occurs while accessing attributes from the provided Attributes object.
-
-
Method Details
-
getUserPrincipal
Retrieves the user principal name for this user.- Returns:
- the user principal name as a String.
-
getCommonName
Retrieves the common name of the user.- Returns:
- the common name as a String.
-
getDistinguishedName
Retrieves the distinguished name of the user.- Returns:
- the distinguished name as a String.
-
toString
-
changePassword
Updates the password for the user stored in the LDAP directory. This method attempts to change the user's password by first removing the old password and then adding the new password using LDAP modify operations. It establishes an SSL/TLS connection with the LDAP server during the process.- Parameters:
oldPass- the current password of the user. Must not be null or empty.newPass- the new password to set for the user. Must meet the LDAP server's password policy.- Throws:
Exception- if an error occurs during the password change process, such as connection issues, SSL configuration errors, or password policy violations.
-