- 浏览: 330027 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
-
chenfang_0913:
您好,我按照您的方法在Windows端进行了实现,可是我一直捕 ...
java实现网卡数据包抓取学习 -
wps886:
google了半天全是错的,只有楼主的xml配置有用,太感谢了 ...
奇怪的400 BAD REQUEST -
laputa73:
node.addEventListener('mouseup' ...
网络拓扑图DEMO -
njyyao:
单击、双击、右击的事件处理事件?
网络拓扑图DEMO -
lilinshtandby:
不错不错,赞一个
dhtmlxTree总结
参考文章:http://www.lifevv.com/java/doc/20080305224358885.html
创建了一个CookieUserSSO
package net.jforum.sso; import javax.servlet.http.Cookie; import net.jforum.ControllerUtils; import net.jforum.context.RequestContext; import net.jforum.entities.UserSession; import net.jforum.util.preferences.ConfigKeys; import net.jforum.util.preferences.SystemGlobals; import org.apache.log4j.Logger; /** * jforum 与 web 项目整合的的处理类 * @author Rafael Steil * @version $Id: $ */ public class CookieUserSSO implements SSO{ static final Logger logger = Logger.getLogger(CookieUserSSO.class.getName()); public String authenticateUser(RequestContext request) { // login cookie set by my web LOGIN application // Cookie cookieNameUser = ControllerUtils.getCookie(SystemGlobals.getValue(ConfigKeys.COOKIE_NAME_USER));//这种写法会获取null,不解啊 Cookie cookieNameUser = ControllerUtils.getCookie("jforumSSOCookieNameUser"); String username = null; if (cookieNameUser != null) { username = cookieNameUser.getValue(); } System.out.println(cookieNameUser+" ======== "+username+" =========="); return username; // return username for jforum // jforum will use this name to regist database or set in HttpSession } public boolean isSessionValid(UserSession userSession, RequestContext request) { Cookie cookieNameUser = ControllerUtils.getCookie(SystemGlobals .getValue(ConfigKeys.COOKIE_NAME_USER)); // user cookie String remoteUser = null; if (cookieNameUser != null) { remoteUser = cookieNameUser.getValue(); // jforum username } if (remoteUser == null && userSession.getUserId() != SystemGlobals .getIntValue(ConfigKeys.ANONYMOUS_USER_ID)) { // user has since logged out return false; } else if (remoteUser != null && userSession.getUserId() == SystemGlobals .getIntValue(ConfigKeys.ANONYMOUS_USER_ID)) { // anonymous user has logged in return false; } else if (remoteUser != null && !remoteUser.equals(userSession.getUsername())) { // not the same user (cookie and session) return false; } return true; // myapp user and forum user the same. valid user. } }
修改systemglobals.properties文件中的SSO片段
############################# # SSO / User authentication ############################# # Auhentication type: use one of the following options # # sso: SSO based authentication. The called class will be the one # specified by the key "sso.implementation", whic must be an implementation # of net.jforum.sso.SSO # # default: Non-SSO authentication, which relies on the key # "login.authenticator" to validate users. For more information, please see # net.jforum.sso.LoginAuthenticator and the default implementation. #authentication.type = default authentication.type = sso # The above key will be used when "authentication.type" is set to "default" # Can be any implementation of net.jforum.sso.LoginAuthenticator # # For LDAP authentication, set the value to net.jforum.sso.LDAPAuthenticator. Also, # see the LDAP section below login.authenticator = net.jforum.sso.DefaultLoginAuthenticator # When using authentication.type = default, you may choose to disable # the automatic login feature, which will prevents users to get # automatic logged in when they come back to the forum auto.login.enabled = true # The above key will be be used then "authentication.type" is set to "sso" # The default implementation (used here) only checks if request.getRemoteUser() # is not null. This may be enough for many situations. #sso.implementation = net.jforum.sso.RemoteUserSSO sso.implementation = net.jforum.sso.CookieUserSSO #cookie.name.user = jforumSSOCookieNameUser这里不需要重写cookie.name.user了,因为在下面还有一个这个属性,直接修改就可以了 # Special attributes used when creating a new user # Only if auhentication.type = sso # The attribute name to search in the session for the password. sso.password.attribute = password # Same as above sso.email.attribute = email # The default email to use if sso.email.attribute is empty sso.default.email = sso@user # The default password to use if sso.password.attribute is empty sso.default.password = sso # Optional redirect for SSO # # If a value is set, the user will be redirected to the defined # URL, using the following logic: # # ${sso.redirect}?returnUrl=${forum.link} + # # The value MUST start with the protocol (http:// or https://) # sso.redirect = http://localhost:8082/jforum
然后,在web项目的登陆处理中加入cookie的设置
//与jforum整合代码,设置cookic Cookie cookie = new Cookie("jforumSSOCookieNameUser", username); cookie.setMaxAge(-1); cookie.setPath("/"); response.addCookie(cookie);
退出处理类中,加入
Cookie cookie = new Cookie("jforumSSOCookieNameUser", ""); cookie.setMaxAge(0); // delete the cookie. cookie.setPath("/"); response.addCookie(cookie);
然后发布就ok了
发表评论
-
禁止页面放大缩小
2013-05-12 18:42 1925<html> <head> &l ... -
在web.xml中添加多个filter
2011-05-10 15:32 6690web.xml中的多个filter的运行顺序walker(wa ... -
tomcat无法启动
2011-05-08 09:11 1134Myeclipse8.5 + Tomcat7.0.5 发布应 ... -
XML to JSON
2011-04-06 16:17 1311现在JSON在前台的应用越来越广泛,不过也有很多系统是基于XM ... -
ajax tree框架(zTree)
2011-04-05 12:23 2908在以往的项目中,有时会用到树菜单的操作.我用过dhtmltre ... -
通过HttpClient发送Web Service请求
2011-01-19 10:29 1870import java.io.ByteArrayInputSt ... -
使用JES搭建小巧的Mail服务器
2010-10-26 21:56 1617最新需要使用MAIL服务器进行测试,正所谓山不在高,有仙则灵. ... -
struts2+spring2+hibernate3所需要的最少jar包
2010-04-19 16:06 1617Spring2所需要的jar包最简单,只需要一个综合的spri ... -
Struts2中获取requset,session,application
2010-01-04 13:24 1624struts2中Action是集成于com.opensymph ... -
struts2.0中struts.xml配置文件详解(转)
2010-01-04 11:10 1124<!DOCTYPE struts PUBLIC &quo ... -
struts2-Unable to load configuration. - bean - jar
2010-01-01 12:01 2872在整合Struts2 + Spring2 + Hibernat ... -
[转载]企业级SOA之路——在Web Service中使用HTTP和JMS
2009-12-28 10:28 1275本文来自CSDN博客,转载请标明出处:http://blog. ... -
XAMPP虚拟主机配置,实现单主机多个站点
2009-10-24 23:31 2807打开注释 NameVirtualHost *:80 ... -
thinkphp中使用ajax接收json数据
2009-04-01 17:25 9516参考thinkphp+jquery实现ajax,扩展了下,写了 ... -
基于服务器推的web im(未实现)
2009-03-24 16:10 1403想着手研究一下服务器推技术,看看能不能写出一个web im程序 ... -
使用dhtmltree动态生成树菜单总结
2009-03-19 13:49 5755我之前发布的dhtmltree总 ... -
能够自由拖动布局区域的网页
2009-03-11 09:54 2512<html> <head> <t ... -
jquery+json小例子
2009-02-19 16:08 10045由有不当之处,还望大家能指出。 直接进入主题,使用jquery ... -
在OpenFire的基础上安装JWChat 1.0
2009-02-12 17:57 0http://blog.csdn.net/simonhe197 ... -
JSON介绍
2008-12-11 12:18 2051JSON已经被广泛誉为浏览器中XML的替代品,它的目标仅仅是成 ...
相关推荐
标题 "jforum与web项目的整合(通过Cookie实现SSO)" 涉及的是将开源的JForum论坛系统与其他Web应用程序进行集成,并利用Cookie技术实现单点登录(Single Sign-On,简称SSO)。SSO允许用户在一个应用系统中登录后,...
- 在JForum的Web应用目录下,找到`js`或`scripts`文件夹,创建一个新文件夹,如`ckeditor`,并将CKEditor的JavaScript和CSS文件复制到这里。 - 根据JForum的目录结构,可能还需要将CKEditor的图片和其他资源文件...
《jForum与MS SQLServer整合学习笔记》 jForum是一款基于Java的开源论坛系统,它以其高度可定制性、灵活性和强大的功能深受开发者喜爱。在本文中,我们将深入探讨如何将jForum与Microsoft SQL Server(简称MS SQL...
2. **Servlet和JSP相关jar**:由于jForum是Web应用,因此需要Servlet和JSP相关的jar包,如servlet-api.jar、jsp-api.jar。它们提供了与Web服务器交互的接口,使jForum能够处理HTTP请求,并通过JSP技术生成动态网页...
《JForum 2.1.8 Web工程深度解析与应用指南》 JForum是一个功能强大的、基于Java的开源讨论论坛系统,它提供了丰富的社区管理工具和用户交互功能,深受开发者和社区管理员的喜爱。本篇文章将深入探讨JForum 2.1.8...
**JForum3 完整项目详解** JForum3 是一个基于Java开发的开源论坛系统,提供了丰富的社区交流功能。...通过深入了解JForum3的架构和实现,开发者可以提升在Web应用开发、数据库管理、安全实践等方面的能力。
在与其他Web应用集成时,为了提供无缝的用户体验,通常需要实现单点登录(SSO,Single Sign On)。SSO允许用户在一个系统登录后,无需再次认证即可访问其他关联的系统,提升了用户体验。 JForum的SSO机制主要依赖于...
本指南将详细介绍如何安装与部署jForum,并针对一些常见配置进行说明。 #### 二、环境准备 1. **Java环境**:确保已安装Java Development Kit (JDK) 并正确配置JAVA_HOME环境变量。 2. **Web容器**:如Apache ...
本文将深入探讨JForum3的源代码,帮助开发者了解其内部工作原理,提升对Web应用程序开发的理解。 1. **框架与技术栈** JForum3基于Java编程语言,利用Spring框架进行依赖注入和控制反转,提高了代码的可测试性和...
Jforum提供了与CAS的接口,方便用户在多应用环境中无缝切换。 **Jforum-ppt文件** 在提供的压缩包中,`Jforum-ppt`可能包含关于Jforum的详细讲解或演示材料,如开发教程、架构解析、功能介绍等。通过阅读这些PPT,...
3. **Servlet容器**:由于JForum是一个Web应用程序,它依赖于Servlet容器来运行。你需要在你的Web服务器中配置Servlet容器,例如Tomcat中的`webapps`目录。 4. **Maven或Gradle构建工具**:JForum 3.0 可能使用...
通过深入研究Jforum的源代码,开发者可以了解到Java Web应用的开发模式,包括MVC架构、ORM框架的使用(如Hibernate)、国际化处理、权限控制等方面的知识。同时,这也是学习和理解Web论坛系统设计与实现的一个宝贵...
Java开源论坛JForum是一款基于Java开发的讨论区平台,它为开发者提供了一个高效、功能...通过对JForum的源码学习,开发者可以掌握更多关于Web应用设计和实现的实用技巧,对于个人技术成长和职业发展都有着积极的影响。
5. **部署应用**:将WAR文件部署到Web服务器的应用目录下,启动服务器完成部署。 6. **初始化数据**:访问安装URL,按照向导完成论坛的初始化设置,如管理员账户、默认板块等。 7. **运行论坛**:安装完成后,通过...
这个压缩包“jforum-2.5.0安装包+安装方式.rar”包含了JForum 2.5.0版本的安装文件和相关的安装指南,主要文件为“jforum-2.5.0.war”,这是一个Web应用的归档文件,可以直接部署在支持Servlet和JSP的Web服务器上。...
1. **Java Web开发**:jforum2是一个基于Java的Web应用,利用Servlet和JSP(JavaServer Pages)技术构建,遵循MVC(Model-View-Controller)设计模式。开发者可以通过学习其源码来了解如何在Java环境中开发Web应用。...
数据库架构是任何Web应用程序的核心部分,对于Jforum论坛而言也不例外。一个良好的数据库架构设计能够确保论坛的数据高效、稳定且易于扩展。本文将深入探讨Jforum论坛的数据库架构,分析其设计原则、主要数据表结构...
**正文** JForum是一款基于Java...通过对JForum源码的深度学习,开发者不仅可以掌握FreeMarker的使用,还能了解一个完整的Web应用是如何设计和实现的,对于提升Java Web开发技能和理解大型项目结构有着极大的帮助。
1.2 开发工具选择:Eclipse是一款强大的Java集成开发环境,它提供丰富的插件支持,对于Jforum这样的Web应用开发来说,是理想的选择。通过安装相关的Struts和Hibernate插件,可以在Eclipse中实现无缝的开发体验。 二...