在Winchill 8.0 中加入鏈接的用戶驗證
来源:互联网 发布:在淘宝网上买手机可靠吗 编辑:程序博客网 时间:2024/04/26 19:29
问题描述: 在Winchill8.0中加入Struts开发时,需要加入ActionForward鏈接的用戶驗證以提高安全性解决步骤:(1)在%Apache_home%/conf/app-Windchill-Auth.conf文件中加入:綠色:要驗證的鏈接名藍色:跟其它相同的 AuthName "Windchill" AuthType Basic AuthLDAPURL ldap://pdm.company.com/ou=people,cn=Windchill_8.0,cn=Application%20Services,o=company require valid-user (2)寫一個繼承org.apache.struts.action.ActionServlet類,復寫其process方法import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.ActionServlet;import wt.auth.Authentication;import wt.httpgw.WTContextBean;import wt.method.RemoteMethodServer;import wt.util.WTContext;import wt.util.WTProperties;/** * StrutsAcationServlet繼承自Struts提供的ActionServlet * 在調用此Servlet則進行登錄檢查,如果沒有登錄,則彈出Basic的論證窗口,輸入.*/public class StrutsActionServlet extends ActionServlet {private static final String CHAR_SET = "utf-8";private static final long serialVersionUID = 1L;private static String WWW_AUTHENTICATE;protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException {String s = request.getRemoteUser();if (s == null || s.length() == 0) {String s1 = request.getHeader("AUTHORIZATION");if (s1 == null || s1.length() == 0) {if (WWW_AUTHENTICATE != null) {response.setHeader("www-authenticate", WWW_AUTHENTICATE);}response.sendError(401, "Request not authenticated");return;}}request.setCharacterEncoding(CHAR_SET);WTContextBean bean = (WTContextBean)request.getAttribute("wtcontext");if(bean == null){bean = new WTContextBean();}bean.setRequest(request);//response.setCharacterEncoding(CHAR_SET);super.process(request, response);}static {WTProperties wtproperties;ThreadGroup threadgroup=null;try {wtproperties = WTProperties.getLocalProperties();WWW_AUTHENTICATE = wtproperties.getProperty("wt.httpgw.wwwAuthenticate");threadgroup = WTContext.getContextGroup();WTContext.setLenientLookup(false);WTContext.setContextGroup(new ThreadGroup("StrutsActionServlet"));WTContext.init((String[]) null, true);RemoteMethodServer.setDefaultPrivateAuthentication(true);RemoteMethodServer.setDefaultPrivateAffinity(true);Authentication.setDefaultAllowUserInteraction(false);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}finally{ WTContext.getContext().destroy(); WTContext.setContextGroup(threadgroup); }}}(3)在web.xml文件中加入:StrutsAction ext.company.design.servlet.StrutsActionServlet StrutsAction /servlet/ext/struts/*
- 在Winchill 8.0 中加入鏈接的用戶驗證
- winchill磁盘文件与document的映射关系在数据库中的体现
- 在对话框中加入状态栏的方法
- 在WinForm的DataGrid中加入ComboBox
- 在对话框中加入状态栏的方法
- 在网页中加入Flash的代码
- 在窗体的标题栏中加入按钮
- 在editorgrid中加入combox的使用
- 在ServiceManager中加入自定义的服务
- 在中加入javascript ...
- 在redboot中中加入以太网支持的通用方法
- HTML中加入在Eclipse中写的java程序
- 如何在自己的程序中加入宏的功能
- 在smarty中加入自定义的常量格式的方法
- 在smarty中加入自定义的常量格式的方法 .
- 怎样在Linux中加入对NTFS的支持?
- 在windows中加入程序组的设想
- 专题:在网页中加入视频播放的插件
- vc 枚举磁盘,在磁盘里写文件的操作
- 设计模式概述
- Oracle Pwnage with the Metasploit Oracle Modules
- CFileDialog打开多个文件失败 返回错误 FNERR_BUFFERTOOSMALL
- c#常用函数列表
- 在Winchill 8.0 中加入鏈接的用戶驗證
- ASP.NET 伪静态页面生成
- 王者归来
- Java 静态初始化顺序
- 在weblogic中配置和使用dataSource
- 认识hasLayout——IE浏览器css bug的一大罪恶根源(转载网址http://neverned.blog.163.com/blog/static/1265524200933021130561/)
- DWR使用介绍
- odbc与oledb的区别
- 图片服务器分流的问题[转]