开发环境构建
1. ibm_sdk50 java.security.
  A. 下载/opt/IBM/itim/extensions/5.1/examples/apps/bin/jaas_login_was.conf 至D:/jaas_login_was.conf
B.修改 java.security文件( D:\IBM\eclipseDevelopmentPackage\ibm_sdk50\jre\lib\security\ java.security ),尾部添加如下
login.config.url.1=file:///D:/jaas_login_was.conf

2.添加依赖的jar包列表至WEB-INF/lib及其它配置:
APP_SRV_TOP=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01
ITIM_HOME=/opt/IBM/itim

$ITIM_HOME/lib/api_ejb.jar
$ITIM_HOME/lib/itim_api.jar
$ITIM_HOME/lib/itim_common.jar
$ITIM_HOME/lib/itim_server_api.jar
$ITIM_HOME/lib/jlog.jar
$APP_SRV_TOP/runtime/com.ibm.ws.admin.client_6.1.0.jar
$APP_SRV_TOP/plugins/com.ibm.ws.ejbportable_6.1.0.jar

下载$ITIM_HOME/data/tmsMessages.properties

在C:\WINDOWS\system32\drivers\etc\hosts中 添加域名映射如下
192.168.2.12

itim

4.项目的目录结构图如下:

5.部署至apache-tomcat-6.0.18服务器中
A.配置apache-tomcat-6.0.18运行jre
在apache-tomcat-6.0.18/bin/setclasspath.bat中添加JRE_HOME:
set JRE_HOME="D:\IBM\eclipseDevelopmentPackage\ibm_sdk50\jre"
B.拷贝$APP_SRV_TOP/runtime/com.ibm.ws.admin.client_6.1.0.jar到apache-tomcat-6.0.18/lib中

附录代码
PersonMgr.java
package com.likegene.demo;

import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Hashtable;
import java.util.ResourceBundle;

import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;

import com.ibm.itim.apps.ApplicationException;
import com.ibm.itim.apps.InitialPlatformContext;
import com.ibm.itim.apps.PlatformContext;
import com.ibm.itim.apps.Request;
import com.ibm.itim.apps.identity.PersonMO;
import com.ibm.itim.apps.identity.PersonManager;
import com.ibm.itim.apps.jaas.callback.PlatformCallbackHandler;
import com.ibm.itim.apps.provisioning.PasswordManager;

public class PersonMgr {

static ResourceBundle rb = ResourceBundle.getBundle("context");

public Subject getSubject(PlatformContext platform) {

String itimManager = rb.getString("itimManager");
        String itimManagerPwd = rb.getString("itimManagerPwd");
        Subject subject = null;
        try {
            PlatformCallbackHandler handler = new PlatformCallbackHandler(
                    itimManager, itimManagerPwd);
            handler.setPlatformContext(platform);
            LoginContext lc = new LoginContext("ITIM", handler);
            lc.login();
            subject = lc.getSubject();
        }

catch (LoginException e) {
            e.printStackTrace();
        }

return subject;
    }

public PlatformContext getPlatform() {

String platformContextFactory = rb.getString("contextFactory");
        String ejbUser = rb.getString("ejbUser");
        String appServerURL = rb.getString("appServerURL");
        String ejbPwd = rb.getString("ejbPwd");

Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(InitialPlatformContext.CONTEXT_FACTORY, platformContextFactory);
        env.put(PlatformContext.PLATFORM_URL, appServerURL);
        env.put(PlatformContext.PLATFORM_PRINCIPAL, ejbUser);
        env.put(PlatformContext.PLATFORM_CREDENTIALS, ejbPwd);
        PlatformContext platform = null;

try {
            platform = new InitialPlatformContext(env);
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (ApplicationException e) {
            e.printStackTrace();
        }
        return platform;
    }

public String updatePersonPwd(String uid, String newPwd) {
        PlatformContext platform = getPlatform();
        Subject subject = getSubject(platform);

PersonManager mgr = new PersonManager(platform, subject);

// find user
        Collection people;
        try {
            people = mgr.getPeople("uid", uid, null);

if (people.size() == 0) {
                System.out.print("用户不存在 :" + uid);
                return null;
            }

PersonMO personMO = (PersonMO) people.iterator().next();

PasswordManager pManager = new PasswordManager(platform, subject);
            Request request = pManager.synchPasswords(personMO, newPwd, null);
            String requestID = String.valueOf(request.getID());
            System.out.print("修改用户密码请求已提交. 处理 request ID:" + requestID);
            return requestID;
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (ApplicationException e) {
            e.printStackTrace();
        }
        return null;
    }

public static void main(String[] args) {
        PersonMgr pm = new PersonMgr();
        pm.updatePersonPwd("asmsith", "admin1234567");
    }
}

ChangePwdServlet.java
package com.likegene.demo;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ChangePwdServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

public ChangePwdServlet() {
        super();
    }

public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doPost(request, response);
    }

public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String newpassword = request.getParameter("newPwd");
        String userid = request.getParameter("uid");

PersonMgr pm = new PersonMgr();
        if (pm.updatePersonPwd(userid, newpassword) != null) {
            request.setAttribute("msg", "change password successfully!");
        } else {
            request.setAttribute("msg", userid + " not exist!");
        }
        request.getRequestDispatcher("./result.jsp").forward(request, response);
    }
}
context.properties
appServerURL=iiop://itim:2809
contextFactory=com.ibm.itim.apps.impl.websphere.WebSpherePlatformContextFactory
itimManager=itim manager
itimManagerPwd=object00
ejbUser=wasadmin
ejbPwd=object00
rootdn=ou=xyz,o=xyz

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <servlet>
    <servlet-name>ChangePwdServlet</servlet-name>
    <servlet-class>com.likegene.demo.ChangePwdServlet</servlet-class>
  </servlet>

