/// <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> /// Executes the specified operation against the SSH client /// </summary> /// <param name="operation">The operation to execute</param> /// <param name="csentry">The object to run the operation against</param> /// <param name="newPassword">The new password for the specified object</param> /// <returns>An OperationResult object containing the results of the execution</returns> public static OperationResult ExecuteOperation(PasswordSetOperation operation, CSEntry csentry, string newPassword) { return(ExecuteOperation(operation, csentry, null, newPassword)); }