码迷,mamicode.com
首页 > 其他好文 > 详细

ofbiz SSO 单点登录

时间:2014-05-07 06:01:41      阅读:398      评论:0      收藏:0      [点我收藏+]

标签:ofbiz   sso   单点登录   



1ofbiz单点登录介绍

 

ofbiz点单登录是集成了CAS SSOLDAP使用的,具体的CASLDAP怎么应用,在这里不做介绍。

 

2ofbiz点单登录文档

 

ofbiz 12版本中,有英文的简单的ofbiz单点登录的问题。

路径在:apache-ofbiz-12.04.01\framework\documents\SingleSignOn.xml

bubuko.com,布布扣

 

3ofbiz单点登录目录

 

ofbiz  单点登录集成的目录在:apache-ofbiz-12.04.01\specialpurpose\ldap

在使用单点登录时需要把这个目录的应用加载到component.xml中。

 

4ofbiz点单登录原始应用

 

ofbiz原始的单点登录建立在CASLDAP安装及配置好的前提下。

 

每一个web应用程序,您需要使用LDAP(单点登录)功能,您需要更改事件的一些安全请求映射org.ofbiz.ldap.LdapLoginWorker类。

 

<request-mapuri="login">

       <securityhttps="false"auth="false"/>

       <eventtype="java"path="org.ofbiz.ldap.LdapLoginWorker"invoke="login"/>

       <responsename="success"type="view"value="main"/>

       <responsename="requirePasswordChange"type="view"value="requirePasswordChange"/>

       <responsename="error"type="view"value="login"/>

   </request-map>

 

 

<request-mapuri="logout">

       <securityhttps="false"auth="false"/>

       <eventtype="java"path="org.ofbiz.ldap.LdapLoginWorker " invoke="logout"/>

       <responsename="success"type="request-redirect"value="main"/>

       <responsename="error"type="view"value="main"/>

   </request-map>

 

5ofbiz ldap.xml 文件配置

 

进入这个文件,我相信搞过ofbiz的人都能开的明白。

在这我想说一下,安全配置的问题。

如果您不想用ssl https这种模式情况下,https://localhost:8443/cas这种方式改成http://localhost:8080/cas这种连接就可以了,这样CAS就不再有签名的问题,当然您也需要配置CAS不使用证书验证的方式。

 

6ofbiz单点登录流程

 

bubuko.com,布布扣

 

 

7ofbiz SSO 改造应用

 

1CAS用户数据在ofbiz表中管理

 

新增加一个实体,名称为SsoUserLogin ,数据和UserLogin数据同步,密码可以用先用明文或者通过CAS加密后的密文

 

2、去掉LDAP验证

 

为了更方便简单的单点登录的管理与应用,决定去掉LDAP

OFBizCasAuthenticationHandler.java中去掉:

//           SearchResult result = getLdapSearchResult(username,password, rootElement, false);

//           if (result != null) {

//               return login(request, response,username, password, rootElement, result);

//           }

 

 

这个事获取ldap验证及基于ldap的登录

 

改成:

 

LocalDispatcher dispatcher =(LocalDispatcher) request.getAttribute("dispatcher");

           Delegator delegator =dispatcher.getDelegator();

           GenericValue userTryToLogin= delegator.findOne("SsoUserLogin",false,"userLoginId", username);

           String currentPas =userTryToLogin.getString("currentPassword");

           HttpSessionsession = request.getSession();

           session.setAttribute("USERNAME",username);

           if(currentPas!=null && currentPas!=""){

              session.setAttribute("PASSWORD",currentPas);

           }else{

              session.setAttribute("PASSWORD",password);

          }

 

 

这样修改是为了使用ofbiz最原始的登录方式。

 

 

LdapLoginWorker.java修改:

//           boolean useOFBizLoginWhenFail =Boolean.getBoolean(UtilXml.childElementValue(rootElement,"UseOFBizLoginWhenLDAPFail", "false"));

           //boolean useOFBizLoginWhenFail =Boolean.getBoolean(UtilXml.childElementValue(rootElement,"UseOFBizLoginWhenLDAPFail", "true"));

//         if(useOFBizLoginWhenFail) {

           if (true) {

               return LoginWorker.login(request,response);

           }

 

 

使用ofbiz原始方式登录

 

 

 

登出是一样的节凑。。。。。



ofbiz SSO 单点登录,布布扣,bubuko.com

ofbiz SSO 单点登录

标签:ofbiz   sso   单点登录   

原文地址:http://blog.csdn.net/fclwd/article/details/25054897

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!