package com.password; import java.util.Locale; import com.connection.Platform; import oracle.iam.identity.usermgmt.api.UserManagerConstants; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.passwordmgmt.api.PasswordMgmtService; import oracle.iam.passwordmgmt.impl.PasswordMgmtServiceImpl; import oracle.iam.passwordmgmt.vo.ValidationResult; public class ValidatePasswordAgainstPolicy { public static void main(String string[]){ User user = new User(String.valueOf(16)); PasswordMgmtService passwordMgmtService =
Platform.getService(PasswordMgmtService.class); user.setAttribute(UserManagerConstants.AttributeName.USER_LOGIN.getId(), "TUSER5"); user.setAttribute(UserManagerConstants.AttributeName.FIRSTNAME.getId(), "TEST5"); user.setAttribute(UserManagerConstants.AttributeName.LASTNAME.getId(), "USER5"); ValidationResult validationResult =
passwordMgmtService.validatePasswordAgainstPolicy("Welcome3".toCharArray(), user, "DBUMAppInstance",Locale.ENGLISH); System.out.println("Valid password was validated by Password Validation " + "API "+ validationResult.isPasswordValid()); /*try { validationResult = passwordMgmtService.validatePasswordAgainstPolicy("Welcome1".toCharArray(), user, "InavlidAppInstance",Locale.ENGLISH); }catch (Exception e) { System.out.println("! Inavlid Account with Password Validation via Change Account Password method API" + e.getMessage().contains("oracle.iam.provisioning.exception.ApplicationInstanc eNotFoundException")); } */ } }
No comments:
Post a Comment