12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <%@ page language="java" pageEncoding="UTF-8" %>
- <%
- /**
- * 获取认证系统身份服务
- * 身份服务是用来保护其他应用服务的, 用户一般在访问一个受SSOAuth保护的Web应用的某个URL时,
- * 当前这个应用会发现当前的用户还没有登录,便强制将页面转向SSOAuth的login.jsp,让用户登录
- */
- String SSOLoginPage = request.getSession().getServletContext().getInitParameter("SSOLoginPage");
- /**
- * 获取认证系统名称
- */
- String CookieName = request.getSession().getServletContext().getInitParameter("CookieName");
- CookieName = CookieName.toLowerCase().trim();
- /**
- * 获取cookie:客户端的用户信息
- */
- Cookie[] cookies = request.getCookies();
- /**
- * 获取登录标记,期望的cookie值
- */
- Cookie loginCookie = null;
- String cookname = "";
- /**
- * 如果获取到的cookie不为空,进行cookie的校验
- */
- if (cookies != null) {
- for (Cookie cookie : cookies) {
- cookname = cookie.getName().trim().toLowerCase();
- if (CookieName.equals(cookname)) {
- loginCookie = cookie;
- break;
- }
- }
- }
- /**
- * 如果cookie中没有用户登录信息,需要跳转到登录页面去登录
- */
- if (loginCookie == null) {
- String url = request.getRequestURL().toString();
- response.sendRedirect(SSOLoginPage + "?goto=" + url);
- }
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>ssowebdemo1</title>
- <%--在此处,设置jsp无缓存 可以使你再次进入曾经访问过的页面时,浏览器必须从服务端下载最新的内容,达到刷新的效果--%>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <%--搜索关键字 就是用搜索引擎搜索的时候 会和这个关键字匹配 从而找到你的网站--%>
- <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
- <%--用来告诉搜索引擎你的网站主要内容--%>
- <meta http-equiv="description" content="This is my page">
- </head>
- <body>
- <h1 align="center">WELCOME SsoWebDemo1 !</h1>
- </body>
- </html>
|