Hey guys,
Did anybody try to use OIM API to generate a password for an account based on the password policy attached?
I started with the thread https://community.oracle.com/message/13883312#13883312 which is a decent starter, but then I realized that it's a challenge to get PasswordPolicyInfo for account/process_instance.
I had to grab PasswordPolicyDescription instead and iterate through it reassigning fields to PasswordPolicyInfo, which is not fun at all.
final HashMap policyParams = passwordOpIntf.getProcessPasswordPolicyDescription(lProcInstKey);
final PasswordPolicyInfo passwordPolicyInfo = new PasswordPolicyInfo();
for (Object key : policyParams.keySet()) {
switch (key.toString()) {
case "passwordPolicy.message.minAlpha" :
passwordPolicyInfo.setMinAlphabets(Integer.valueOf(policyParams.get(key).toString()));
break;
...
}
final OimPasswordPolicy oimPasswordPolicy = new OimPasswordPolicy(passwordPolicyInfo);
final RandomPasswordGenerator pwdGen = new RandomPasswordGeneratorImpl();
final char[] pwd = pwdGen.generatePassword(oimPasswordPolicy, null);
I wonder if there is a more simple way of achieving the same result and preferably using the newer PasswordMgmtService?
Thank you in advance