<servlet-mapping>
    <servlet-name>ChangePwdServlet</servlet-name>
    <url-pattern>/ChangePwdServlet</url-pattern>
  </servlet-mapping>
       
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <meta http-equiv=Content-Type content="text/html; charset=UTF-8">
  </head>
  <body>
      <form method="post" action="./ChangePwdServlet">
          <table>
            <tr>
            <td>修改密码:</td>
            <td>UID:</td>
            <td><input type="text" name="uid"/></td>
            <td>新密码:</td>
            <td>
            <input type="text"  name="newPwd"/></td>
            <td>
            <input type="submit" value="修改" />
            </td>
            </tr>
        </table>
    </form>
  </body>
</html>

result.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>result</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
  </head>
  <body>
    ${msg}
  </body>
</html>

windows下ITIM admin API开发环境配置,部署至tomcat相关推荐

  1. windows下yacc和lex开发环境配置(Parser Generator篇)

    1.下载安装 Parser Generator是Windows下YACC和LEX的实现,是由英国Bumble-Bee Software公司开发. 下载地址http://www.bumblebeesof ...

  2. Windows下安装Java以及开发环境配置

    1.下载JDK(以及JRE) 首先我们需要下载java开发工具包JDK,下载地址:https://download.eclipse.org/oomph/jre/index-handler.php?vm ...

  3. Windows下搭建ARM11裸机开发环境(1):工具安装

    By: Ailson Jack Date: 2019.05.04 个人博客:http://www.only2fire.com/ 本文在我博客的地址是:http://www.only2fire.com/ ...

  4. Windows下搭建ARM11裸机开发环境(3):Eclipse+JLink调试代码

    By: Ailson Jack Date: 2019.05.17 个人博客:http://www.only2fire.com/ 本文在我博客的地址是:http://www.only2fire.com/ ...

  5. windows下gdal的java开发环境搭建

    本文接前文gis利器之Gdal(一),前面简单介绍了gdal工具是什么,具体有什么功能.对于gdal的具体功能,感兴趣的去官网看看.日常对于gis常见的矢量和栅格数据进行处理,gdal都是拿手的.今天 ...

  6. Mac下eclipse的Hadoop开发环境配置中以及windows->preferences下看不到Hadoop/MapReduce的配置项问题解决

    Mac下eclipse的Hadoop开发环境配置中以及windows->preferences下看不到Hadoop/MapReduce的配置项问题解决 1. 下载hadoop插件 下载好hado ...

  7. 第01章 Windows下搭建Python集成开发环境

    网上有很多资料是关于搭建Python开发环境的,由于Python的可移植性好,所以我们可以在windows系统.Linux系统甚至OSX系统下搭建.由于自己对Linux.OSX不熟,所以我是在wind ...

  8. 【教程】Windows下Miniconda+Pytorch+Pycharm开发环境搭建指南

    Windows下Miniconda+Pytorch+Pycharm开发环境搭建指南 给本科生写的新手教程,遇到很多新手的共性问题,可供大家参考.在开始阅读之前,请注意两个要关键:1.为什么要使用Con ...

  9. windows下rpc框架thrift的环境配置

    windows下rpc框架thrift的环境配置 引用链接: https://www.cnblogs.com/49er/p/7193829.html 最近在弄windows下 的Facebook的rp ...

最新文章

  1. 快速生成一个二维矩阵Python
  2. html游戏禁止微信浏览器下拉,JavaScript实现禁止微信浏览器下拉回弹效果
  3. 浅谈 G1 GC 日志格式
  4. 在linux设置Mysql允许用户远程登录和限制用户远程登录
  5. 【转】VS编程,快速折叠或者展开代码到 #region 级别的设置方法。
  6. 根据注释生成项目文档
  7. c# mysql 中文,c#操作mysql中文乱码的解决方案_c#应用
  8. docker多个容器一起打包_如何实现多个docker容器同时执行一条命令?
  9. js引用类型和基本类型、隐式类型转换以及强制类型转换面试题
  10. 【多媒体封装格式详解】---MKV【2】
  11. 计算机网络中sep是什么意思,SEP系统介绍及实施方案介绍.ppt
  12. 计算机ppt幻灯片设计主题,如何设置幻灯片主题样式,如何设置幻灯片主题为流畅...
  13. 地铁bas服务器系统,地铁BAS系统构成及工作原理
  14. 【渝粤教育】广东开放大学 动画运动规律 形成性考核 (25)
  15. 特步软件测试员工资,特步集团全面预算管理系统——管理员手册V1.1
  16. matlab2013a编译器,如何MATLAB2013a在win8-64位系统上能装mex编译器
  17. SpringBoot 接口数据加解密技巧
  18. mac系统下word和excel设置文件打开密码,输入密码才能打开文件
  19. 18.NET高级开发之ORM-EF6
  20. 稳定性高可用测试——各大厂质量保障实践分享汇总(上)

热门文章

  1. Linux 网络基础(二)---传输层
  2. AE C# 图片标注背景透明
  3. Codeforces Round 520 div2
  4. WordPress主题-柒比贰B2 V2.9.9主题去授权无限制
  5. Pinia:Vue3.js的状态管理器
  6. 华为手机怎样才算激活了_华为手机开机激活,华为智能手机怎么激活?
  7. Matrix Profile介绍
  8. UndefinedMetricWarning: Precision and F-score are ill-defined and being set to 0.0 in labels with no
  9. 树莓派Bullseye系统安装QT
  10. 嫦娥五号探测器成功着地,任务取得圆满成功