首页 > Oracle Identity Manager > Trusted GTC Recon User Create Post Modify Password

Trusted GTC Recon User Create Post Modify Password

2011年10月27日 发表评论 阅读评论
Trusted GTC Recon User Create Post Modify Password

这里主要描述了OIM通过Trusted GTC Recon创建用户之后,给创建的用户赋予默认的密码,密码可以是固定值,也可以是该用户的某条属性,前提是提供的密码遵守OIM所启用的密码策略,关于如何设置OIM密码策略,请查看OIM密码策略的章节。这里取的是用户的Common Name作为用户的默认密码,并且OIM密码策略不做任何限制。

1. 创建文件夹:…/pass/lib/com/example/custompph

2. 在/pass目录下创建plugin.xml文件,内容为:

 
 

<?xml version="1.0" encoding="UTF-8" ?>

<oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">

<plugin pluginclass="com.example.custompph.CustomPostProcessEventHandle"

version="1.0" name="CustomPostProcessEventHandle" />

</plugins>

</oimplugins>

3. 在包com.example.custompph下面创建java类CustomPostProcessEventHandle,代码如下:

 
 

package com.example.custompph;

import java.io.Serializable;

import java.util.HashMap;

import java.util.Iterator;

import java.util.logging.Logger;

import oracle.iam.identity.usermgmt.api.UserManager;

import oracle.iam.identity.vo.Identity;

import oracle.iam.platform.Platform;

import oracle.iam.platform.context.ContextAware;

import oracle.iam.platform.kernel.OrchestrationEngine;

import oracle.iam.platform.kernel.spi.PostProcessHandler;

import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;

import oracle.iam.platform.kernel.vo.BulkEventResult;

import oracle.iam.platform.kernel.vo.BulkOrchestration;

import oracle.iam.platform.kernel.vo.EventResult;

import oracle.iam.platform.kernel.vo.Orchestration;

public class CustomPostProcessEventHandle implements PostProcessHandler {

private Logger logger = Logger.getLogger("oim_server1-diagnostic");

public CustomPostProcessEventHandle() {

super();

}

@Override

public EventResult execute(long l, long l2, Orchestration orchestration) {

return new EventResult();

}

@Override

public BulkEventResult execute(long l, long l2,

BulkOrchestration orchestration) {

UserManager userOperationsService = Platform.getService(UserManager.class);

String dPassword = null;

logger.info("BulkEventResult NEW");

try {

Identity[] newUserState = (Identity[])getNewUserStates(orchestration);

logger.info("newUserState :: " + newUserState);

String usrLogin = null;

for (int y = 0; y < newUserState.length; y++) {

usrLogin = newUserState[y].getAttribute("User Login").toString();

userOperationsService.changePassword(usrLogin,

newUserState[y].getAttribute("Common Name").toString().toCharArray(),

true); //Update Password Using Common Name

}

for (int u = 0; u < newUserState.length; u++) {

HashMap<String, Object> userAttrMap = newUserState[u].getAttributes();

Iterator iterator = userAttrMap.keySet().iterator();

while (iterator.hasNext()) {

String key = iterator.next().toString();

Object value = userAttrMap.get(key);

}

}

Identity[] oldUserState = (Identity[])getOldUserStates(orchestration);

for (int y = 0; y < oldUserState.length; y++) {

logger.info(y + " . " + oldUserState[y]);

}

for (int u = 0; u < oldUserState.length; u++) {

HashMap<String, Object> userAttrMap = oldUserState[u].getAttributes();

Iterator iterator = userAttrMap.keySet().iterator();

while (iterator.hasNext()) {

String key = iterator.next().toString();

Object value = userAttrMap.get(key);

}

}

} catch (Exception e) {

logger.info("In Catch");

logger.info("ERROR :: " + e.getMessage());

}

logger.info("Exiting BulkEvent");

return new BulkEventResult();

}

@Override

public void compensate(long l, long l2,

AbstractGenericOrchestration abstractGenericOrchestration) {

logger.info("Compensate");

}

@Override

public boolean cancel(long l, long l2,

AbstractGenericOrchestration abstractGenericOrchestration) {

return false;

}

@Override

public void initialize(HashMap<String, String> hashMap) {

logger.info("Initialize");

}

/**

* Get Parameters Valus

* @param parameters

* @param key

* @return

*/

private String getParamaterValue(HashMap<String, Serializable> parameters,

String key) {

String value =

(parameters.get(key) instanceof ContextAware) ? (String)((ContextAware)parameters.get(key)).getObjectValue() :

(String)parameters.get(key);

return value;

}

/**

* Judge Is Empty or null

* @param str

* @return

*/

private boolean isNullOrEmpty(String str) {

return str == null || str.isEmpty();

}

/**

* Get UserKey

* @param processID

* @param orchestration

* @return

*/

private String getUserKey(long processID, BulkOrchestration orchestration) {

String userKey;

String entityType = orchestration.getTarget().getType();

EventResult result = new EventResult();

if (!orchestration.getOperation().equals("CREATE")) {

userKey = orchestration.getTarget().getEntityId();

} else {

OrchestrationEngine orchEngine =

Platform.getService(OrchestrationEngine.class);

logger.info("The process ID is : " + processID);

userKey = (String)orchEngine.getActionResult(processID);

}

return userKey;

}

/**

* Get Random String

* @param n

* @return

*/

private static String getRandomString(int n) {

char[] pw = new char[n];

int c = ‘A’;

int r1 = 0;

for (int i = 0; i < n; i++) {

r1 = (int)(Math.random() * 3);

switch (r1) {

case 0:

c = ‘0’ + (int)(Math.random() * 10);

break;

case 1:

c = ‘a’ + (int)(Math.random() * 26);

break;

case 2:

c = ‘A’ + (int)(Math.random() * 26);

break;

}

pw[i] = (char)c;

}

return new String(pw);

}

/**

*

* @param orchestration

* @return

*/

private Object getNewUserStates(BulkOrchestration orchestration) {

Object newUserStates = null;

HashMap interEventData = orchestration.getInterEventData();

if (interEventData != null)

newUserStates = interEventData.get("NEW_USER_STATE");

return newUserStates;

}

/**

*

* @param orchestration

* @return

*/

private Object getOldUserStates(BulkOrchestration orchestration) {

Object oldUserStates = null;

HashMap interEventData = orchestration.getInterEventData();

if (interEventData != null)

oldUserStates = interEventData.get("CURRENT_USER");

return oldUserStates;

}

}

