一个Tomcat下部署两个工程a,b,实现普通用户登录a的同时,不用登录可以直接访问b。只可以实现登录一个,如何登录一次,访问两个工程。oaauth.jsp如下<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.fr.fs.base.entity.User,com.fr.fs.base.entity.UserInfo,com.fr.fs.control.UserControl, com.fr.fs.privilege.auth.FSAuthentication,com.fr.fs.privilege.base.FServicePrivilegeLoader, com.fr.fs.privilege.entity.DaoFSAuthentication,com.fr.privilege.session.PrivilegeInfoSessionMananger"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <% // 获取传过来的fr_username值 String username = request.getParameter("fr_username"); System.out.println(username); //如果用户名为空,跳转到登录页面 if(username == null){ response.sendRedirect("/WebReport1/ReportServer?op=fs"); return; } try { User U = UserControl.getInstance().getByUserName(username); //如果报表工程里没有对应传过来的用户名对应的用户信息,跳转到登录页面 if (U == null) { //改成自己的登录界面 response.sendRedirect("/WebReport1/ReportServer?op=fs"); return; } FSAuthentication authentication = new DaoFSAuthentication(new UserInfo(U.getId(), username, username)); long userid = authentication.getUserInfo().getId(); PrivilegeInfoSessionMananger.login(new FServicePrivilegeLoader(username, UserControl.getInstance().getAllSRoleNames(userid), UserControl.getInstance().getUserDP(userid)), session, response); session.setAttribute("fr_fs_auth_key", authentication); UserControl.getInstance().login(userid); //登录后跳转到决策平台地址,可以根据需要设置是否跳转及跳转的地址 response.sendRedirect("/WebReport1/ReportServer?op=fs"); return; } catch (Exception e) { e.printStackTrace(); } %> |
最佳回答 |
||||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|
|||
0
|
|