/// <summary> /// Sets the password for the connector space object /// </summary> /// <param name="csentry">The CSEntry object for the user</param> /// <param name="newPassword">The new password</param> /// <param name="options">A PasswordOptions object specifying the options for setting the password</param> void IMAExtensible2Password.SetPassword(CSEntry csentry, System.Security.SecureString newPassword, PasswordOptions options) { try { Logger.LogLevel = LogLevel.Debug; PasswordSetOperation operation = MAConfig.OperationGroups[csentry.ObjectType].ObjectOperations.FirstOrDefault(t => t is PasswordSetOperation) as PasswordSetOperation; if (operation != null) { try { Logger.WriteLine("Attempting to set password for {0}", csentry.DN.ToString()); SshConnection.ExecuteOperation(operation, csentry, newPassword.ToUnsecureString()); Logger.WriteLine("Set password for {0} successfully", csentry.DN.ToString()); } catch (Exception ex) { Logger.WriteLine("Could not perform set password operation"); Logger.WriteException(ex); throw new ExtensibleExtensionException("Set password set operation failed", ex); } } else { Logger.WriteLine("Could not set password for {0} as no password set operation was defined for this object type", csentry.DN.ToString()); } } catch (ExtensibleExtensionException) { throw; } catch (Exception ex) { Logger.WriteLine("A exception occured during the password set operartion"); Logger.WriteException(ex); throw new ExtensibleExtensionException("An exception occured during the password set operation", ex); } }
/// <summary> /// Changes the password for the connector space object /// </summary> /// <param name="csentry">The CSEntry object for the user</param> /// <param name="oldPassword">The old password</param> /// <param name="newPassword">The new password</param> void IMAExtensible2Password.ChangePassword(CSEntry csentry, System.Security.SecureString oldPassword, System.Security.SecureString newPassword) { try { PasswordChangeOperation operation = MAConfig.OperationGroups[csentry.ObjectType.ToString()].ObjectOperations.FirstOrDefault(t => t is PasswordChangeOperation) as PasswordChangeOperation; if (operation != null) { try { Logger.WriteLine("Attempting to change password for {0}", csentry.DN.ToString()); SshConnection.ExecuteOperation(operation, csentry, oldPassword.ToUnsecureString(), newPassword.ToUnsecureString()); Logger.WriteLine("Changed password for {0} successfully", csentry.DN.ToString()); } catch (Exception ex) { Logger.WriteLine("Could not perform password change operation"); Logger.WriteException(ex); throw new ExtensibleExtensionException("Set password change operation failed", ex); } } else { Logger.WriteLine("Could not change password for {0} as no password change operation was defined for this object type", csentry.DN.ToString()); } } catch (ExtensibleExtensionException) { throw; } catch (Exception ex) { Logger.WriteLine("A exception occured during the password change operartion"); Logger.WriteException(ex); throw new ExtensibleExtensionException("An exception occured during the password change operation", ex); } }