├── client ├── localhost.cer ├── localhost.keystore ├── src │ └── main │ │ ├── webapp │ │ ├── casFailure.jsp │ │ ├── index.jsp │ │ └── WEB-INF │ │ │ └── web.xml │ │ ├── java │ │ ├── com │ │ │ └── github │ │ │ │ └── zhangkaitao │ │ │ │ └── shiro │ │ │ │ └── chapter15 │ │ │ │ ├── dao │ │ │ │ ├── PermissionDao.java │ │ │ │ ├── RoleDao.java │ │ │ │ ├── UserDao.java │ │ │ │ ├── PermissionDaoImpl.java │ │ │ │ └── RoleDaoImpl.java │ │ │ │ ├── service │ │ │ │ ├── PermissionService.java │ │ │ │ ├── RoleService.java │ │ │ │ ├── PermissionServiceImpl.java │ │ │ │ ├── RoleServiceImpl.java │ │ │ │ ├── UserService.java │ │ │ │ ├── PasswordHelper.java │ │ │ │ └── UserServiceImpl.java │ │ │ │ ├── realm │ │ │ │ ├── MyCasRealm.java │ │ │ │ └── UserRealm.java │ │ │ │ ├── entity │ │ │ │ ├── UserRole.java │ │ │ │ ├── RolePermssion.java │ │ │ │ ├── Role.java │ │ │ │ ├── Permission.java │ │ │ │ └── User.java │ │ │ │ └── credentials │ │ │ │ └── RetryLimitHashedCredentialsMatcher.java │ │ └── io │ │ │ └── github │ │ │ └── howiefh │ │ │ └── cas │ │ │ └── session │ │ │ ├── HashMapBackedSessionMappingStorage.java │ │ │ └── CasLogoutFilter.java │ │ └── resources │ │ ├── resources.properties │ │ ├── ehcache.xml │ │ └── spring-beans.xml └── sql │ └── shiro.sql ├── server └── src │ ├── main │ ├── webapp │ │ ├── favicon.ico │ │ ├── images │ │ │ ├── red.gif │ │ │ ├── error.gif │ │ │ ├── green.gif │ │ │ ├── info.gif │ │ │ ├── confirm.gif │ │ │ ├── login-bg.png │ │ │ ├── login_id.png │ │ │ ├── question.png │ │ │ ├── ja-sig-logo.gif │ │ │ ├── login_pwd.png │ │ │ ├── key-point_bl.gif │ │ │ ├── key-point_br.gif │ │ │ ├── key-point_tl.gif │ │ │ └── key-point_tr.gif │ │ ├── css │ │ │ └── custom-cas.css │ │ ├── WEB-INF │ │ │ ├── view │ │ │ │ └── jsp │ │ │ │ │ ├── protocol │ │ │ │ │ ├── openid │ │ │ │ │ │ ├── casOpenIdAssociationFailureView.jsp │ │ │ │ │ │ ├── casOpenIdServiceFailureView.jsp │ │ │ │ │ │ ├── casOpenIdServiceSuccessView.jsp │ │ │ │ │ │ ├── user.jsp │ │ │ │ │ │ └── casOpenIdAssociationSuccessView.jsp │ │ │ │ │ ├── clearPass │ │ │ │ │ │ ├── clearPassFailure.jsp │ │ │ │ │ │ └── clearPassSuccess.jsp │ │ │ │ │ ├── 2.0 │ │ │ │ │ │ ├── casProxyFailureView.jsp │ │ │ │ │ │ ├── casProxySuccessView.jsp │ │ │ │ │ │ ├── casServiceValidationFailure.jsp │ │ │ │ │ │ └── casServiceValidationSuccess.jsp │ │ │ │ │ ├── 3.0 │ │ │ │ │ │ ├── casServiceValidationFailure.jsp │ │ │ │ │ │ └── casServiceValidationSuccess.jsp │ │ │ │ │ ├── oauth │ │ │ │ │ │ └── confirm.jsp │ │ │ │ │ └── casPostResponseView.jsp │ │ │ │ │ ├── custom │ │ │ │ │ └── ui │ │ │ │ │ │ ├── casBadHoursView.jsp │ │ │ │ │ │ ├── serviceErrorView.jsp │ │ │ │ │ │ ├── casAccountLockedView.jsp │ │ │ │ │ │ ├── casBadWorkstationView.jsp │ │ │ │ │ │ ├── casAccountDisabledView.jsp │ │ │ │ │ │ ├── casExpiredPassView.jsp │ │ │ │ │ │ ├── casConfirmView.jsp │ │ │ │ │ │ ├── casLogoutView.jsp │ │ │ │ │ │ ├── casMustChangePassView.jsp │ │ │ │ │ │ ├── casGenericSuccess.jsp │ │ │ │ │ │ ├── serviceErrorSsoView.jsp │ │ │ │ │ │ ├── casLoginMessageView.jsp │ │ │ │ │ │ └── includes │ │ │ │ │ │ ├── top.jsp │ │ │ │ │ │ └── bottom.jsp │ │ │ │ │ ├── default │ │ │ │ │ └── ui │ │ │ │ │ │ ├── casBadHoursView.jsp │ │ │ │ │ │ ├── serviceErrorView.jsp │ │ │ │ │ │ ├── casAccountLockedView.jsp │ │ │ │ │ │ ├── casAccountDisabledView.jsp │ │ │ │ │ │ ├── casBadWorkstationView.jsp │ │ │ │ │ │ ├── casExpiredPassView.jsp │ │ │ │ │ │ ├── casConfirmView.jsp │ │ │ │ │ │ ├── casMustChangePassView.jsp │ │ │ │ │ │ ├── casLogoutView.jsp │ │ │ │ │ │ ├── casGenericSuccess.jsp │ │ │ │ │ │ ├── serviceErrorSsoView.jsp │ │ │ │ │ │ ├── casLoginMessageView.jsp │ │ │ │ │ │ └── includes │ │ │ │ │ │ ├── top.jsp │ │ │ │ │ │ └── bottom.jsp │ │ │ │ │ ├── errors.jsp │ │ │ │ │ ├── authorizationFailure.jsp │ │ │ │ │ └── monitoring │ │ │ │ │ └── viewStatistics.jsp │ │ │ ├── spring-configuration │ │ │ │ ├── README.txt │ │ │ │ ├── filters.xml │ │ │ │ ├── warnCookieGenerator.xml │ │ │ │ ├── ticketGrantingTicketCookieGenerator.xml │ │ │ │ ├── argumentExtractorsConfiguration.xml │ │ │ │ ├── propertyFileConfigurer.xml │ │ │ │ ├── securityContext.xml │ │ │ │ ├── ticketRegistry.xml │ │ │ │ ├── log4jConfiguration.xml │ │ │ │ ├── uniqueIdGenerators.xml │ │ │ │ └── ticketExpirationPolicies.xml │ │ │ ├── unused-spring-configuration │ │ │ │ ├── lppe-configuration.xml │ │ │ │ └── mbeans.xml │ │ │ ├── logout-webflow.xml │ │ │ └── restlet-servlet.xml │ │ ├── index.jsp │ │ └── js │ │ │ ├── cas.js │ │ │ └── custom-cas.js │ ├── resources │ │ ├── messages_it.properties │ │ ├── cas-theme-default.properties │ │ ├── saml_views.properties │ │ ├── custom_views.properties │ │ ├── default_views.properties │ │ ├── protocol_views.properties │ │ ├── messages_sl.properties │ │ ├── messages_nl.properties │ │ └── messages_ur.properties │ └── java │ │ └── io │ │ └── github │ │ └── howiefh │ │ └── cas │ │ ├── authentication │ │ └── UsernamePasswordCaptchaCredential.java │ │ └── web │ │ └── flow │ │ └── AuthenticationViaFormAction.java │ ├── test │ ├── webtest │ │ ├── README.txt │ │ ├── modules │ │ │ ├── getLogout.xml │ │ │ ├── checkLoginSuccess.xml │ │ │ ├── checkWarnPage.xml │ │ │ ├── getLoginFormWithoutService.xml │ │ │ ├── getLoginFormWithService.xml │ │ │ ├── checkBadCredentials.xml │ │ │ ├── extractServiceTicket.xml │ │ │ ├── verifyLoginForm.xml │ │ │ ├── verifyCookie.xml │ │ │ ├── verifyRedirect.xml │ │ │ └── processLogin.xml │ │ ├── properties │ │ │ ├── local.properties │ │ │ └── canoo.properties │ │ ├── includes │ │ │ ├── definition.xml │ │ │ └── config.xml │ │ ├── proxyCallBackTest │ │ │ ├── index.jsp │ │ │ └── WEB-INF │ │ │ │ └── web.xml │ │ └── build.xml │ └── java │ │ └── org │ │ └── jasig │ │ └── cas │ │ └── WiringTests.java │ └── site │ └── site.xml ├── .gitignore └── README.md /client/localhost.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/client/localhost.cer -------------------------------------------------------------------------------- /client/localhost.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/client/localhost.keystore -------------------------------------------------------------------------------- /server/src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /server/src/main/webapp/images/red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/red.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/error.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/green.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/info.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/info.gif -------------------------------------------------------------------------------- /server/src/main/webapp/css/custom-cas.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/css/custom-cas.css -------------------------------------------------------------------------------- /server/src/main/webapp/images/confirm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/confirm.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/login-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/login-bg.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/login_id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/login_id.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/question.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/ja-sig-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/ja-sig-logo.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/login_pwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/login_pwd.png -------------------------------------------------------------------------------- /server/src/main/webapp/images/key-point_bl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/key-point_bl.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/key-point_br.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/key-point_br.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/key-point_tl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/key-point_tl.gif -------------------------------------------------------------------------------- /server/src/main/webapp/images/key-point_tr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/webapp/images/key-point_tr.gif -------------------------------------------------------------------------------- /server/src/main/resources/messages_it.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/howiefh/framework/HEAD/server/src/main/resources/messages_it.properties -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | server/.classpath 2 | server/.project 3 | server/target/ 4 | server/.settings/ 5 | client/.classpath 6 | client/.project 7 | client/target/ 8 | client/.settings/ 9 | *.log 10 | -------------------------------------------------------------------------------- /client/src/main/webapp/casFailure.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | 3 | 4 | 5 | 6 | 7 | CAS失败了,如错误的Ticket或证书错误等。 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Shiro & CAS 实现单点登录](http://howiefh.github.io/2015/05/19/shiro-cas-single-sign-on) 2 | 3 | 客户端基于开涛shiro教程[第十五章](https://github.com/zhangkaitao/shiro-example/tree/master/shiro-example-chapter15-client) 4 | 5 | cas服务端基于[Jasig CAS](https://github.com/Jasig/cas/releases) 6 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/dao/PermissionDao.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.dao; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Permission; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public interface PermissionDao { 11 | 12 | public Permission createPermission(Permission permission); 13 | 14 | public void deletePermission(Long permissionId); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Permission; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public interface PermissionService { 11 | public Permission createPermission(Permission permission); 12 | public void deletePermission(Long permissionId); 13 | } 14 | -------------------------------------------------------------------------------- /client/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> 3 | 4 | 5 | 6 | 欢迎游客访问,点击登录
7 |
8 | 9 | 欢迎[]登录
点击登出
10 |
11 | 12 | 您有角色admin 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /server/src/test/webtest/README.txt: -------------------------------------------------------------------------------- 1 | See http://www.ja-sig.org/wiki/display/CAS/CAS+Functional+Tests for the descrition of these tests. 2 | 3 | DEPENDENCIES : 4 | - Canoo Webtest 2.5 5 | - The application proxyCallBackTest should be deployed twice an on a trusted Application Server 6 | over HTTPS 7 | 8 | CONFIGURATION FILES : 9 | - properties\canoo.properties 10 | - properties\local.properties : proxyCallBackURL1 and proxyCallBackURL2 should be mapped to 11 | proxyCallBackTest applications. 12 | 13 | USAGE : 14 | - launch build.xml with ANT 15 | 16 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/dao/RoleDao.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.dao; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Role; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public interface RoleDao { 11 | 12 | public Role createRole(Role role); 13 | public void deleteRole(Long roleId); 14 | 15 | public void correlationPermissions(Long roleId, Long... permissionIds); 16 | public void uncorrelationPermissions(Long roleId, Long... permissionIds); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /server/src/main/java/io/github/howiefh/cas/authentication/UsernamePasswordCaptchaCredential.java: -------------------------------------------------------------------------------- 1 | package io.github.howiefh.cas.authentication; 2 | 3 | import javax.validation.constraints.NotNull; 4 | import javax.validation.constraints.Size; 5 | 6 | import org.jasig.cas.authentication.RememberMeUsernamePasswordCredential; 7 | 8 | public class UsernamePasswordCaptchaCredential extends RememberMeUsernamePasswordCredential{ 9 | 10 | private static final long serialVersionUID = -2988130322912201986L; 11 | @NotNull 12 | @Size(min = 1, message = "required.captcha") 13 | private String captcha; 14 | 15 | public String getCaptcha() { 16 | return captcha; 17 | } 18 | 19 | public void setCaptcha(String captcha) { 20 | this.captcha = captcha; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Role; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public interface RoleService { 11 | 12 | 13 | public Role createRole(Role role); 14 | public void deleteRole(Long roleId); 15 | 16 | /** 17 | * 添加角色-权限之间关系 18 | * @param roleId 19 | * @param permissionIds 20 | */ 21 | public void correlationPermissions(Long roleId, Long... permissionIds); 22 | 23 | /** 24 | * 移除角色-权限之间关系 25 | * @param roleId 26 | * @param permissionIds 27 | */ 28 | public void uncorrelationPermissions(Long roleId, Long... permissionIds); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.dao; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.User; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | *

User: Zhang Kaitao 9 | *

Date: 14-1-28 10 | *

Version: 1.0 11 | */ 12 | public interface UserDao { 13 | 14 | public User createUser(User user); 15 | public void updateUser(User user); 16 | public void deleteUser(Long userId); 17 | 18 | public void correlationRoles(Long userId, Long... roleIds); 19 | public void uncorrelationRoles(Long userId, Long... roleIds); 20 | 21 | User findOne(Long userId); 22 | 23 | User findByUsername(String username); 24 | 25 | Set findRoles(String username); 26 | 27 | Set findPermissions(String username); 28 | } 29 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/PermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.dao.PermissionDao; 4 | import com.github.zhangkaitao.shiro.chapter15.entity.Permission; 5 | 6 | /** 7 | *

User: Zhang Kaitao 8 | *

Date: 14-1-28 9 | *

Version: 1.0 10 | */ 11 | public class PermissionServiceImpl implements PermissionService { 12 | 13 | private PermissionDao permissionDao; 14 | 15 | public void setPermissionDao(PermissionDao permissionDao) { 16 | this.permissionDao = permissionDao; 17 | } 18 | 19 | public Permission createPermission(Permission permission) { 20 | return permissionDao.createPermission(permission); 21 | } 22 | 23 | public void deletePermission(Long permissionId) { 24 | permissionDao.deletePermission(permissionId); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/src/main/java/io/github/howiefh/cas/session/HashMapBackedSessionMappingStorage.java: -------------------------------------------------------------------------------- 1 | package io.github.howiefh.cas.session; 2 | 3 | import org.apache.shiro.session.Session; 4 | 5 | import java.io.Serializable; 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * 存储ticket到sessionID的映射 11 | */ 12 | public final class HashMapBackedSessionMappingStorage { 13 | 14 | /** 15 | * Maps the ID from the CAS server to the Session ID. 16 | */ 17 | private final Map MANAGED_SESSIONS_ID = new HashMap(); 18 | 19 | public synchronized void addSessionById(String mappingId, Session session) { 20 | MANAGED_SESSIONS_ID.put(mappingId, session.getId()); 21 | 22 | } 23 | 24 | public synchronized Serializable getSessionIDByMappingId(String mappingId) { 25 | return MANAGED_SESSIONS_ID.get(mappingId); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/getLogout.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /server/src/test/webtest/properties/local.properties: -------------------------------------------------------------------------------- 1 | #Place here your WEBTEST_HOME 2 | 3 | # 4 | # Licensed to Jasig under one or more contributor license 5 | # agreements. See the NOTICE file distributed with this work 6 | # for additional information regarding copyright ownership. 7 | # Jasig licenses this file to you under the Apache License, 8 | # Version 2.0 (the "License"); you may not use this file 9 | # except in compliance with the License. You may obtain a 10 | # copy of the License at the following location: 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | webtest.home=C:/Program Files/Canoo/ 23 | -------------------------------------------------------------------------------- /client/src/main/resources/resources.properties: -------------------------------------------------------------------------------- 1 | ## shiro 2 | shiro.session.timeout=1800000 3 | shiro.session.validate.timespan=1800000 4 | # cas\u767B\u5F55URL 5 | shiro.login.url=https://localhost:8443/cas-server/login?service=https://localhost:8443/cas-client/cas 6 | # cas logout 7 | shiro.logout.url=https://localhost:8443/cas-server/logout?service=https://localhost:8443/cas-client 8 | # cas\u767B\u5F55\u6210\u529F\u8DF3\u8F6CURL 9 | shiro.login.success.url=https://localhost:8443/cas-client 10 | # cas\u670D\u52A1\u5668URL 11 | shiro.casServer.url=https://localhost:8443/cas-server 12 | # \u5BA2\u6237\u7AEFCAS\u767B\u5F55URL 13 | shiro.client.cas=https://localhost:8443/cas-client/cas 14 | # \u5BA2\u6237\u7AEFCAS\u9A8C\u8BC1\u5931\u8D25\u8DF3\u8F6CURL 15 | shiro.failureUrl=/casFailure.jsp 16 | 17 | ## dataSource 18 | dataSource.driver=com.mysql.jdbc.Driver 19 | dataSource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8 20 | dataSource.username=root 21 | dataSource.password=123456 -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/openid/casOpenIdAssociationFailureView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%= "openid.mode:cancel\n" %> -------------------------------------------------------------------------------- /server/src/test/webtest/modules/checkLoginSuccess.xml: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/openid/casOpenIdServiceFailureView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%= "openid.mode:id_res\nis_valid:false\n" %> -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/openid/casOpenIdServiceSuccessView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%= "openid.mode:id_res\nis_valid:true\n" %> -------------------------------------------------------------------------------- /server/src/test/webtest/modules/checkWarnPage.xml: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/getLoginFormWithoutService.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/openid/user.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/getLoginFormWithService.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /server/src/main/resources/cas-theme-default.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to Jasig under one or more contributor license 3 | # agreements. See the NOTICE file distributed with this work 4 | # for additional information regarding copyright ownership. 5 | # Jasig licenses this file to you under the Apache License, 6 | # Version 2.0 (the "License"); you may not use this file 7 | # except in compliance with the License. You may obtain a 8 | # copy of the License at the following location: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | #standard.custom.css.file=/css/cas.css 21 | #cas.javascript.file=/js/cas.js 22 | standard.custom.css.file=/css/custom-cas.css 23 | cas.javascript.file=/js/custom-cas.js 24 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/checkBadCredentials.xml: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/extractServiceTicket.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | def m = step.webtestProperties.location; 23 | step.setWebtestProperty('serviceTicket',m.substring(m.indexOf("ST-")),'dynamic'); 24 | -------------------------------------------------------------------------------- /server/src/main/resources/saml_views.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to Jasig under one or more contributor license 3 | # agreements. See the NOTICE file distributed with this work 4 | # for additional information regarding copyright ownership. 5 | # Jasig licenses this file to you under the Apache License, 6 | # Version 2.0 (the "License"); you may not use this file 7 | # except in compliance with the License. You may obtain a 8 | # copy of the License at the following location: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | ### SAML Views 21 | casSamlServiceSuccessView.(class)=org.jasig.cas.support.saml.web.view.Saml10SuccessResponseView 22 | casSamlServiceSuccessView.issuer=localhost 23 | 24 | casSamlServiceFailureView.(class)=org.jasig.cas.support.saml.web.view.Saml10FailureResponseView 25 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/verifyLoginForm.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /server/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page language="java" session="false" %> 22 | 23 | <% 24 | final String queryString = request.getQueryString(); 25 | final String url = request.getContextPath() + "/login" + (queryString != null ? "?" + queryString : ""); 26 | response.sendRedirect(response.encodeURL(url));%> 27 | -------------------------------------------------------------------------------- /server/src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 |

25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/realm/MyCasRealm.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.realm; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.service.UserService; 4 | import org.apache.shiro.authz.AuthorizationInfo; 5 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 6 | import org.apache.shiro.cas.CasRealm; 7 | import org.apache.shiro.subject.PrincipalCollection; 8 | 9 | /** 10 | *

User: Zhang Kaitao 11 | *

Date: 14-2-13 12 | *

Version: 1.0 13 | */ 14 | public class MyCasRealm extends CasRealm { 15 | 16 | private UserService userService; 17 | 18 | public void setUserService(UserService userService) { 19 | this.userService = userService; 20 | } 21 | 22 | @Override 23 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { 24 | String username = (String)principals.getPrimaryPrincipal(); 25 | 26 | SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); 27 | authorizationInfo.setRoles(userService.findRoles(username)); 28 | authorizationInfo.setStringPermissions(userService.findPermissions(username)); 29 | 30 | return authorizationInfo; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/src/test/webtest/includes/definition.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casBadHoursView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |

23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casBadHoursView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/serviceErrorView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/serviceErrorView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/errors.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casAccountLockedView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casBadWorkstationView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casAccountLockedView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casAccountDisabledView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casAccountDisabledView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casBadWorkstationView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/verifyCookie.xml: -------------------------------------------------------------------------------- 1 | 21 | 23 | 25 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/clearPass/clearPassFailure.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 23 | 24 | ${fn:escapeXml(description)} 25 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casExpiredPassView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casExpiredPassView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casConfirmView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |
25 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casConfirmView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |
25 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casLogoutView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |

26 |
27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casMustChangePassView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casMustChangePassView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |
26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/2.0/casProxyFailureView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 23 | 24 | 25 | ${fn:escapeXml(description)} 26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casLogoutView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |

26 |
27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/2.0/casProxySuccessView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 23 | 24 | 25 | ${fn:escapeXml(ticket)} 26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casGenericSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |

26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casGenericSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 |

25 |

26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /server/src/test/webtest/proxyCallBackTest/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <% 22 | if( request.getParameter("pgtId") != null ) { 23 | System.out.println("Set PGT : #" + request.getParameter("pgtId") + "#"); 24 | application.setAttribute("pgtId",request.getParameter("pgtId")); 25 | } else { 26 | System.out.println("Get PGT : #" + application.getAttribute("pgtId") + "#"); 27 | out.println("PGT: #" + application.getAttribute("pgtId") + "#"); 28 | } 29 | %> -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/2.0/casServiceValidationFailure.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 23 | 24 | 25 | ${fn:escapeXml(description)} 26 | 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/3.0/casServiceValidationFailure.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 23 | 24 | 25 | ${fn:escapeXml(description)} 26 | 27 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/verifyRedirect.xml: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /client/src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 23 | 24 | 25 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /server/src/test/webtest/proxyCallBackTest/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | Welcome to PGTest 28 | 29 | PGTest 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/openid/casOpenIdAssociationSuccessView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page import="java.util.Set, java.util.Map, java.util.Iterator" %> 22 | <% 23 | Map parameters = (Map)request.getAttribute("parameters"); 24 | Iterator iterator = parameters.keySet().iterator(); 25 | while (iterator.hasNext()) { 26 | String key = (String)iterator.next(); 27 | String parameter = (String)parameters.get(key); 28 | out.print(key+":"+parameter+"\n"); 29 | } 30 | %> -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/clearPass/clearPassSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 23 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 24 | 25 | 26 | ${fn:escapeXml(credentials)} 27 | 28 | -------------------------------------------------------------------------------- /server/src/test/webtest/properties/canoo.properties: -------------------------------------------------------------------------------- 1 | #Option for canoo web test 2 | 3 | # 4 | # Licensed to Jasig under one or more contributor license 5 | # agreements. See the NOTICE file distributed with this work 6 | # for additional information regarding copyright ownership. 7 | # Jasig licenses this file to you under the Apache License, 8 | # Version 2.0 (the "License"); you may not use this file 9 | # except in compliance with the License. You may obtain a 10 | # copy of the License at the following location: 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | host=localhost 23 | port=8443 24 | protocol=https 25 | basepath=cas 26 | haltonfailure=true 27 | haltonerror=true 28 | showhtmlparseroutput=true 29 | autorefresh=true 30 | saveresponse=true 31 | resultpath=${basedir}/../../../target/webtest 32 | resultfile=webtest-raw-report.xml 33 | summary=true 34 | 35 | #Proxy Call Back Test Application 36 | proxyCallBackURL1=https://localhost/proxyCallBackTest1/index.jsp 37 | proxyCallBackURL2=https://localhost/proxyCallBackTest2/index.jsp -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.dao.RoleDao; 4 | import com.github.zhangkaitao.shiro.chapter15.entity.Role; 5 | 6 | /** 7 | *

User: Zhang Kaitao 8 | *

Date: 14-1-28 9 | *

Version: 1.0 10 | */ 11 | public class RoleServiceImpl implements RoleService { 12 | 13 | private RoleDao roleDao; 14 | 15 | public RoleDao getRoleDao() { 16 | return roleDao; 17 | } 18 | 19 | public void setRoleDao(RoleDao roleDao) { 20 | this.roleDao = roleDao; 21 | } 22 | 23 | public Role createRole(Role role) { 24 | return roleDao.createRole(role); 25 | } 26 | 27 | public void deleteRole(Long roleId) { 28 | roleDao.deleteRole(roleId); 29 | } 30 | 31 | /** 32 | * 添加角色-权限之间关系 33 | * @param roleId 34 | * @param permissionIds 35 | */ 36 | public void correlationPermissions(Long roleId, Long... permissionIds) { 37 | roleDao.correlationPermissions(roleId, permissionIds); 38 | } 39 | 40 | /** 41 | * 移除角色-权限之间关系 42 | * @param roleId 43 | * @param permissionIds 44 | */ 45 | public void uncorrelationPermissions(Long roleId, Long... permissionIds) { 46 | roleDao.uncorrelationPermissions(roleId, permissionIds); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /server/src/test/webtest/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/serviceErrorSsoView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | 27 |

28 |

29 |

30 |
31 | 32 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/serviceErrorSsoView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |

29 |

30 |
31 | 32 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/README.txt: -------------------------------------------------------------------------------- 1 | INTRODUCTION 2 | The spring-configuration directory is a "convention-over-configuration" option 3 | for CAS deployers. It allows you to drop a Spring XML configuration file into 4 | this directory and have CAS automatically find it (after the typical application 5 | restart). It eliminates the need for you to register that file in the web.xml 6 | 7 | ADVANTAGES 8 | By automatically breaking the configuration into smaller "bite-sized" pieces 9 | you can easily override small components of CAS without worrying about merging 10 | huge pieces of configurations files together later. 11 | 12 | The configuration-over-convention option also allows you to add new configuration 13 | options without editing existing configuration files. 14 | 15 | This should make tracking changes and maintaining local modifications easier. 16 | 17 | GOTCHAS AND THINGS TO WATCH OUT FOR 18 | If you name a local bean and an existing bean the same thing, there will be a major 19 | collision. Deployment will fail. The sky will fall! (okay that last part isn't 20 | true). Spring will be merging all of these files together so every bean must 21 | have unique names. The only way around this is if you override the file completely. 22 | i.e. override the ticketRegistry.xml allows you to re-use the "ticketRegistry" 23 | id. 24 | 25 | In addition, if there is a typographical/XML parsing error in a file, the 26 | application will not deploy. 27 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/oauth/confirm.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 |
23 |

24 | 25 |

26 | 27 |

28 |

29 | 30 |

31 |
32 | 33 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.User; 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | *

User: Zhang Kaitao 9 | *

Date: 14-1-28 10 | *

Version: 1.0 11 | */ 12 | public interface UserService { 13 | 14 | /** 15 | * 创建用户 16 | * @param user 17 | */ 18 | public User createUser(User user); 19 | 20 | /** 21 | * 修改密码 22 | * @param userId 23 | * @param newPassword 24 | */ 25 | public void changePassword(Long userId, String newPassword); 26 | 27 | /** 28 | * 添加用户-角色关系 29 | * @param userId 30 | * @param roleIds 31 | */ 32 | public void correlationRoles(Long userId, Long... roleIds); 33 | 34 | 35 | /** 36 | * 移除用户-角色关系 37 | * @param userId 38 | * @param roleIds 39 | */ 40 | public void uncorrelationRoles(Long userId, Long... roleIds); 41 | 42 | /** 43 | * 根据用户名查找用户 44 | * @param username 45 | * @return 46 | */ 47 | public User findByUsername(String username); 48 | 49 | /** 50 | * 根据用户名查找其角色 51 | * @param username 52 | * @return 53 | */ 54 | public Set findRoles(String username); 55 | 56 | /** 57 | * 根据用户名查找其权限 58 | * @param username 59 | * @return 60 | */ 61 | public Set findPermissions(String username); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/casLoginMessageView.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | 4 | Licensed to Jasig under one or more contributor license 5 | agreements. See the NOTICE file distributed with this work 6 | for additional information regarding copyright ownership. 7 | Jasig licenses this file to you under the Apache License, 8 | Version 2.0 (the "License"); you may not use this file 9 | except in compliance with the License. You may obtain a 10 | copy of the License at the following location: 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | 21 | --%> 22 | 23 | 24 |

25 |

Authentication Succeeded with Warnings

26 | 27 | 28 |

${message.text}

29 |
30 | 31 |
32 | 33 |
34 | Continue 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/casLoginMessageView.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | 4 | Licensed to Jasig under one or more contributor license 5 | agreements. See the NOTICE file distributed with this work 6 | for additional information regarding copyright ownership. 7 | Jasig licenses this file to you under the Apache License, 8 | Version 2.0 (the "License"); you may not use this file 9 | except in compliance with the License. You may obtain a 10 | copy of the License at the following location: 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | 21 | --%> 22 | 23 | 24 |
25 |

Authentication Succeeded with Warnings

26 | 27 | 28 |

${message.text}

29 |
30 | 31 |
32 | 33 |
34 | Continue 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/filters.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 29 | -------------------------------------------------------------------------------- /server/src/test/webtest/includes/config.xml: -------------------------------------------------------------------------------- 1 | 21 | 34 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/PasswordHelper.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.User; 4 | import org.apache.shiro.crypto.RandomNumberGenerator; 5 | import org.apache.shiro.crypto.SecureRandomNumberGenerator; 6 | import org.apache.shiro.crypto.hash.SimpleHash; 7 | import org.apache.shiro.util.ByteSource; 8 | 9 | /** 10 | *

User: Zhang Kaitao 11 | *

Date: 14-1-28 12 | *

Version: 1.0 13 | */ 14 | public class PasswordHelper { 15 | 16 | private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator(); 17 | private String algorithmName = "md5"; 18 | private int hashIterations = 2; 19 | 20 | public void setRandomNumberGenerator(RandomNumberGenerator randomNumberGenerator) { 21 | this.randomNumberGenerator = randomNumberGenerator; 22 | } 23 | 24 | public void setAlgorithmName(String algorithmName) { 25 | this.algorithmName = algorithmName; 26 | } 27 | 28 | public void setHashIterations(int hashIterations) { 29 | this.hashIterations = hashIterations; 30 | } 31 | 32 | public void encryptPassword(User user) { 33 | 34 | user.setSalt(randomNumberGenerator.nextBytes().toHex()); 35 | 36 | String newPassword = new SimpleHash( 37 | algorithmName, 38 | user.getPassword(), 39 | ByteSource.Util.bytes(user.getCredentialsSalt()), 40 | hashIterations).toHex(); 41 | 42 | user.setPassword(newPassword); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/entity/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 用户角色关系 7 | *

User: Zhang Kaitao 8 | *

Date: 14-1-28 9 | *

Version: 1.0 10 | */ 11 | public class UserRole implements Serializable { 12 | 13 | private Long userId; 14 | private Long roleId; 15 | 16 | public Long getUserId() { 17 | return userId; 18 | } 19 | 20 | public void setUserId(Long userId) { 21 | this.userId = userId; 22 | } 23 | 24 | public Long getRoleId() { 25 | return roleId; 26 | } 27 | 28 | public void setRoleId(Long roleId) { 29 | this.roleId = roleId; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) return true; 35 | if (o == null || getClass() != o.getClass()) return false; 36 | 37 | UserRole userRole = (UserRole) o; 38 | 39 | if (roleId != null ? !roleId.equals(userRole.roleId) : userRole.roleId != null) return false; 40 | if (userId != null ? !userId.equals(userRole.userId) : userRole.userId != null) return false; 41 | 42 | return true; 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | int result = userId != null ? userId.hashCode() : 0; 48 | result = 31 * result + (roleId != null ? roleId.hashCode() : 0); 49 | return result; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "UserRole{" + 55 | "userId=" + userId + 56 | ", roleId=" + roleId + 57 | '}'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /server/src/main/webapp/js/cas.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Jasig under one or more contributor license 3 | * agreements. See the NOTICE file distributed with this work 4 | * for additional information regarding copyright ownership. 5 | * Jasig licenses this file to you under the Apache License, 6 | * Version 2.0 (the "License"); you may not use this file 7 | * except in compliance with the License. You may obtain a 8 | * copy of the License at the following location: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | $(document).ready(function(){ 21 | //focus username field 22 | $("input:visible:enabled:first").focus(); 23 | //flash error box 24 | $('#msg.errors').animate({ backgroundColor: 'rgb(187,0,0)' }, 30).animate({ backgroundColor: 'rgb(255,238,221)' }, 500); 25 | 26 | //flash success box 27 | $('#msg.success').animate({ backgroundColor: 'rgb(51,204,0)' }, 30).animate({ backgroundColor: 'rgb(221,255,170)' }, 500); 28 | 29 | //flash confirm box 30 | $('#msg.question').animate({ backgroundColor: 'rgb(51,204,0)' }, 30).animate({ backgroundColor: 'rgb(221,255,170)' }, 500); 31 | 32 | /* 33 | * Using the JavaScript Debug library, you may issue log messages such as: 34 | * debug.log("Welcome to Central Authentication Service"); 35 | */ 36 | }); 37 | -------------------------------------------------------------------------------- /server/src/main/webapp/js/custom-cas.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Jasig under one or more contributor license 3 | * agreements. See the NOTICE file distributed with this work 4 | * for additional information regarding copyright ownership. 5 | * Jasig licenses this file to you under the Apache License, 6 | * Version 2.0 (the "License"); you may not use this file 7 | * except in compliance with the License. You may obtain a 8 | * copy of the License at the following location: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | $(document).ready(function(){ 21 | //focus username field 22 | $("input:visible:enabled:first").focus(); 23 | //flash error box 24 | $('#msg.errors').animate({ backgroundColor: 'rgb(187,0,0)' }, 30).animate({ backgroundColor: 'rgb(255,238,221)' }, 500); 25 | 26 | //flash success box 27 | $('#msg.success').animate({ backgroundColor: 'rgb(51,204,0)' }, 30).animate({ backgroundColor: 'rgb(221,255,170)' }, 500); 28 | 29 | //flash confirm box 30 | $('#msg.question').animate({ backgroundColor: 'rgb(51,204,0)' }, 30).animate({ backgroundColor: 'rgb(221,255,170)' }, 500); 31 | 32 | /* 33 | * Using the JavaScript Debug library, you may issue log messages such as: 34 | * debug.log("Welcome to Central Authentication Service"); 35 | */ 36 | }); 37 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/casPostResponseView.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page language="java" session="false"%> 22 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 23 | 24 | 25 |

" method="post"> 26 |
27 | 28 | 29 | 30 |
31 | 35 |
36 | 37 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/entity/RolePermssion.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 用户角色关系 7 | *

User: Zhang Kaitao 8 | *

Date: 14-1-28 9 | *

Version: 1.0 10 | */ 11 | public class RolePermssion implements Serializable { 12 | 13 | private Long roleId; 14 | private Long permissionId; 15 | 16 | public Long getRoleId() { 17 | return roleId; 18 | } 19 | 20 | public void setRoleId(Long roleId) { 21 | this.roleId = roleId; 22 | } 23 | 24 | public Long getPermissionId() { 25 | return permissionId; 26 | } 27 | 28 | public void setPermissionId(Long permissionId) { 29 | this.permissionId = permissionId; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) return true; 35 | if (o == null || getClass() != o.getClass()) return false; 36 | 37 | RolePermssion that = (RolePermssion) o; 38 | 39 | if (permissionId != null ? !permissionId.equals(that.permissionId) : that.permissionId != null) return false; 40 | if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null) return false; 41 | 42 | return true; 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | int result = roleId != null ? roleId.hashCode() : 0; 48 | result = 31 * result + (permissionId != null ? permissionId.hashCode() : 0); 49 | return result; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "RolePermssion{" + 55 | "roleId=" + roleId + 56 | ", permissionId=" + permissionId + 57 | '}'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /client/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | contextConfigLocation 12 | 13 | classpath:spring-beans.xml, 14 | 15 | 16 | 17 | org.springframework.web.context.ContextLoaderListener 18 | 19 | 20 | 21 | 22 | 23 | 24 | shiroFilter 25 | org.springframework.web.filter.DelegatingFilterProxy 26 | true 27 | 28 | targetFilterLifecycle 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | shiroFilter 38 | /* 39 | 40 | 41 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/warnCookieGenerator.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | This Spring Configuration file describes the cookie used to store the WARN parameter so that a user is warned whenever the CAS service 28 | is used. You would modify this if you wanted to change the cookie path or the name. 29 | 30 | 31 | 36 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/credentials/RetryLimitHashedCredentialsMatcher.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.credentials; 2 | 3 | import org.apache.shiro.authc.AuthenticationInfo; 4 | import org.apache.shiro.authc.AuthenticationToken; 5 | import org.apache.shiro.authc.ExcessiveAttemptsException; 6 | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; 7 | import org.apache.shiro.cache.Cache; 8 | import org.apache.shiro.cache.CacheManager; 9 | 10 | import java.util.concurrent.atomic.AtomicInteger; 11 | 12 | /** 13 | *

User: Zhang Kaitao 14 | *

Date: 14-1-28 15 | *

Version: 1.0 16 | */ 17 | public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher { 18 | 19 | private Cache passwordRetryCache; 20 | 21 | public RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) { 22 | passwordRetryCache = cacheManager.getCache("passwordRetryCache"); 23 | } 24 | 25 | @Override 26 | public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { 27 | String username = (String)token.getPrincipal(); 28 | //retry count + 1 29 | AtomicInteger retryCount = passwordRetryCache.get(username); 30 | if(retryCount == null) { 31 | retryCount = new AtomicInteger(0); 32 | passwordRetryCache.put(username, retryCount); 33 | } 34 | if(retryCount.incrementAndGet() > 5) { 35 | //if retry count > 5 throw 36 | throw new ExcessiveAttemptsException(); 37 | } 38 | 39 | boolean matches = super.doCredentialsMatch(token, info); 40 | if(matches) { 41 | //clear retry count 42 | passwordRetryCache.remove(username); 43 | } 44 | return matches; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | Defines the cookie that stores the TicketGrantingTicket. You most likely should never modify these (especially the "secure" property). 28 | You can change the name if you want to make it harder for people to guess. 29 | 30 | 36 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/argumentExtractorsConfiguration.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 28 | 29 | Argument Extractors are what are used to translate HTTP requests into requests of the appropriate protocol (i.e. CAS, SAML, SAML2, 30 | OpenId, etc.). By default, only CAS is enabled. 31 | 32 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/2.0/casServiceValidationSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 23 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 24 | 25 | 26 | ${fn:escapeXml(assertion.primaryAuthentication.principal.id)} 27 | 28 | ${pgtIou} 29 | 30 | 31 | 32 | 33 | ${fn:escapeXml(proxy.principal.id)} 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/dao/PermissionDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.dao; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Permission; 4 | import org.springframework.jdbc.core.PreparedStatementCreator; 5 | import org.springframework.jdbc.core.support.JdbcDaoSupport; 6 | import org.springframework.jdbc.support.GeneratedKeyHolder; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.SQLException; 11 | 12 | /** 13 | *

User: Zhang Kaitao 14 | *

Date: 14-1-28 15 | *

Version: 1.0 16 | */ 17 | public class PermissionDaoImpl extends JdbcDaoSupport implements PermissionDao { 18 | 19 | public Permission createPermission(final Permission permission) { 20 | final String sql = "insert into sys_permissions(permission, description, available) values(?,?,?)"; 21 | 22 | GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); 23 | getJdbcTemplate().update(new PreparedStatementCreator() { 24 | @Override 25 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 26 | PreparedStatement psst = connection.prepareStatement(sql, new String[]{"id"}); 27 | psst.setString(1, permission.getPermission()); 28 | psst.setString(2, permission.getDescription()); 29 | psst.setBoolean(3, permission.getAvailable()); 30 | return psst; 31 | } 32 | }, keyHolder); 33 | permission.setId(keyHolder.getKey().longValue()); 34 | 35 | return permission; 36 | } 37 | 38 | public void deletePermission(Long permissionId) { 39 | //首先把与permission关联的相关表的数据删掉 40 | String sql = "delete from sys_roles_permissions where permission_id=?"; 41 | getJdbcTemplate().update(sql, permissionId); 42 | 43 | sql = "delete from sys_permissions where id=?"; 44 | getJdbcTemplate().update(sql, permissionId); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /client/sql/shiro.sql: -------------------------------------------------------------------------------- 1 | drop table if exists sys_users; 2 | drop table if exists sys_roles; 3 | drop table if exists sys_permissions; 4 | drop table if exists sys_users_roles; 5 | drop table if exists sys_roles_permissions; 6 | 7 | create table sys_users ( 8 | id bigint auto_increment, 9 | username varchar(100), 10 | password varchar(100), 11 | salt varchar(100), 12 | locked bool default false, 13 | constraint pk_sys_users primary key(id) 14 | ) charset=utf8 ENGINE=InnoDB; 15 | create unique index idx_sys_users_username on sys_users(username); 16 | 17 | create table sys_roles ( 18 | id bigint auto_increment, 19 | role varchar(100), 20 | description varchar(100), 21 | available bool default false, 22 | constraint pk_sys_roles primary key(id) 23 | ) charset=utf8 ENGINE=InnoDB; 24 | create unique index idx_sys_roles_role on sys_roles(role); 25 | 26 | create table sys_permissions ( 27 | id bigint auto_increment, 28 | permission varchar(100), 29 | description varchar(100), 30 | available bool default false, 31 | constraint pk_sys_permissions primary key(id) 32 | ) charset=utf8 ENGINE=InnoDB; 33 | create unique index idx_sys_permissions_permission on sys_permissions(permission); 34 | 35 | create table sys_users_roles ( 36 | user_id bigint, 37 | role_id bigint, 38 | constraint pk_sys_users_roles primary key(user_id, role_id) 39 | ) charset=utf8 ENGINE=InnoDB; 40 | 41 | create table sys_roles_permissions ( 42 | role_id bigint, 43 | permission_id bigint, 44 | constraint pk_sys_roles_permissions primary key(role_id, permission_id) 45 | ) charset=utf8 ENGINE=InnoDB; 46 | 47 | -- md5("password") 5f4dcc3b5aa765d61d8327deb882cf99 48 | INSERT INTO `sys_users` (`id`, `username`, `password`, `salt`, `locked`) VALUES ('2', 't1', '5f4dcc3b5aa765d61d8327deb882cf99', '', '0'); 49 | -- SimpleHash("md5","123456","8d78869f470951332959580424d4bf4f",2) dd3736d1c3c4702e5170cde08bffd411 50 | INSERT INTO `sys_users` (`id`, `username`, `password`, `salt`, `locked`) VALUES ('3', 't2', 'dd3736d1c3c4702e5170cde08bffd411', '8d78869f470951332959580424d4bf4f', '0'); 51 | 52 | -------------------------------------------------------------------------------- /server/src/main/java/io/github/howiefh/cas/web/flow/AuthenticationViaFormAction.java: -------------------------------------------------------------------------------- 1 | package io.github.howiefh.cas.web.flow; 2 | 3 | import io.github.howiefh.cas.authentication.UsernamePasswordCaptchaCredential; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpSession; 7 | 8 | import org.jasig.cas.authentication.Credential; 9 | import org.jasig.cas.web.support.WebUtils; 10 | import org.springframework.binding.message.MessageBuilder; 11 | import org.springframework.binding.message.MessageContext; 12 | import org.springframework.util.StringUtils; 13 | import org.springframework.webflow.execution.RequestContext; 14 | 15 | public class AuthenticationViaFormAction extends org.jasig.cas.web.flow.AuthenticationViaFormAction{ 16 | 17 | public final String validatorCaptcha(final RequestContext context, final Credential credential, 18 | final MessageContext messageContext){ 19 | 20 | final HttpServletRequest request = WebUtils.getHttpServletRequest(context); 21 | HttpSession session = request.getSession(); 22 | String captcha = (String)session.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); 23 | session.removeAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); 24 | 25 | UsernamePasswordCaptchaCredential upc = (UsernamePasswordCaptchaCredential)credential; 26 | String submitAuthcodeCaptcha =upc.getCaptcha(); 27 | 28 | 29 | if(!StringUtils.hasText(submitAuthcodeCaptcha) || !StringUtils.hasText(submitAuthcodeCaptcha)){ 30 | messageContext.addMessage(new MessageBuilder().code("required.captcha").build()); 31 | return "error"; 32 | } 33 | if(submitAuthcodeCaptcha.equals(captcha)){ 34 | return "success"; 35 | } 36 | messageContext.addMessage(new MessageBuilder().code("error.authentication.captcha.bad").build()); 37 | return "error"; 38 | } 39 | } -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/propertyFileConfigurer.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 28 | 29 | This file lets CAS know where you've stored the cas.properties file which details some of the configuration options 30 | that are specific to your environment. You can specify the location of the file here. You may wish to place the file outside 31 | of the Servlet context if you have options that are specific to a tier (i.e. test vs. production) so that the WAR file 32 | can be moved between tiers without modification. 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/includes/top.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | <%@ page pageEncoding="UTF-8" %> 24 | <%@ page contentType="text/html; charset=UTF-8" %> 25 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 26 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 27 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 28 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 29 | 30 | 31 | 32 | 33 | 34 | CAS – Central Authentication Service 35 | 36 | 37 | " /> 38 | " type="image/x-icon" /> 39 | 40 | 43 | 44 | 45 |

46 |
47 | 48 |

Central Authentication Service (CAS)

49 |
50 |
51 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/default/ui/includes/bottom.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 22 | 23 |
24 | 25 | 31 | 32 |
33 | 34 | 35 | 36 | 37 | <%-- 38 | JavaScript Debug: A simple wrapper for console.log 39 | See this link for more info: http://benalman.com/projects/javascript-debug-console-log/ 40 | --%> 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/includes/top.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | <%@ page pageEncoding="UTF-8" %> 24 | <%@ page contentType="text/html; charset=UTF-8" %> 25 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 26 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> 27 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 28 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 29 | 30 | 31 | 32 | 33 | 34 | CAS – Central Authentication Service 35 | 36 | 37 | " /> 38 | " type="image/x-icon" /> 39 | 40 | 43 | 44 | 45 |
46 |
47 | 48 |

Central Authentication Service (CAS)

49 |
50 |
51 |
52 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public class Role implements Serializable { 11 | private Long id; 12 | private String role; //角色标识 程序中判断使用,如"admin" 13 | private String description; //角色描述,UI界面显示使用 14 | private Boolean available = Boolean.FALSE; //是否可用,如果不可用将不会添加给用户 15 | 16 | public Role() { 17 | } 18 | 19 | public Role(String role, String description, Boolean available) { 20 | this.role = role; 21 | this.description = description; 22 | this.available = available; 23 | } 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getRole() { 34 | return role; 35 | } 36 | 37 | public void setRole(String role) { 38 | this.role = role; 39 | } 40 | 41 | public String getDescription() { 42 | return description; 43 | } 44 | 45 | public void setDescription(String description) { 46 | this.description = description; 47 | } 48 | 49 | public Boolean getAvailable() { 50 | return available; 51 | } 52 | 53 | public void setAvailable(Boolean available) { 54 | this.available = available; 55 | } 56 | 57 | @Override 58 | public boolean equals(Object o) { 59 | if (this == o) return true; 60 | if (o == null || getClass() != o.getClass()) return false; 61 | 62 | Role role = (Role) o; 63 | 64 | if (id != null ? !id.equals(role.id) : role.id != null) return false; 65 | 66 | return true; 67 | } 68 | 69 | @Override 70 | public int hashCode() { 71 | return id != null ? id.hashCode() : 0; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "Role{" + 77 | "id=" + id + 78 | ", role='" + role + '\'' + 79 | ", description='" + description + '\'' + 80 | ", available=" + available + 81 | '}'; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/unused-spring-configuration/lppe-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /server/src/test/webtest/modules/processLogin.xml: -------------------------------------------------------------------------------- 1 | 21 | &getLoginFormWithService; 22 | &verifyLoginForm; 23 | 41 | 42 | 43 | 44 | 45 | 46 | &verifyCookie; 47 | &verifyRedirect; 48 | &extractServiceTicket; -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/securityContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 28 | 29 | 30 | Security configuration for sensitive areas of CAS : status and statistics. 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/ticketRegistry.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | Configuration for the default TicketRegistry which stores the tickets in-memory and cleans them out as specified intervals. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 42 | 43 | 47 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/entity/Permission.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public class Permission implements Serializable { 11 | private Long id; 12 | private String permission; //权限标识 程序中判断使用,如"user:create" 13 | private String description; //权限描述,UI界面显示使用 14 | private Boolean available = Boolean.FALSE; //是否可用,如果不可用将不会添加给用户 15 | 16 | public Permission() { 17 | } 18 | 19 | public Permission(String permission, String description, Boolean available) { 20 | this.permission = permission; 21 | this.description = description; 22 | this.available = available; 23 | } 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getPermission() { 34 | return permission; 35 | } 36 | 37 | public void setPermission(String permission) { 38 | this.permission = permission; 39 | } 40 | 41 | public String getDescription() { 42 | return description; 43 | } 44 | 45 | public void setDescription(String description) { 46 | this.description = description; 47 | } 48 | 49 | public Boolean getAvailable() { 50 | return available; 51 | } 52 | 53 | public void setAvailable(Boolean available) { 54 | this.available = available; 55 | } 56 | 57 | @Override 58 | public boolean equals(Object o) { 59 | if (this == o) return true; 60 | if (o == null || getClass() != o.getClass()) return false; 61 | 62 | Permission role = (Permission) o; 63 | 64 | if (id != null ? !id.equals(role.id) : role.id != null) return false; 65 | 66 | return true; 67 | } 68 | 69 | @Override 70 | public int hashCode() { 71 | return id != null ? id.hashCode() : 0; 72 | } 73 | 74 | @Override 75 | public String toString() { 76 | return "Role{" + 77 | "id=" + id + 78 | ", permission='" + permission + '\'' + 79 | ", description='" + description + '\'' + 80 | ", available=" + available + 81 | '}'; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/log4jConfiguration.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 28 | 29 | 30 | Log4J initialization. Configuration options are sourced from cas.properties. This allows deployers to externalize 31 | both cas.properties and log4j.xml, so that a single cas.war file can be deployed to multiple tiers or hosts without 32 | having to do any post configuration. This approach helps to preserve configuration between upgrades. 33 | 34 | Deployers should not have to edit this file. 35 | 36 | 37 | 39 | 40 | 41 | ${log4j.config.location:classpath:log4j.xml} 42 | ${log4j.refresh.interval:60000} 43 | 44 | 45 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/logout-webflow.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | *

User: Zhang Kaitao 7 | *

Date: 14-1-28 8 | *

Version: 1.0 9 | */ 10 | public class User implements Serializable { 11 | private Long id; 12 | private String username; 13 | private String password; 14 | private String salt; 15 | 16 | private Boolean locked = Boolean.FALSE; 17 | 18 | public User() { 19 | } 20 | 21 | public User(String username, String password) { 22 | this.username = username; 23 | this.password = password; 24 | } 25 | 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | public void setId(Long id) { 31 | this.id = id; 32 | } 33 | 34 | public String getUsername() { 35 | return username; 36 | } 37 | 38 | public void setUsername(String username) { 39 | this.username = username; 40 | } 41 | 42 | public String getPassword() { 43 | return password; 44 | } 45 | 46 | public void setPassword(String password) { 47 | this.password = password; 48 | } 49 | 50 | public String getSalt() { 51 | return salt; 52 | } 53 | 54 | public void setSalt(String salt) { 55 | this.salt = salt; 56 | } 57 | 58 | public String getCredentialsSalt() { 59 | return username + salt; 60 | } 61 | 62 | public Boolean getLocked() { 63 | return locked; 64 | } 65 | 66 | public void setLocked(Boolean locked) { 67 | this.locked = locked; 68 | } 69 | 70 | @Override 71 | public boolean equals(Object o) { 72 | if (this == o) return true; 73 | if (o == null || getClass() != o.getClass()) return false; 74 | 75 | User user = (User) o; 76 | 77 | if (id != null ? !id.equals(user.id) : user.id != null) return false; 78 | 79 | return true; 80 | } 81 | 82 | @Override 83 | public int hashCode() { 84 | return id != null ? id.hashCode() : 0; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return "User{" + 90 | "id=" + id + 91 | ", username='" + username + '\'' + 92 | ", password='" + password + '\'' + 93 | ", salt='" + salt + '\'' + 94 | ", locked=" + locked + 95 | '}'; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /client/src/main/resources/spring-beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.service; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.dao.UserDao; 4 | import com.github.zhangkaitao.shiro.chapter15.entity.User; 5 | 6 | import java.util.Set; 7 | 8 | /** 9 | *

User: Zhang Kaitao 10 | *

Date: 14-1-28 11 | *

Version: 1.0 12 | */ 13 | public class UserServiceImpl implements UserService { 14 | 15 | private UserDao userDao; 16 | 17 | public void setUserDao(UserDao userDao) { 18 | this.userDao = userDao; 19 | } 20 | 21 | private PasswordHelper passwordHelper; 22 | 23 | public void setPasswordHelper(PasswordHelper passwordHelper) { 24 | this.passwordHelper = passwordHelper; 25 | } 26 | 27 | /** 28 | * 创建用户 29 | * @param user 30 | */ 31 | public User createUser(User user) { 32 | //加密密码 33 | passwordHelper.encryptPassword(user); 34 | return userDao.createUser(user); 35 | } 36 | 37 | /** 38 | * 修改密码 39 | * @param userId 40 | * @param newPassword 41 | */ 42 | public void changePassword(Long userId, String newPassword) { 43 | User user =userDao.findOne(userId); 44 | user.setPassword(newPassword); 45 | passwordHelper.encryptPassword(user); 46 | userDao.updateUser(user); 47 | } 48 | 49 | /** 50 | * 添加用户-角色关系 51 | * @param userId 52 | * @param roleIds 53 | */ 54 | public void correlationRoles(Long userId, Long... roleIds) { 55 | userDao.correlationRoles(userId, roleIds); 56 | } 57 | 58 | 59 | /** 60 | * 移除用户-角色关系 61 | * @param userId 62 | * @param roleIds 63 | */ 64 | public void uncorrelationRoles(Long userId, Long... roleIds) { 65 | userDao.uncorrelationRoles(userId, roleIds); 66 | } 67 | 68 | /** 69 | * 根据用户名查找用户 70 | * @param username 71 | * @return 72 | */ 73 | public User findByUsername(String username) { 74 | return userDao.findByUsername(username); 75 | } 76 | 77 | /** 78 | * 根据用户名查找其角色 79 | * @param username 80 | * @return 81 | */ 82 | public Set findRoles(String username) { 83 | return userDao.findRoles(username); 84 | } 85 | 86 | /** 87 | * 根据用户名查找其权限 88 | * @param username 89 | * @return 90 | */ 91 | public Set findPermissions(String username) { 92 | return userDao.findPermissions(username); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/unused-spring-configuration/mbeans.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 26 | 27 | Configuration for the MBeans to support JMX. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 45 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /server/src/test/java/org/jasig/cas/WiringTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Jasig under one or more contributor license 3 | * agreements. See the NOTICE file distributed with this work 4 | * for additional information regarding copyright ownership. 5 | * Jasig licenses this file to you under the Apache License, 6 | * Version 2.0 (the "License"); you may not use this file 7 | * except in compliance with the License. You may obtain a 8 | * copy of the License at the following location: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | package org.jasig.cas; 20 | 21 | import org.junit.Before; 22 | import org.junit.Test; 23 | import org.springframework.core.io.FileSystemResource; 24 | import org.springframework.core.io.Resource; 25 | import org.springframework.core.io.ResourceLoader; 26 | import org.springframework.mock.web.MockServletContext; 27 | import org.springframework.web.context.support.XmlWebApplicationContext; 28 | 29 | import static org.junit.Assert.assertTrue; 30 | 31 | /** 32 | * Unit test to verify Spring context wiring. 33 | * 34 | * @author Middleware Services 35 | */ 36 | public class WiringTests { 37 | private XmlWebApplicationContext applicationContext; 38 | 39 | @Before 40 | public void setUp() { 41 | applicationContext = new XmlWebApplicationContext(); 42 | applicationContext.setConfigLocations(new String[]{ 43 | "file:src/main/webapp/WEB-INF/cas-servlet.xml", 44 | "file:src/main/webapp/WEB-INF/deployerConfigContext.xml", 45 | "file:src/main/webapp/WEB-INF/spring-configuration/*.xml"}); 46 | applicationContext.setServletContext(new MockServletContext(new ResourceLoader() { 47 | @Override 48 | public Resource getResource(final String location) { 49 | return new FileSystemResource("src/main/webapp" + location); 50 | } 51 | 52 | @Override 53 | public ClassLoader getClassLoader() { 54 | return getClassLoader(); 55 | } 56 | })); 57 | applicationContext.refresh(); 58 | } 59 | 60 | @Test 61 | public void testWiring() throws Exception { 62 | assertTrue(applicationContext.getBeanDefinitionCount() > 0); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/restlet-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/uniqueIdGenerators.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 29 | 30 | Controls the generation of the unique identifiers for tickets. You most likely do not need to modify these. Though you may need to add 31 | the SAML ticket id generator. 32 | 33 | 34 | 35 | 37 | 38 | 40 | 41 | 43 | 44 | 46 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/authorizationFailure.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | 22 | 23 | <%@ page import="org.jasig.cas.web.support.WebUtils"%> 24 | <%@ page import="org.springframework.security.web.WebAttributes"%> 25 | 26 | 27 |

28 |

29 | <% 30 | // Look for details of authorization failure in well-known request attributes. 31 | final String[] keys = new String[] {WebUtils.CAS_ACCESS_DENIED_REASON, WebAttributes.AUTHENTICATION_EXCEPTION}; 32 | Object detail = null; 33 | for (String key : keys) { 34 | detail = request.getAttribute(key); 35 | if (detail == null) { 36 | detail = request.getSession().getAttribute(key); 37 | request.getSession().removeAttribute(key); 38 | } 39 | if (detail != null) { 40 | break; 41 | } 42 | } 43 | if (detail instanceof String) { 44 | request.setAttribute("messageKey", detail); 45 | } else if (detail instanceof Exception) { 46 | final Exception cause = (Exception) detail; 47 | final String message = String.format("%s::%s", cause.getClass().getSimpleName(), cause.getMessage()); 48 | request.setAttribute("message", message); 49 | } 50 | %> 51 | 52 | 53 |

54 |
55 | 56 |

57 |
58 |
59 |
60 | 61 | -------------------------------------------------------------------------------- /client/src/main/java/io/github/howiefh/cas/session/CasLogoutFilter.java: -------------------------------------------------------------------------------- 1 | package io.github.howiefh.cas.session; 2 | 3 | import javax.servlet.ServletRequest; 4 | import javax.servlet.ServletResponse; 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | import org.apache.shiro.SecurityUtils; 8 | import org.apache.shiro.session.Session; 9 | import org.apache.shiro.session.SessionException; 10 | import org.apache.shiro.session.mgt.SessionManager; 11 | import org.apache.shiro.subject.Subject; 12 | import org.apache.shiro.web.servlet.AdviceFilter; 13 | import org.slf4j.Logger; 14 | import org.slf4j.LoggerFactory; 15 | 16 | public class CasLogoutFilter extends AdviceFilter{ 17 | private static final Logger log = LoggerFactory.getLogger(CasLogoutFilter.class); 18 | private static final SingleSignOutHandler HANDLER = new SingleSignOutHandler(); 19 | 20 | private SessionManager sessionManager; 21 | 22 | public void setSessionManager(SessionManager sessionManager) { 23 | this.sessionManager = sessionManager; 24 | } 25 | /** 26 | * 如果请求中包含了ticket参数,记录ticket和sessionID的映射 27 | * 如果请求中包含logoutRequest参数,标记session为无效 28 | * 如果session不为空,且被标记为无效,则登出 29 | * 30 | * @param request the incoming ServletRequest 31 | * @param response the outgoing ServletResponse 32 | * @return 是logoutRequest请求返回false,否则返回true 33 | * @throws Exception if there is any error. 34 | */ 35 | @Override 36 | protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception { 37 | HttpServletRequest req = (HttpServletRequest)request; 38 | if (HANDLER.isTokenRequest((HttpServletRequest)req)) { 39 | //通过浏览器发送的请求,链接中含有token参数,记录token和sessionID 40 | HANDLER.recordSession(req); 41 | return true; 42 | } else if (HANDLER.isLogoutRequest(req)) { 43 | //cas服务器发送的请求,链接中含有logoutRequest参数,在之前记录的session中设置logoutRequest参数为true 44 | //因为Subject是和线程是绑定的,所以无法获取登录的Subject直接logout 45 | HANDLER.invalidateSession(req,sessionManager); 46 | // Do not continue up filter chain 47 | return false; 48 | } else { 49 | log.trace("Ignoring URI " + req.getRequestURI()); 50 | } 51 | Subject subject = SecurityUtils.getSubject(); 52 | Session session = subject.getSession(false); 53 | if (session!=null&&session.getAttribute(HANDLER.getLogoutParameterName())!=null) { 54 | try { 55 | subject.logout(); 56 | } catch (SessionException ise) { 57 | log.debug("Encountered session exception during logout. This can generally safely be ignored.", ise); 58 | } 59 | } 60 | return true; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/dao/RoleDaoImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.dao; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.Role; 4 | import org.springframework.jdbc.core.PreparedStatementCreator; 5 | import org.springframework.jdbc.core.support.JdbcDaoSupport; 6 | import org.springframework.jdbc.support.GeneratedKeyHolder; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.SQLException; 11 | 12 | /** 13 | *

User: Zhang Kaitao 14 | *

Date: 14-1-28 15 | *

Version: 1.0 16 | */ 17 | public class RoleDaoImpl extends JdbcDaoSupport implements RoleDao { 18 | 19 | public Role createRole(final Role Role) { 20 | final String sql = "insert into sys_roles(role, description, available) values(?,?,?)"; 21 | 22 | GeneratedKeyHolder keyHolder = new GeneratedKeyHolder(); 23 | getJdbcTemplate().update(new PreparedStatementCreator() { 24 | @Override 25 | public PreparedStatement createPreparedStatement(Connection connection) throws SQLException { 26 | PreparedStatement psst = connection.prepareStatement(sql, new String[]{"id"}); 27 | psst.setString(1, Role.getRole()); 28 | psst.setString(2, Role.getDescription()); 29 | psst.setBoolean(3, Role.getAvailable()); 30 | return psst; 31 | } 32 | }, keyHolder); 33 | Role.setId(keyHolder.getKey().longValue()); 34 | 35 | return Role; 36 | } 37 | 38 | public void deleteRole(Long roleId) { 39 | //首先把和role关联的相关表数据删掉 40 | String sql = "delete from sys_users_roles where role_id=?"; 41 | getJdbcTemplate().update(sql, roleId); 42 | 43 | sql = "delete from sys_roles where id=?"; 44 | getJdbcTemplate().update(sql, roleId); 45 | } 46 | 47 | @Override 48 | public void correlationPermissions(Long roleId, Long... permissionIds) { 49 | if(permissionIds == null || permissionIds.length == 0) { 50 | return; 51 | } 52 | String sql = "insert into sys_roles_permissions(role_id, permission_id) values(?,?)"; 53 | for(Long permissionId : permissionIds) { 54 | if(!exists(roleId, permissionId)) { 55 | getJdbcTemplate().update(sql, roleId, permissionId); 56 | } 57 | } 58 | } 59 | 60 | 61 | @Override 62 | public void uncorrelationPermissions(Long roleId, Long... permissionIds) { 63 | if(permissionIds == null || permissionIds.length == 0) { 64 | return; 65 | } 66 | String sql = "delete from sys_roles_permissions where role_id=? and permission_id=?"; 67 | for(Long permissionId : permissionIds) { 68 | if(exists(roleId, permissionId)) { 69 | getJdbcTemplate().update(sql, roleId, permissionId); 70 | } 71 | } 72 | } 73 | 74 | private boolean exists(Long roleId, Long permissionId) { 75 | String sql = "select count(1) from sys_roles_permissions where role_id=? and permission_id=?"; 76 | return getJdbcTemplate().queryForObject(sql, Integer.class, roleId, permissionId) != 0; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /client/src/main/java/com/github/zhangkaitao/shiro/chapter15/realm/UserRealm.java: -------------------------------------------------------------------------------- 1 | package com.github.zhangkaitao.shiro.chapter15.realm; 2 | 3 | import com.github.zhangkaitao.shiro.chapter15.entity.User; 4 | import com.github.zhangkaitao.shiro.chapter15.service.UserService; 5 | import org.apache.shiro.authc.*; 6 | import org.apache.shiro.authz.AuthorizationInfo; 7 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 8 | import org.apache.shiro.realm.AuthorizingRealm; 9 | import org.apache.shiro.subject.PrincipalCollection; 10 | import org.apache.shiro.util.ByteSource; 11 | 12 | /** 13 | *

User: Zhang Kaitao 14 | *

Date: 14-1-28 15 | *

Version: 1.0 16 | */ 17 | public class UserRealm extends AuthorizingRealm { 18 | 19 | private UserService userService; 20 | 21 | public void setUserService(UserService userService) { 22 | this.userService = userService; 23 | } 24 | 25 | @Override 26 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { 27 | String username = (String)principals.getPrimaryPrincipal(); 28 | 29 | SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(); 30 | authorizationInfo.setRoles(userService.findRoles(username)); 31 | authorizationInfo.setStringPermissions(userService.findPermissions(username)); 32 | 33 | return authorizationInfo; 34 | } 35 | 36 | @Override 37 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 38 | 39 | String username = (String)token.getPrincipal(); 40 | 41 | User user = userService.findByUsername(username); 42 | 43 | if(user == null) { 44 | throw new UnknownAccountException();//没找到帐号 45 | } 46 | 47 | if(Boolean.TRUE.equals(user.getLocked())) { 48 | throw new LockedAccountException(); //帐号锁定 49 | } 50 | 51 | //交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现 52 | SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo( 53 | user.getUsername(), //用户名 54 | user.getPassword(), //密码 55 | ByteSource.Util.bytes(user.getCredentialsSalt()),//salt=username+salt 56 | getName() //realm name 57 | ); 58 | return authenticationInfo; 59 | } 60 | 61 | @Override 62 | public void clearCachedAuthorizationInfo(PrincipalCollection principals) { 63 | super.clearCachedAuthorizationInfo(principals); 64 | } 65 | 66 | @Override 67 | public void clearCachedAuthenticationInfo(PrincipalCollection principals) { 68 | super.clearCachedAuthenticationInfo(principals); 69 | } 70 | 71 | @Override 72 | public void clearCache(PrincipalCollection principals) { 73 | super.clearCache(principals); 74 | } 75 | 76 | public void clearAllCachedAuthorizationInfo() { 77 | getAuthorizationCache().clear(); 78 | } 79 | 80 | public void clearAllCachedAuthenticationInfo() { 81 | getAuthenticationCache().clear(); 82 | } 83 | 84 | public void clearAllCache() { 85 | clearAllCachedAuthenticationInfo(); 86 | clearAllCachedAuthorizationInfo(); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/spring-configuration/ticketExpirationPolicies.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 19 | 20 | Assignment of expiration policies for the different tickets generated by CAS 21 | including ticket granting ticket 22 | (TGT), service ticket (ST), proxy granting ticket (PGT), and proxy ticket 23 | (PT). 24 | These expiration policies determine how long the ticket they are assigned 25 | to can be used and even how often they 26 | can be used before becoming expired / invalid. 27 | 28 | 29 | 30 | 31 | 35 | 36 | 38 | 42 | 43 | 45 | 47 | 48 | 52 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/monitoring/viewStatistics.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@include file="/WEB-INF/view/jsp/default/ui/includes/top.jsp"%> 22 | 23 |

Runtime Statistics

24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
PropertyValue
Server${serverIpAddress} (${serverHostName})
CAS Ticket Suffix${casTicketSuffix}
Server Start Time${startTime}
Uptime${upTime}
Memory ${freeMemory} MB free ${totalMemory} MB total
Maximum Memory${maxMemory} MB
Available Processors${availableProcessors}
62 | 63 |

64 | 65 |

Ticket Registry Statistics

66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 |
PropertyValue
Unexpired TGTs${unexpiredTgts}
Unexpired STs${unexpiredSts}
Expired TGTs${expiredTgts}
Expired STs${expiredSts}
92 | 93 |

Performance Statistics

94 | 95 | 96 |

${appender.name}

97 | 98 | ${appender.name} 99 | 100 |
101 | 102 | <%@include file="/WEB-INF/view/jsp/default/ui/includes/bottom.jsp" %> -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/custom/ui/includes/bottom.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 22 | 23 |
24 |
25 | 26 |
27 | 53 | 54 |

55 |

Powered by Jasig Central Authentication Service <%=org.jasig.cas.CasVersion.getVersion()%>

56 | 57 |
58 | 59 |
60 | 61 | 62 | 63 | 64 | <%-- 65 | JavaScript Debug: A simple wrapper for console.log 66 | See this link for more info: http://benalman.com/projects/javascript-debug-console-log/ 67 | --%> 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /server/src/main/resources/custom_views.properties: -------------------------------------------------------------------------------- 1 | ### Login view (/login) 2 | 3 | # 4 | # Licensed to Jasig under one or more contributor license 5 | # agreements. See the NOTICE file distributed with this work 6 | # for additional information regarding copyright ownership. 7 | # Jasig licenses this file to you under the Apache License, 8 | # Version 2.0 (the "License"); you may not use this file 9 | # except in compliance with the License. You may obtain a 10 | # copy of the License at the following location: 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | casLoginView.(class)=org.springframework.web.servlet.view.JstlView 23 | casLoginView.url=/WEB-INF/view/jsp/custom/ui/casLoginView.jsp 24 | 25 | ### Display login (warning) messages 26 | casLoginMessageView.(class)=org.springframework.web.servlet.view.JstlView 27 | casLoginMessageView.url=/WEB-INF/view/jsp/custom/ui/casLoginMessageView.jsp 28 | 29 | ### Login confirmation view (logged in, warn=true) 30 | casLoginConfirmView.(class)=org.springframework.web.servlet.view.JstlView 31 | casLoginConfirmView.url=/WEB-INF/view/jsp/custom/ui/casConfirmView.jsp 32 | 33 | ### Logged-in view (logged in, no service provided) 34 | casLoginGenericSuccessView.(class)=org.springframework.web.servlet.view.JstlView 35 | casLoginGenericSuccessView.url=/WEB-INF/view/jsp/custom/ui/casGenericSuccess.jsp 36 | 37 | ### Logout view (/logout) 38 | casLogoutView.(class)=org.springframework.web.servlet.view.JstlView 39 | casLogoutView.url=/WEB-INF/view/jsp/custom/ui/casLogoutView.jsp 40 | 41 | ### CAS error view 42 | viewServiceErrorView.(class)=org.springframework.web.servlet.view.JstlView 43 | viewServiceErrorView.url=/WEB-INF/view/jsp/custom/ui/serviceErrorView.jsp 44 | 45 | viewServiceSsoErrorView.(class)=org.springframework.web.servlet.view.JstlView 46 | viewServiceSsoErrorView.url=/WEB-INF/view/jsp/custom/ui/serviceErrorSsoView.jsp 47 | 48 | ### CAS statistics view 49 | viewStatisticsView.(class)=org.springframework.web.servlet.view.JstlView 50 | viewStatisticsView.url=/WEB-INF/view/jsp/monitoring/viewStatistics.jsp 51 | 52 | ### Expired Password Error message 53 | casExpiredPassView.(class)=org.springframework.web.servlet.view.JstlView 54 | casExpiredPassView.url=/WEB-INF/view/jsp/custom/ui/casExpiredPassView.jsp 55 | 56 | ### Locked Account Error message 57 | casAccountLockedView.(class)=org.springframework.web.servlet.view.JstlView 58 | casAccountLockedView.url=/WEB-INF/view/jsp/custom/ui/casAccountLockedView.jsp 59 | 60 | ### Disabled Account Error message 61 | casAccountDisabledView.(class)=org.springframework.web.servlet.view.JstlView 62 | casAccountDisabledView.url=/WEB-INF/view/jsp/custom/ui/casAccountDisabledView.jsp 63 | 64 | ### Must Change Password Error message 65 | casMustChangePassView.(class)=org.springframework.web.servlet.view.JstlView 66 | casMustChangePassView.url=/WEB-INF/view/jsp/custom/ui/casMustChangePassView.jsp 67 | 68 | ### Bad Hours Error message 69 | casBadHoursView.(class)=org.springframework.web.servlet.view.JstlView 70 | casBadHoursView.url=/WEB-INF/view/jsp/custom/ui/casBadHoursView.jsp 71 | 72 | ### Bad Workstation Error message 73 | casBadWorkstationView.(class)=org.springframework.web.servlet.view.JstlView 74 | casBadWorkstationView.url=/WEB-INF/view/jsp/custom/ui/casBadWorkstationView.jsp 75 | 76 | -------------------------------------------------------------------------------- /server/src/main/resources/default_views.properties: -------------------------------------------------------------------------------- 1 | ### Login view (/login) 2 | 3 | # 4 | # Licensed to Jasig under one or more contributor license 5 | # agreements. See the NOTICE file distributed with this work 6 | # for additional information regarding copyright ownership. 7 | # Jasig licenses this file to you under the Apache License, 8 | # Version 2.0 (the "License"); you may not use this file 9 | # except in compliance with the License. You may obtain a 10 | # copy of the License at the following location: 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | casLoginView.(class)=org.springframework.web.servlet.view.JstlView 23 | casLoginView.url=/WEB-INF/view/jsp/default/ui/casLoginView.jsp 24 | 25 | ### Display login (warning) messages 26 | casLoginMessageView.(class)=org.springframework.web.servlet.view.JstlView 27 | casLoginMessageView.url=/WEB-INF/view/jsp/default/ui/casLoginMessageView.jsp 28 | 29 | ### Login confirmation view (logged in, warn=true) 30 | casLoginConfirmView.(class)=org.springframework.web.servlet.view.JstlView 31 | casLoginConfirmView.url=/WEB-INF/view/jsp/default/ui/casConfirmView.jsp 32 | 33 | ### Logged-in view (logged in, no service provided) 34 | casLoginGenericSuccessView.(class)=org.springframework.web.servlet.view.JstlView 35 | casLoginGenericSuccessView.url=/WEB-INF/view/jsp/default/ui/casGenericSuccess.jsp 36 | 37 | ### Logout view (/logout) 38 | casLogoutView.(class)=org.springframework.web.servlet.view.JstlView 39 | casLogoutView.url=/WEB-INF/view/jsp/default/ui/casLogoutView.jsp 40 | 41 | ### CAS error view 42 | viewServiceErrorView.(class)=org.springframework.web.servlet.view.JstlView 43 | viewServiceErrorView.url=/WEB-INF/view/jsp/default/ui/serviceErrorView.jsp 44 | 45 | viewServiceSsoErrorView.(class)=org.springframework.web.servlet.view.JstlView 46 | viewServiceSsoErrorView.url=/WEB-INF/view/jsp/default/ui/serviceErrorSsoView.jsp 47 | 48 | ### CAS statistics view 49 | viewStatisticsView.(class)=org.springframework.web.servlet.view.JstlView 50 | viewStatisticsView.url=/WEB-INF/view/jsp/monitoring/viewStatistics.jsp 51 | 52 | ### Expired Password Error message 53 | casExpiredPassView.(class)=org.springframework.web.servlet.view.JstlView 54 | casExpiredPassView.url=/WEB-INF/view/jsp/default/ui/casExpiredPassView.jsp 55 | 56 | ### Locked Account Error message 57 | casAccountLockedView.(class)=org.springframework.web.servlet.view.JstlView 58 | casAccountLockedView.url=/WEB-INF/view/jsp/default/ui/casAccountLockedView.jsp 59 | 60 | ### Disabled Account Error message 61 | casAccountDisabledView.(class)=org.springframework.web.servlet.view.JstlView 62 | casAccountDisabledView.url=/WEB-INF/view/jsp/default/ui/casAccountDisabledView.jsp 63 | 64 | ### Must Change Password Error message 65 | casMustChangePassView.(class)=org.springframework.web.servlet.view.JstlView 66 | casMustChangePassView.url=/WEB-INF/view/jsp/default/ui/casMustChangePassView.jsp 67 | 68 | ### Bad Hours Error message 69 | casBadHoursView.(class)=org.springframework.web.servlet.view.JstlView 70 | casBadHoursView.url=/WEB-INF/view/jsp/default/ui/casBadHoursView.jsp 71 | 72 | ### Bad Workstation Error message 73 | casBadWorkstationView.(class)=org.springframework.web.servlet.view.JstlView 74 | casBadWorkstationView.url=/WEB-INF/view/jsp/default/ui/casBadWorkstationView.jsp 75 | 76 | -------------------------------------------------------------------------------- /server/src/main/resources/protocol_views.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to Jasig under one or more contributor license 3 | # agreements. See the NOTICE file distributed with this work 4 | # for additional information regarding copyright ownership. 5 | # Jasig licenses this file to you under the Apache License, 6 | # Version 2.0 (the "License"); you may not use this file 7 | # except in compliance with the License. You may obtain a 8 | # copy of the License at the following location: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | ### 1.0 validation responses (/validate) 21 | cas1ServiceFailureView.(class)=org.jasig.cas.web.view.Cas10ResponseView 22 | cas1ServiceFailureView.successResponse=false 23 | 24 | cas1ServiceSuccessView.(class)=org.jasig.cas.web.view.Cas10ResponseView 25 | cas1ServiceSuccessView.successResponse=true 26 | 27 | ### CAS 2.0 Response Protocol Views 28 | 29 | ## Validation Response Protocol Views: /proxyValidate, /serviceValidate 30 | cas2ServiceSuccessView.(class)=org.springframework.web.servlet.view.JstlView 31 | cas2ServiceSuccessView.url=/WEB-INF/view/jsp/protocol/2.0/casServiceValidationSuccess.jsp 32 | 33 | cas2ServiceFailureView.(class)=org.springframework.web.servlet.view.JstlView 34 | cas2ServiceFailureView.url=/WEB-INF/view/jsp/protocol/2.0/casServiceValidationFailure.jsp 35 | 36 | ## Proxy Response Protocol Views: /proxy 37 | cas2ProxyFailureView.(class)=org.springframework.web.servlet.view.JstlView 38 | cas2ProxyFailureView.url=/WEB-INF/view/jsp/protocol/2.0/casProxyFailureView.jsp 39 | 40 | cas2ProxySuccessView.(class)=org.springframework.web.servlet.view.JstlView 41 | cas2ProxySuccessView.url=/WEB-INF/view/jsp/protocol/2.0/casProxySuccessView.jsp 42 | 43 | ### CAS 3.0 Response Protocol Views: /proxyValidate, /serviceValidate 44 | cas3ServiceSuccessView.(class)=org.springframework.web.servlet.view.JstlView 45 | cas3ServiceSuccessView.url=/WEB-INF/view/jsp/protocol/3.0/casServiceValidationSuccess.jsp 46 | 47 | cas3ServiceFailureView.(class)=org.springframework.web.servlet.view.JstlView 48 | cas3ServiceFailureView.url=/WEB-INF/view/jsp/protocol/3.0/casServiceValidationFailure.jsp 49 | 50 | #OpenId Views 51 | casOpenIdServiceFailureView.(class)=org.springframework.web.servlet.view.JstlView 52 | casOpenIdServiceFailureView.url=/WEB-INF/view/jsp/protocol/openid/casOpenIdServiceFailureView.jsp 53 | 54 | casOpenIdServiceSuccessView.(class)=org.springframework.web.servlet.view.JstlView 55 | casOpenIdServiceSuccessView.url=/WEB-INF/view/jsp/protocol/openid/casOpenIdServiceSuccessView.jsp 56 | 57 | casOpenIdAssociationFailureView.(class)=org.springframework.web.servlet.view.JstlView 58 | casOpenIdAssociationFailureView.url=/WEB-INF/view/jsp/protocol/openid/casOpenIdAssociationFailureView.jsp 59 | 60 | casOpenIdAssociationSuccessView.(class)=org.springframework.web.servlet.view.JstlView 61 | casOpenIdAssociationSuccessView.url=/WEB-INF/view/jsp/protocol/openid/casOpenIdAssociationSuccessView.jsp 62 | 63 | openIdProviderView.(class)=org.springframework.web.servlet.view.JstlView 64 | openIdProviderView.url=/WEB-INF/view/jsp/protocol/openid/user.jsp 65 | 66 | ### Post View 67 | postResponseView.(class)=org.springframework.web.servlet.view.JstlView 68 | postResponseView.url=/WEB-INF/view/jsp/protocol/casPostResponseView.jsp 69 | 70 | ### OAuth View 71 | oauthConfirmView.(class)=org.springframework.web.servlet.view.JstlView 72 | oauthConfirmView.url=/WEB-INF/view/jsp/protocol/oauth/confirm.jsp 73 | -------------------------------------------------------------------------------- /server/src/main/resources/messages_sl.properties: -------------------------------------------------------------------------------- 1 | #Welcome Screen Messages 2 | 3 | # 4 | # Licensed to Jasig under one or more contributor license 5 | # agreements. See the NOTICE file distributed with this work 6 | # for additional information regarding copyright ownership. 7 | # Jasig licenses this file to you under the Apache License, 8 | # Version 2.0 (the "License"); you may not use this file 9 | # except in compliance with the License. You may obtain a 10 | # copy of the License at the following location: 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | screen.welcome.welcome=Dobrodo\u0161li v ARNES CAS online\! Uporabite uporabni\u0161ko ime in geslo, ki vam ga je dodeli administrator ARNES organizacije 23 | screen.welcome.security=Zaradi varnostnih razlogov, prosimo, da naredite odjavo in zaprete brskalnik, ko zapustite spletni vir, ki je zahteval va\u0161o avtentikacijo. 24 | screen.welcome.instructions=Vpi\u0161ite va\u0161o uporabni\u0161ko ime(eduprincipalName\: ime@arnes.si) in geslo. 25 | screen.welcome.label.netid=eduPersonPrincipalName\: 26 | screen.welcome.label.netid.accesskey=n 27 | screen.welcome.label.password=Geslo\: 28 | screen.welcome.label.password.accesskey=p 29 | screen.welcome.label.warn=Opozori me, ko naredim novo prijavo v drugi spletni vir. 30 | screen.welcome.label.warn.accesskey=w 31 | screen.welcome.button.login=Prijava 32 | screen.welcome.button.clear=ZBRI\u0160I 33 | 34 | #Confirmation Screen Messages 35 | screen.confirmation.message=Klikni tukaj za vstop v aplikacijo. 36 | 37 | #Generic Success Screen Messages 38 | screen.success.header=Prijava uspela 39 | screen.success.success=Uspe\u0161no ste se prijavili v Centralno Avtenikacijsko Storitev. 40 | screen.success.security=Zaradi varnostnih razlogov, prosimo, da naredite odjavo in zaprete brskalnik, ko zapustite spletni vir, ki je zahteval va\u0161o avtentikacijo. 41 | 42 | #Logout Screen Messages 43 | screen.logout.header=Odjava uspela 44 | screen.logout.success=Uspe\u0161no ste se prijavili v Centralno Avtenikacijsko Storitev. 45 | screen.logout.security=Zaradi varnostnih razlogov zaprite brskalnik 46 | screen.logout.redirect=Spletna storitev iz katere ste se odjavili, je priskrbela povezavo za nazaj, \u010De se \u017Eelite vrniti, kliknite na povezavo.. 47 | 48 | #Service Error Messages 49 | screen.service.error.header=Ne avtorizerana Storitev 50 | screen.service.error.message=Vstopiti ste hoteli do o spletne storitve nima dovoljenja do uporabe CAS storitve. 51 | 52 | 53 | error.invalid.loginticket=Ne morete narediti re-submit forme, ki je \u017Ee bila poslana. 54 | required.username=Uporabni\u0161ko ime je nujno vpisati\! 55 | required.password=Geslo je nujno vpisati\! 56 | error.authentication.credentials.bad=Veredostojnost, ki ste jo vpisali ne moremo dolo\u010Diti, da je pristno\! 57 | error.authentication.credentials.unsupported=Veredostojnost, ki ste jo vpisali ni podprto v CAS-u\! 58 | 59 | INVALID_REQUEST_PROXY='pgt' in 'targetService' parametra sta oba nujna\! 60 | INVALID_TICKET_SPEC=Ne uspe\u0161na validacija zahtevka. Mo\u017Ene napake so nastale pri vklju\u010Ditvi validacije v Proxy Ticket preko Service Ticket validacije. 61 | INVALID_REQUEST='service' in 'ticket' parametra sta oba nujna\! 62 | INVALID_TICKET=zahtevek ''{0}'' ni prepoznana 63 | INVALID_SERVICE=zahtevek ''{0}'' se ne ujema priskrbljeno storitvijo 64 | -------------------------------------------------------------------------------- /server/src/main/resources/messages_nl.properties: -------------------------------------------------------------------------------- 1 | #Author: Jan "Velpi" Van der Velpen 2 | #Version $Revision$ $Date$ 3 | #Since 3.0.3 4 | 5 | #Welcome Screen Messages 6 | 7 | # 8 | # Licensed to Jasig under one or more contributor license 9 | # agreements. See the NOTICE file distributed with this work 10 | # for additional information regarding copyright ownership. 11 | # Jasig licenses this file to you under the Apache License, 12 | # Version 2.0 (the "License"); you may not use this file 13 | # except in compliance with the License. You may obtain a 14 | # copy of the License at the following location: 15 | # 16 | # http://www.apache.org/licenses/LICENSE-2.0 17 | # 18 | # Unless required by applicable law or agreed to in writing, 19 | # software distributed under the License is distributed on an 20 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 | # KIND, either express or implied. See the License for the 22 | # specific language governing permissions and limitations 23 | # under the License. 24 | # 25 | 26 | screen.welcome.welcome=Proficiat met de succesvolle installatie van CAS! Met de standaard "authentication handler" kan je ingeloggen als de gebruikersnaam gelijk is aan het wachtwoord. Je kan het nu proberen. 27 | screen.welcome.security=Voor de veiligheid moet je uitloggen en je browser sluiten wanneer je geen toegang meer nodig hebt tot afgeschermde applicaties! 28 | screen.welcome.instructions=Om verder te gaan dien je jezelf te authenticeren. 29 | screen.welcome.label.netid.accesskey=g 30 | screen.welcome.label.netid=Gebruikersnaam: 31 | screen.welcome.label.password=Wachtwoord: 32 | screen.welcome.label.password.accesskey=w 33 | screen.welcome.label.warn=Vraag toestemming vooraleer me ingelogd door te sturen naar andere sites. 34 | screen.welcome.label.warn.accesskey=v 35 | screen.welcome.button.login=LOGIN 36 | screen.welcome.button.clear=CLEAR 37 | 38 | #Confirmation Screen Messages 39 | screen.confirmation.message=Doorgaan naar de applicatie. 40 | 41 | #Generic Success Screen Messages 42 | screen.success.header=Succesvol ingelogd. 43 | screen.success.success=Je bent ingelogd bij de Central Authentication Service. 44 | screen.success.security=Voor de veiligheid moet je uitloggen en je browser sluiten wanneer je geen toegang meer nodig hebt tot afgeschermde applicaties! 45 | 46 | #Logout Screen Messages 47 | screen.logout.header=Succesvol uitgelogd. 48 | screen.logout.success=Je bent nu uitgelogd bij de Central Authentication Service. 49 | screen.logout.security=Voor de veiligheid dien je je browser nu af te sluiten. 50 | screen.logout.redirect=De applicatie waar je vandaan komt heeft deze link opgegeven die je kan volgen door hier te klikken. 51 | 52 | error.invalid.loginticket=Je mag geen formulier verzenden dat je al eens hebt verzonden. 53 | required.username=Gelieve een gebruikersnaam in te vullen. 54 | required.password=Gelieve een wachtwoord in te vullen. 55 | error.authentication.credentials.bad=De combinatie van gebruikersnaam en wachtwoord was niet juist. 56 | error.authentication.credentials.unsupported=De verstuurde identificatiegegevens worden niet ondersteund door CAS. 57 | 58 | INVALID_REQUEST_PROXY='pgt' en 'targetService' zijn verplichte parameters. 59 | INVALID_TICKET_SPEC=Het ticket kwam niet overeen met de specificatie voor validatie. Misschien probeer je een Proxy Ticket te valideren op de Service Ticket validator, of komt "renew true" niet overeen. 60 | INVALID_REQUEST='service' en 'ticket' zijn verplichte parameters. 61 | INVALID_TICKET=ticket ''{0}'' is niet gekend. 62 | INVALID_SERVICE=ticket ''{0}'' komt niet overeen met de opgegeven service. 63 | 64 | screen.service.error.header=Geen toegang. 65 | screen.service.error.message=De applicatie waarvoor je toegang vroeg heeft geen toestemming om deze CAS te gebruiken. 66 | -------------------------------------------------------------------------------- /server/src/main/webapp/WEB-INF/view/jsp/protocol/3.0/casServiceValidationSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | 3 | Licensed to Jasig under one or more contributor license 4 | agreements. See the NOTICE file distributed with this work 5 | for additional information regarding copyright ownership. 6 | Jasig licenses this file to you under the Apache License, 7 | Version 2.0 (the "License"); you may not use this file 8 | except in compliance with the License. You may obtain a 9 | copy of the License at the following location: 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | --%> 21 | <%@ page session="false" contentType="application/xml; charset=UTF-8" %> 22 | <%@ page import="java.util.*, java.util.Map.Entry" %> 23 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 24 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 25 | 26 | 27 | ${fn:escapeXml(assertion.primaryAuthentication.principal.id)} 28 | 29 | ${pgtIou} 30 | 31 | 32 | 33 | 35 | ${fn:escapeXml(proxy.principal.id)} 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | <%-- ${attr.value['class'].simpleName} fails for List: use scriptlet instead --%> 48 | <% 49 | Entry entry = (Entry) pageContext.getAttribute("attr"); 50 | Object value = entry.getValue(); 51 | pageContext.setAttribute("isMultiple", value instanceof Collection || value instanceof Map || value instanceof Object[] 52 | || value instanceof Iterator || value instanceof Enumeration); 53 | %> 54 | 55 | <%-- it's a single element, output its toString() --%> 56 | 57 | ${fn:escapeXml(attr.value)} 58 | 59 | <%-- if attribute is multi-valued, list each value under the same attribute name --%> 60 | 61 | 62 | ${fn:escapeXml(attrval)} 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /server/src/main/resources/messages_ur.properties: -------------------------------------------------------------------------------- 1 | #Author: Faizan Ahmed (Rutgers University) 2 | #Since 3.0.5 3 | 4 | #Welcome Screen Messages 5 | 6 | # 7 | # Licensed to Jasig under one or more contributor license 8 | # agreements. See the NOTICE file distributed with this work 9 | # for additional information regarding copyright ownership. 10 | # Jasig licenses this file to you under the Apache License, 11 | # Version 2.0 (the "License"); you may not use this file 12 | # except in compliance with the License. You may obtain a 13 | # copy of the License at the following location: 14 | # 15 | # http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Unless required by applicable law or agreed to in writing, 18 | # software distributed under the License is distributed on an 19 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | # KIND, either express or implied. See the License for the 21 | # specific language governing permissions and limitations 22 | # under the License. 23 | # 24 | 25 | screen.welcome.welcome=CAS ko online lany par Mubark baad! Default Tasdeek karney wala aap ki tasdeek iss soorat main karay ga agar password wo hi hoo jo user name hay. Aiye, aur try ki jiyay. 26 | screen.welcome.security=Security ki wajoohat ki bina par aap mehrbani farma kar apnay web browser say Log Out aur Exit zaroor ki jiyay jub aap aisi services isstamal kar chookay hoon jo tasdeek chahti hoon. 27 | screen.welcome.instructions=Apni Jasig ki NetID aur Password enter ki jiyay. 28 | screen.welcome.label.netid=NetID: 29 | screen.welcome.label.netid.accesskey=n 30 | screen.welcome.label.password=Password: 31 | screen.welcome.label.password.accesskey=p 32 | screen.welcome.label.warn=Mujay doosri sites main login karnay say pahlay Khabardar karain. 33 | screen.welcome.label.warn.accesskey=k 34 | screen.welcome.button.login=LOGIN 35 | screen.welcome.button.clear=CLEAR 36 | 37 | #Confirmation Screen Messages 38 | screen.confirmation.message=Yahan Click karain agar app application main dakhil hona chahtay hain. 39 | 40 | #Generic Success Screen Messages 41 | screen.success.header=Log In Kamyab 42 | screen.success.success=Aap kamyabi say Centeral Authentication Service main login hoo chokay hain. 43 | screen.success.security=Security ki wajoohat ki bina par jub aap aisi services isstamal kar chookay hoon jo tasdeek chahti hoon tou baraye mehrbani apnay web browser say Log Out aur Exit zaroor ki jiyay 44 | 45 | #Logout Screen Messages 46 | screen.logout.header=Logout Kamyab 47 | screen.logout.success=Aap kamyabi say Centeral Authentication Service say logout hoo chokay hain. 48 | screen.logout.security=Security ki wajoohat ki bina par apnay web browser say exit karain. 49 | screen.logout.redirect=Aap jis service say aye hain oos nay aik link supply kia hay jissay aap agar chahain tou follow kar saktay hain. 50 | 51 | 52 | #Service Error Messages 53 | screen.service.error.header=Bay Sanud Service 54 | screen.service.error.message=Aap jiss service kay liay tasdeek ki kooshush kar rahay thay woo service CAS istamal karnay ki mijaz nahi. 55 | 56 | error.invalid.loginticket=Aap oos form ko dobara arsaal karnay ki kooshsish nahi kar saktay joo aap pahly arsal kar chookay hoon. 57 | required.username=Username ka khana por karna lazmi hay. 58 | required.password=Password ka khana por karna lazmi hay. 59 | error.authentication.credentials.bad=Aap ka mohya kia howa waseeka (parteet puter) ki tasdeek karna momkin nahi. 60 | error.authentication.credentials.unsupported=Aap kay mohya kiay howay waseeka (parteet puter) ko CAS support nahi karta. 61 | 62 | INVALID_REQUEST_PROXY='pgt' aur 'targetService' parameters doonon lazmi hain. 63 | INVALID_TICKET_SPEC=Ticket toseek ki tasreeh par poora nahi utri. Momkin gultiyoon main shamil, hoo sakta hay kay proxy ticket ki toseek ki kooshish Service ticket kay toseek kaninda say ki gai hoo, yaa 'renew true request' say iss ki mitabkat na hooti hoo. 64 | INVALID_REQUEST='service' aur 'ticket' parameters doonon lazmi hain. 65 | INVALID_TICKET=ticket ''{0}'' ki shnakhat nahi hoo saki. 66 | INVALID_SERVICE=ticket ''{0}'' ki mitabkat mohya karda service say nahi hoo saki. 67 | --------------------------------------------------------------------------------