Initial CAS support.
This commit is contained in:
@@ -156,6 +156,58 @@
|
||||
<lib dir="${dist.lib.dir}" includes="acegi-security.jar"/>
|
||||
</war>
|
||||
|
||||
<!-- Make WAR suitable for deployment into containers using Yale CAS -->
|
||||
<delete file="${dist.dir}/${name.cas}.war"/>
|
||||
<mkdir dir="${tmp.dir}/${name.cas}"/>
|
||||
<copy todir="${tmp.dir}/${name.cas}">
|
||||
<fileset dir="${war.dir}">
|
||||
<include name="**"/>
|
||||
</fileset>
|
||||
<fileset dir="${etc.dir}/cas">
|
||||
<include name="casfailed.jsp"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${tmp.dir}/${name.cas}/classes">
|
||||
<fileset dir="${build.dir}">
|
||||
<include name="**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${tmp.dir}/${name.cas}/WEB-INF">
|
||||
<fileset dir="${etc.dir}/cas">
|
||||
<include name="web.xml"/>
|
||||
<include name="applicationContext.xml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<war warfile="${dist.dir}/${name.cas}.war" webxml="${tmp.dir}/${name.cas}/WEB-INF/web.xml">
|
||||
<!-- Include the files which are not under WEB-INF -->
|
||||
<fileset dir="${tmp.dir}/${name.cas}">
|
||||
<exclude name="WEB-INF/**"/>
|
||||
<exclude name="classes/**"/>
|
||||
</fileset>
|
||||
|
||||
<!-- Bring in various XML configuration files -->
|
||||
<webinf dir="${tmp.dir}/${name.cas}/WEB-INF">
|
||||
<exclude name="web.xml"/>
|
||||
</webinf>
|
||||
|
||||
<!-- Include the compiled classes -->
|
||||
<classes dir="${tmp.dir}/${name.cas}/classes"/>
|
||||
|
||||
<!-- Include required libraries -->
|
||||
<lib dir="${lib.dir}/jakarta-taglibs" includes="*.jar"/>
|
||||
<lib dir="${lib.dir}/spring" includes="spring.jar"/>
|
||||
<lib dir="${lib.dir}/aop-alliance" includes="aopalliance.jar"/>
|
||||
<lib dir="${lib.dir}/regexp" includes="jakarta-oro.jar"/>
|
||||
<lib dir="${lib.dir}/j2ee" includes="jstl.jar"/>
|
||||
<lib dir="${lib.dir}/caucho" includes="*.jar"/>
|
||||
<lib dir="${lib.dir}/jakarta-commons" includes="commons-codec.jar"/>
|
||||
<lib dir="${lib.dir}/jakarta-commons" includes="commons-collections.jar"/>
|
||||
<lib dir="${lib.dir}/cas" includes="*.jar"/>
|
||||
<lib dir="${lib.dir}/ehcache" includes="ehcache.jar"/>
|
||||
<lib dir="${dist.lib.dir}" includes="acegi-security-taglib.jar"/>
|
||||
<lib dir="${dist.lib.dir}" includes="acegi-security.jar"/>
|
||||
</war>
|
||||
|
||||
<!-- Make WAR suitable for deployment into containers WITH container adapters -->
|
||||
<delete file="${dist.dir}/${name.ca}.war"/>
|
||||
<mkdir dir="${tmp.dir}/${name.ca}"/>
|
||||
|
||||
229
samples/contacts/etc/cas/applicationContext.xml
Normal file
229
samples/contacts/etc/cas/applicationContext.xml
Normal file
@@ -0,0 +1,229 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
|
||||
<!--
|
||||
- Application context loaded by ContextLoaderListener if NOT using container adapters
|
||||
- $Id$
|
||||
-->
|
||||
|
||||
<beans>
|
||||
|
||||
<!-- =================== SECURITY SYSTEM DEFINITIONS ================== -->
|
||||
|
||||
<!-- RunAsManager -->
|
||||
<bean id="runAsManager" class="net.sf.acegisecurity.runas.RunAsManagerImpl">
|
||||
<property name="key"><value>my_run_as_password</value></property>
|
||||
</bean>
|
||||
|
||||
<!-- ~~~~~~~~~~~~~~~~~~~~ AUTHENTICATION DEFINITIONS ~~~~~~~~~~~~~~~~~~ -->
|
||||
|
||||
<bean id="runAsAuthenticationProvider" class="net.sf.acegisecurity.runas.RunAsImplAuthenticationProvider">
|
||||
<property name="key"><value>my_run_as_password</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
|
||||
<property name="providers">
|
||||
<list>
|
||||
<ref bean="runAsAuthenticationProvider"/>
|
||||
<ref bean="casAuthenticationProvider"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="inMemoryDaoImpl" class="net.sf.acegisecurity.providers.dao.memory.InMemoryDaoImpl">
|
||||
<property name="userMap">
|
||||
<value>
|
||||
marissa=PASSWORD_NOT_USED,ROLE_TELLER,ROLE_SUPERVISOR
|
||||
dianne=PASSWORD_NOT_USED,ROLE_TELLER
|
||||
scott=PASSWORD_NOT_USED,ROLE_TELLER
|
||||
peter=PASSWORD_NOT_USED_AND_DISABLED_IGNORED,disabled,ROLE_TELLER
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="basicProcessingFilter" class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter">
|
||||
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
|
||||
<property name="authenticationEntryPoint"><ref bean="basicProcessingFilterEntryPoint"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="basicProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
|
||||
<property name="realmName"><value>Contacts Realm</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casAuthenticationProvider" class="net.sf.acegisecurity.providers.cas.CasAuthenticationProvider">
|
||||
<property name="casAuthoritiesPopulator"><ref bean="casAuthoritiesPopulator"/></property>
|
||||
<property name="casProxyDecider"><ref bean="casProxyDecider"/></property>
|
||||
<property name="ticketValidator"><ref bean="casProxyTicketValidator"/></property>
|
||||
<property name="statelessTicketCache"><ref bean="statelessTicketCache"/></property>
|
||||
<property name="key"><value>my_password_for_this_auth_provider_only</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casProxyTicketValidator" class="net.sf.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator">
|
||||
<property name="casValidate"><value>https://localhost:8443/cas/proxyValidate</value></property>
|
||||
<property name="proxyCallbackUrl"><value>https://localhost:8443/contacts-cas/casProxy/receptor</value></property>
|
||||
<property name="serviceProperties"><ref bean="serviceProperties"/></property>
|
||||
<!-- <property name="trustStore"><value>/some/path/to/your/lib/security/cacerts</value></property> -->
|
||||
</bean>
|
||||
|
||||
<bean id="statelessTicketCache" class="net.sf.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache">
|
||||
<property name="minutesToIdle"><value>20</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casAuthoritiesPopulator" class="net.sf.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
|
||||
<property name="authenticationDao"><ref bean="inMemoryDaoImpl"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casProxyDecider" class="net.sf.acegisecurity.providers.cas.proxy.RejectProxyTickets">
|
||||
</bean>
|
||||
|
||||
<bean id="serviceProperties" class="net.sf.acegisecurity.ui.cas.ServiceProperties">
|
||||
<property name="service"><value>https://localhost:8443/contacts-cas/j_acegi_cas_security_check</value></property>
|
||||
<property name="sendRenew"><value>false</value></property>
|
||||
</bean>
|
||||
|
||||
<!-- ~~~~~~~~~~~~~~~~~~~~ AUTHORIZATION DEFINITIONS ~~~~~~~~~~~~~~~~~~~ -->
|
||||
|
||||
<!-- An access decision voter that reads ROLE_* configuaration settings -->
|
||||
<bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>
|
||||
|
||||
<!-- An access decision voter that reads CONTACT_OWNED_BY_CURRENT_USER configuaration settings -->
|
||||
<bean id="contactSecurityVoter" class="sample.contact.ContactSecurityVoter"/>
|
||||
|
||||
<!-- An access decision manager used by the business objects -->
|
||||
<bean id="businessAccessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
|
||||
<property name="allowIfAllAbstainDecisions"><value>false</value></property>
|
||||
<property name="decisionVoters">
|
||||
<list>
|
||||
<ref bean="roleVoter"/>
|
||||
<ref bean="contactSecurityVoter"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- ===================== SECURITY DEFINITIONS ======================= -->
|
||||
|
||||
<bean id="publicContactManagerSecurity" class="net.sf.acegisecurity.intercept.method.MethodSecurityInterceptor">
|
||||
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
|
||||
<property name="accessDecisionManager"><ref bean="businessAccessDecisionManager"/></property>
|
||||
<property name="runAsManager"><ref bean="runAsManager"/></property>
|
||||
<property name="objectDefinitionSource">
|
||||
<value>
|
||||
sample.contact.ContactManager.delete=ROLE_SUPERVISOR,RUN_AS_SERVER
|
||||
sample.contact.ContactManager.getAllByOwner=CONTACT_OWNED_BY_CURRENT_USER,RUN_AS_SERVER
|
||||
sample.contact.ContactManager.save=CONTACT_OWNED_BY_CURRENT_USER,RUN_AS_SERVER
|
||||
sample.contact.ContactManager.getById=ROLE_TELLER,RUN_AS_SERVER
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- We expect all callers of the backend object to hold the role ROLE_RUN_AS_SERVER -->
|
||||
<bean id="backendContactManagerSecurity" class="net.sf.acegisecurity.intercept.method.MethodSecurityInterceptor">
|
||||
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
|
||||
<property name="accessDecisionManager"><ref bean="businessAccessDecisionManager"/></property>
|
||||
<property name="runAsManager"><ref bean="runAsManager"/></property>
|
||||
<property name="objectDefinitionSource">
|
||||
<value>
|
||||
sample.contact.ContactManager.delete=ROLE_RUN_AS_SERVER
|
||||
sample.contact.ContactManager.getAllByOwner=ROLE_RUN_AS_SERVER
|
||||
sample.contact.ContactManager.save=ROLE_RUN_AS_SERVER
|
||||
sample.contact.ContactManager.getById=ROLE_RUN_AS_SERVER
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- ======================= BUSINESS DEFINITIONS ===================== -->
|
||||
|
||||
<bean id="contactManager" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>sample.contact.ContactManager</value></property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>publicContactManagerSecurity</value>
|
||||
<value>publicContactManagerTarget</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="publicContactManagerTarget" class="sample.contact.ContactManagerFacade">
|
||||
<property name="backend"><ref bean="backendContactManager"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="backendContactManager" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces"><value>sample.contact.ContactManager</value></property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>backendContactManagerSecurity</value>
|
||||
<value>backendContactManagerTarget</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="backendContactManagerTarget" class="sample.contact.ContactManagerBackend"/>
|
||||
|
||||
<!-- ===================== HTTP REQUEST SECURITY ==================== -->
|
||||
|
||||
<bean id="casProcessingFilter" class="net.sf.acegisecurity.ui.cas.CasProcessingFilter">
|
||||
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
|
||||
<property name="authenticationFailureUrl"><value>/casfailed.jsp</value></property>
|
||||
<property name="defaultTargetUrl"><value>/</value></property>
|
||||
<property name="filterProcessesUrl"><value>/j_acegi_cas_security_check</value></property>
|
||||
</bean>
|
||||
|
||||
<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
|
||||
<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
|
||||
<property name="authenticationEntryPoint"><ref bean="casProcessingFilterEntryPoint"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="casProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
|
||||
<property name="loginUrl"><value>https://localhost:8443/cas/login</value></property>
|
||||
<property name="serviceProperties"><ref bean="serviceProperties"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="httpRequestAccessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
|
||||
<property name="allowIfAllAbstainDecisions"><value>false</value></property>
|
||||
<property name="decisionVoters">
|
||||
<list>
|
||||
<ref bean="roleVoter"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Note the order that entries are placed against the objectDefinitionSource is critical.
|
||||
The FilterSecurityInterceptor will work from the top of the list down to the FIRST pattern that matches the request URL.
|
||||
Accordingly, you should place MOST SPECIFIC (ie a/b/c/d.*) expressions first, with LEAST SPECIFIC (ie a/.*) expressions last -->
|
||||
<bean id="filterInvocationInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor">
|
||||
<property name="authenticationManager"><ref bean="authenticationManager"/></property>
|
||||
<property name="accessDecisionManager"><ref bean="httpRequestAccessDecisionManager"/></property>
|
||||
<property name="runAsManager"><ref bean="runAsManager"/></property>
|
||||
<property name="objectDefinitionSource">
|
||||
<value>
|
||||
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
|
||||
\A/secure/super.*\Z=ROLE_WE_DONT_HAVE
|
||||
\A/secure/.*\Z=ROLE_SUPERVISOR,ROLE_TELLER
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- BASIC Regular Expression Syntax (for beginners):
|
||||
|
||||
\A means the start of the string (ie the beginning of the URL)
|
||||
\Z means the end of the string (ie the end of the URL)
|
||||
. means any single character
|
||||
* means null or any number of repetitions of the last expression (so .* means zero or more characters)
|
||||
|
||||
Some examples:
|
||||
|
||||
Expression: \A/my/directory/.*\Z
|
||||
Would match: /my/directory/
|
||||
/my/directory/hello.html
|
||||
|
||||
Expression: \A/.*\Z
|
||||
Would match: /hello.html
|
||||
/
|
||||
|
||||
Expression: \A/.*/secret.html\Z
|
||||
Would match: /some/directory/secret.html
|
||||
/another/secret.html
|
||||
Not match: /anothersecret.html (missing required /)
|
||||
-->
|
||||
|
||||
</beans>
|
||||
20
samples/contacts/etc/cas/casfailed.jsp
Normal file
20
samples/contacts/etc/cas/casfailed.jsp
Normal file
@@ -0,0 +1,20 @@
|
||||
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %>
|
||||
<%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %>
|
||||
<%@ page import="net.sf.acegisecurity.AuthenticationException" %>
|
||||
<%-- This page will be copied into WAR's root directory if using CAS --%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Login to CAS failed!</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Login to CAS failed!</h1>
|
||||
|
||||
<font color="red">
|
||||
Your CAS credentials were rejected.<BR><BR>
|
||||
Reason: <%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>
|
||||
</font>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
160
samples/contacts/etc/cas/web.xml
Normal file
160
samples/contacts/etc/cas/web.xml
Normal file
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
|
||||
|
||||
<!--
|
||||
- Contacts web application
|
||||
- $Id$
|
||||
- File will be copied into WAR's WEB-INF directory if NOT using container adapter
|
||||
-->
|
||||
|
||||
<web-app>
|
||||
|
||||
<display-name>Contacts Sample Application</display-name>
|
||||
|
||||
<description>
|
||||
Example of an application secured using Acegi Security System for Spring.
|
||||
</description>
|
||||
|
||||
<!-- Required for CAS ProxyTicketReceptor servlet. This is the
|
||||
URL to CAS' "proxy" actuator, where a PGT and TargetService can
|
||||
be presented to obtain a new proxy ticket. THIS CAN BE
|
||||
REMOVED IF THE APPLICATION DOESN'T NEED TO ACT AS A PROXY -->
|
||||
<context-param>
|
||||
<param-name>edu.yale.its.tp.cas.proxyUrl</param-name>
|
||||
<param-value>http://localhost:8433/cas/proxy</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--
|
||||
- Location of the XML file that defines the root application context
|
||||
- Applied by ContextLoaderListener.
|
||||
-->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi CAS Processing Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetClass</param-name>
|
||||
<param-value>net.sf.acegisecurity.ui.cas.CasProcessingFilter</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetClass</param-name>
|
||||
<param-value>net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.ui.AutoIntegrationFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>Acegi HTTP Request Security Filter</filter-name>
|
||||
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
|
||||
<init-param>
|
||||
<param-name>targetClass</param-name>
|
||||
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi CAS Processing Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>Acegi HTTP Request Security Filter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!--
|
||||
- Loads the root application context of this web app at startup,
|
||||
- by default from "/WEB-INF/applicationContext.xml".
|
||||
- Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
|
||||
- to access it anywhere in the web application, outside of the framework.
|
||||
-->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
<!--
|
||||
- Servlet that dispatches request to registered handlers (Controller implementations).
|
||||
- Has its own application context, by default defined in "{servlet-name}-servlet.xml",
|
||||
- i.e. "contacts-servlet.xml".
|
||||
-
|
||||
- A web app can contain any number of such servlets.
|
||||
- Note that this web app does not have a shared root application context,
|
||||
- therefore the DispatcherServlet contexts do not have a common parent.
|
||||
-->
|
||||
<servlet>
|
||||
<servlet-name>contacts</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>caucho</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>2</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!-- CAS servlet which receives a proxy-granting ticket from the CAS
|
||||
server. THIS CAN BE REMOVED IF THE APPLICATION DOESN'T NEED TO
|
||||
ACT AS A PROXY -->
|
||||
<servlet>
|
||||
<servlet-name>casproxy</servlet-name>
|
||||
<servlet-class>edu.yale.its.tp.cas.proxy.ProxyTicketReceptor</servlet-class>
|
||||
<load-on-startup>3</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<!--
|
||||
- Maps the contacts dispatcher to /*.
|
||||
-
|
||||
-->
|
||||
<servlet-mapping>
|
||||
<servlet-name>contacts</servlet-name>
|
||||
<url-pattern>*.htm</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!--
|
||||
- Dispatcher servlet mapping for HTTP remoting via the Caucho protocols,
|
||||
- i.e. Hessian and Burlap (see caucho-servlet.xml for the controllers).
|
||||
-->
|
||||
<servlet-mapping>
|
||||
<servlet-name>caucho</servlet-name>
|
||||
<url-pattern>/caucho/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>casproxy</servlet-name>
|
||||
<url-pattern>/casProxy/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
<taglib>
|
||||
<taglib-uri>/spring</taglib-uri>
|
||||
<taglib-location>/WEB-INF/spring.tld</taglib-location>
|
||||
</taglib>
|
||||
|
||||
</web-app>
|
||||
15
samples/contacts/etc/ssl/acegisecurity.txt
Normal file
15
samples/contacts/etc/ssl/acegisecurity.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC1DCCAj0CBECA2vQwDQYJKoZIhvcNAQEEBQAwgbAxEDAOBgNVBAYTB1Vua25vd24xEDAOBgNV
|
||||
BAgTB1Vua25vd24xEDAOBgNVBAcTB1Vua25vd24xOTA3BgNVBAoTMFRFU1QgQ0VSVElGSUNBVEUg
|
||||
T05MWS4gRE8gTk9UIFVTRSBJTiBQUk9EVUNUSU9OLjEpMCcGA1UECxMgQWNlZ2kgU2VjdXJpdHkg
|
||||
U3lzdGVtIGZvciBTcHJpbmcxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNDA0MTcwNzIxMjRaFw0z
|
||||
MTA5MDIwNzIxMjRaMIGwMRAwDgYDVQQGEwdVbmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYD
|
||||
VQQHEwdVbmtub3duMTkwNwYDVQQKEzBURVNUIENFUlRJRklDQVRFIE9OTFkuIERPIE5PVCBVU0Ug
|
||||
SU4gUFJPRFVDVElPTi4xKTAnBgNVBAsTIEFjZWdpIFNlY3VyaXR5IFN5c3RlbSBmb3IgU3ByaW5n
|
||||
MRIwEAYDVQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANwJCiDthTNC
|
||||
SJZ87CYkhWWDBciaFRvuDldzgEGwEUF5gNczd8Er66Pvh+Ir350hjE4LsDfi5iQNOuhbRR37LvW5
|
||||
7CrKG3W+vq7K3Zr9JEqhP/U2ocPLQQF4/NbBKStRacGGY1O3koTqp9W8gE0vSlC3/KhoOoPWHkGh
|
||||
NZXOxuwLAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAdTlsziREdIR00/+tufCq/ACHSo2nJr1yRzIi
|
||||
cVOXJBws0f+M3TUSIaODFv/54bZnWtjlWGa55uhc425+LrkOtqus7cMoNnyte/C6g/gcnArkKVhL
|
||||
C68LGqARe9DK1ycquA4KmgiKyhi9a54kKA6BC4bmmEI98HpB6uxxvOB+ChE=
|
||||
-----END CERTIFICATE-----
|
||||
82
samples/contacts/etc/ssl/howto.txt
Normal file
82
samples/contacts/etc/ssl/howto.txt
Normal file
@@ -0,0 +1,82 @@
|
||||
$Id$
|
||||
|
||||
CAS requires HTTPS be used for all operations, with the certificate used
|
||||
having been signed by a certificate in the cacerts files shipped with Java.
|
||||
|
||||
If you're using a HTTPS certificate signed by a well known authority
|
||||
(like Verisign), you can safely ignore the procedure below (although you
|
||||
might find the troubleshooting section at the end helpful).
|
||||
|
||||
The following demonstrates how to create a self-signed certificate and add
|
||||
it to the cacerts file. If you just want to use the certificate we have
|
||||
already created and shipped with the Acegi Security System for Spring, you
|
||||
can skip directly to step 3.
|
||||
|
||||
|
||||
1. keytool -keystore keystore -alias acegisecurity -genkey -keyalg RSA -validity 9999 -storepass password -keypass password
|
||||
|
||||
What is your first and last name?
|
||||
[Unknown]: localhost
|
||||
What is the name of your organizational unit?
|
||||
[Unknown]: Acegi Security System for Spring
|
||||
What is the name of your organization?
|
||||
[Unknown]: TEST CERTIFICATE ONLY. DO NOT USE IN PRODUCTION.
|
||||
What is the name of your City or Locality?
|
||||
[Unknown]:
|
||||
What is the name of your State or Province?
|
||||
[Unknown]:
|
||||
What is the two-letter country code for this unit?
|
||||
[Unknown]:
|
||||
Is CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ONLY. D
|
||||
O NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown correct?
|
||||
[no]: yes
|
||||
|
||||
|
||||
2. keytool -export -v -rfc -alias acegisecurity -file acegisecurity.txt -keystore keystore -storepass password
|
||||
|
||||
3. copy acegisecurity.txt %JAVA_HOME%\lib\security
|
||||
|
||||
4. copy keystore %YOUR_WEB_CONTAINER_LOCATION%
|
||||
|
||||
NOTE: You will need to configure your web container as appropriate.
|
||||
We recommend you test the certificate works by visiting
|
||||
https://localhost:8443. When prompted by your browser, select to
|
||||
install the certificate.
|
||||
|
||||
5. cd %JAVA_HOME%\lib\security
|
||||
|
||||
6. keytool -import -v -file acegisecurity.txt -keypass password -keystore cacerts -storepass changeit -alias acegisecurity
|
||||
|
||||
Owner: CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ONL
|
||||
Y. DO NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown
|
||||
Issuer: CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ON
|
||||
LY. DO NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown
|
||||
Serial number: 4080daf4
|
||||
Valid from: Sat Apr 17 07:21:24 GMT 2004 until: Tue Sep 02 07:21:24 GMT 2031
|
||||
Certificate fingerprints:
|
||||
MD5: B4:AC:A8:24:34:99:F1:A9:F8:1D:A5:6C:BF:0A:34:FA
|
||||
SHA1: F1:E6:B1:3A:01:39:2D:CF:06:FA:82:AB:86:0D:77:9D:06:93:D6:B0
|
||||
Trust this certificate? [no]: yes
|
||||
Certificate was added to keystore
|
||||
[Saving cacerts]
|
||||
|
||||
|
||||
7. Finished. You can now run the sample application as if you purchased a
|
||||
properly signed certificate. For production applications, of course you should
|
||||
use an appropriately signed certificate so your web visitors will trust it
|
||||
(such as issued by Thawte, Verisign etc).
|
||||
|
||||
TROUBLESHOOTING
|
||||
|
||||
* A "sun.security.validator.ValidatorException: No trusted certificate
|
||||
found" indicates the cacerts is not being used or it did not correctly
|
||||
import the certificate. To rule out your web container replacing or in
|
||||
some way modifying the trust manager, set the
|
||||
CasAuthenticationProvider.trustStore property to the full file system
|
||||
location to your cacerts file.
|
||||
|
||||
* If your web container is ignoring your cacerts file, double-check it
|
||||
is stored in $JAVA_HOME\lib\security\cacerts. $JAVA_HOME might be
|
||||
pointing to the SDK, not JRE. In that case, copy
|
||||
$JAVA_HOME\jre\lib\security\cacerts to $JAVA_HOME\lib\security\cacerts
|
||||
|
||||
BIN
samples/contacts/etc/ssl/keystore
Normal file
BIN
samples/contacts/etc/ssl/keystore
Normal file
Binary file not shown.
@@ -3,6 +3,7 @@
|
||||
|
||||
name.filter=contacts
|
||||
name.ca=contacts-container-adapter
|
||||
name.cas=contacts-cas
|
||||
src.dir=src
|
||||
war.dir=war
|
||||
lib.dir=${basedir}/../../lib
|
||||
|
||||
Reference in New Issue
Block a user