- package com.oimacademy.password;
- import java.util.HashMap;
- import oracle.iam.identity.usermgmt.api.UserManagerConstants;
- import oracle.iam.platform.context.ContextManager;
- import oracle.iam.selfservice.self.selfmgmt.api.AuthenticatedSelfService;
- import com.oimacademy.connection.Platform;
- public class AuthenticatedSelfServiceResetPassword {
- private AuthenticatedSelfService m_authselfservice = Platform.getService(AuthenticatedSelfService.class);
- public static void main(String[] args) {
- try {
- new AuthenticatedSelfServiceResetPassword().changePassword();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public void changePassword() throws Exception {
- String oldpwd ="Welcome1";
- String newpwd = "Welcome2";
- String confirmpwd = "Welcome2";
- /* UserManager userManager = platform.getService(UserManager.class);
- HashMap<String, Object> createAttrsMap = new HashMap<String, Object>();
- // createAttrsMap = utility.getAttributesInMap(m_authUserProps, "CREATE.createAttributes");
- createAttrsMap.put("User Login", "TUSER10");
- createAttrsMap.put("First Name", "TEST10");
- createAttrsMap.put("Last Name", "USER10");
- createAttrsMap.put("act_key", "1");
- createAttrsMap.put("usr_password", "Welcome1");
- createAttrsMap.put("Xellerate Type", "End-User");
- createAttrsMap.put("Role","Full-Time");
- long actkey = Long.parseLong(createAttrsMap.get("act_key").toString());
- createAttrsMap.put("act_key", actkey);
- createAttrsMap.put(UserManagerConstants.AttributeName.PASSWORD.getId(), oldpwd.toCharArray());
- createAttrsMap.put("Start Date", new java.util.Date());
- createAttrsMap.put("Email", "TEST.USER10@oracle.com");
- UserManagerResult result = userManager.create(new User(null,createAttrsMap));
- System.out.println("ENTITYID = " + result.getEntityId());
- String usrKey = result.getEntityId();*/
- // setUserInContext("TUSER2", "6");
- System.out.println("###################"+ContextManager.getOIMUser());
- try {
- //Attempt to change password
- m_authselfservice.changePassword(oldpwd.toCharArray(),newpwd.toCharArray(),confirmpwd.toCharArray());
- //m_authselfservice.changePassword("10981", "Pass_12345".toCharArray(),false);
- ContextManager.clearContext();
- System.out.println("###### PASSWORD UPDATED #############");
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- ContextManager.clearContext();
- }
- }
- public void setUserInContext(String userName, String userKey){
- if(ContextManager.getContext() != null) {
- ContextManager.popContext();
- }
- ContextManager.pushContext(null, null, null);
- HashMap<String,String> map = new HashMap<String,String>();
- map.put(UserManagerConstants.AttributeName.USER_KEY.getId(), userKey);
- ContextManager.setOIMUser(userName);
- ContextManager.setUserDetails(map);
- }
- }
Oracle Identity Manager(OIM) is the Provisioning Solution from oracle. This page contains an index with references to all OIM related posts in the oracle identity manager Academy blog. The posts included herein are intended to provide oracle identity management customers and developers with technical information about best practices for implementing OIM based solutions.
OIM API for Authenticated SelfService Reset Password
Subscribe to:
Post Comments (Atom)
-
Connection Related API's : OIM DB Connection/ Data Source connection OIMClient API / OIMConnection API OIM Platform API to getSer...
-
Error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframewor...
-
In this post, we set the middle name as “MiddleName” if user does not provide middle name during user create operation. Below are high...
No comments:
Post a Comment