Skip to Main Content

Security Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to generate a password for an account based on the password policy attached to AppInst

Philipp GrigoryevDec 14 2017 — edited Dec 20 2017

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2018
Added on Dec 14 2017
3 comments
411 views