import sailpoint.api.PasswordGenerator;
import sailpoint.api.SailPointContext;
import sailpoint.object.Application;
import sailpoint.object.Identity;
import sailpoint.tools.GeneralException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class PasswordGeneration1 {
static SailPointContext context = null;
static Application application = null;
static Identity identity = null;
static Log logger = LogFactory.getLog("com.mightypedia.password.rule");
private static String generatePassword() throws GeneralException {
String returnPassword = "";
PasswordGenerator passwordGenerator = null;
try {
passwordGenerator = new PasswordGenerator(context);
returnPassword = passwordGenerator.generatePassword(identity, application);
} catch (GeneralException e) {
logger.error("GeneralException: " + e.getMessage());
returnPassword = passwordGenerator.generatePassword();
}
return returnPassword;
}
public static void main(String[] args) {
try {
String password = generatePassword();
} catch (GeneralException e) {
logger.error("GeneralException: " + e.getMessage());
}
}
}
No comments:
Post a Comment