4. 将CustomPostProcessEventHandle.java编译成CustomPostProcessEventHandle.class文件并将其放到…/pass/lib/com/example/custompph/目录下

5. 打包/pass文件夹到passd.zip

6. 将passd.zip文件上传到$ORACLE_IDM2_HOME/server/plugins目录下

7. 在终端中进入到$ORACLE_IDM2_HOME/server/plugin_utility:

cd /u01/app/Oracle/Middleware/Oracle_IDM2/server/plugin_utility/

8. 设置环境变量

 
 

JAVA_HOME:

export JAVA_HOME=/usr/java/jdk1.6.0_25

ANT_HOME:

export ANT_HOME=/u01/app/Oracle/Middleware/modules/org.apache.ant_1.7.1

PATH:

export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

9. 编辑ant.properties文件

vi ant.properties

wls.home=/u01/app/Oracle/Middleware/wlserver_10.3

oim.home=/u01/app/Oracle/Middleware/Oracle_IDM2/server

修改以下内容为:

10. 注册事件插件

用户名,密码为OIM的管理员用户名及密码,即为xelsysadm

服务器URL为OIM的地址

端口为14000

 
 

ant -f pluginregistration.xml register

xelsysadm

Welcome1

host:14000

最后输出以下内容表示注册成功:

[echo]

[echo] Plugin Registered

BUILD SUCCESSFUL

11. 进入到$ORACLE_OIM_HOME/sever/bin/目录下

cd /u01/app/Oracle/Middleware/Oracle_IDM2/server/bin

12. 设置环境变量

 
 

WL_HOME:

export WL_HOME=/u01/app/Oracle/Middleware/wlserver_10.3

OIM_ORACLE_HOME:

export OIM_ORACLE_HOME=/u01/app/Oracle/Middleware/Oracle_IDM2

13. 创建/u01/app/Oracle/Middleware/tmp4/db目录,并创建EventHandlers.xml于该目录下

 
 

<?xml version=’1.0′ encoding=’utf-8′?>

<eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">

<!– Custom preprocess event handlers –>

<action-handler class="com.example.custompph.CustomPostProcessEventHandle"

entity-type="User" operation="CREATE"

name="CustomPostProcessEventHandle" stage="postprocess"

order="LAST" sync="TRUE"/>

</eventhandlers>

14. 编辑weblogic.properties文件

vi weblogic.properties

更改以下内容:

 
 

wls_servername=oim_server1
application_name=OIMMetadata
metadata_from_loc=/u01/app/Oracle/Middleware/tmp4

15. 导入metadata

./weblogicImportMetadata.sh

用户名:weblogic

密码:weblogic1

服务器:默认

16. 清理缓存

./PurgeCache.sh MetaData

17. 重启OIM Managed Server

18. 测试

1. 在表中添加用户

2. DB同步到OIM中

3. OIM同步到OID中

4. 测试用户登录名以及密码

 

 

关于作者:

昵称:
档案信息:
联系方式:你可以通过联系作者
点击查看发表过的所有文章...
本文永久链接: http://blog.retailsolution.cn/archives/2918

 

 

对本文的评价:

 

 

  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.
您必须在 登录 后才能发布评论.