Benjamin Renard commited on 2014-12-11 14:02:09
Showing 1 changed files, with 175 additions and 0 deletions.
... | ... |
@@ -0,0 +1,175 @@ |
1 |
+<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
+<!-- |
|
3 |
+ | deployerConfigContext.xml centralizes into one file some of the declarative configuration that |
|
4 |
+ | all CAS deployers will need to modify. |
|
5 |
+ | |
|
6 |
+ | This file declares some of the Spring-managed JavaBeans that make up a CAS deployment. |
|
7 |
+ | The beans declared in this file are instantiated at context initialization time by the Spring |
|
8 |
+ | ContextLoaderListener declared in web.xml. It finds this file because this |
|
9 |
+ | file is among those declared in the context parameter "contextConfigLocation". |
|
10 |
+ | |
|
11 |
+ | By far the most common change you will need to make in this file is to change the last bean |
|
12 |
+ | declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with |
|
13 |
+ | one implementing your approach for authenticating usernames and passwords. |
|
14 |
+ +--> |
|
15 |
+<beans xmlns="http://www.springframework.org/schema/beans" |
|
16 |
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
17 |
+ xmlns:p="http://www.springframework.org/schema/p" |
|
18 |
+ xmlns:sec="http://www.springframework.org/schema/security" |
|
19 |
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd |
|
20 |
+ http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> |
|
21 |
+ <!-- |
|
22 |
+ | This bean declares our AuthenticationManager. The CentralAuthenticationService service bean |
|
23 |
+ | declared in applicationContext.xml picks up this AuthenticationManager by reference to its id, |
|
24 |
+ | "authenticationManager". Most deployers will be able to use the default AuthenticationManager |
|
25 |
+ | implementation and so do not need to change the class of this bean. We include the whole |
|
26 |
+ | AuthenticationManager here in the userConfigContext.xml so that you can see the things you will |
|
27 |
+ | need to change in context. |
|
28 |
+ +--> |
|
29 |
+ <bean id="authenticationManager" |
|
30 |
+ class="org.jasig.cas.authentication.AuthenticationManagerImpl"> |
|
31 |
+ <!-- |
|
32 |
+ | This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate. |
|
33 |
+ | The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which |
|
34 |
+ | supports the presented credentials. |
|
35 |
+ | |
|
36 |
+ | AuthenticationManagerImpl uses these resolvers for two purposes. First, it uses them to identify the Principal |
|
37 |
+ | attempting to authenticate to CAS /login . In the default configuration, it is the DefaultCredentialsToPrincipalResolver |
|
38 |
+ | that fills this role. If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace |
|
39 |
+ | DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are |
|
40 |
+ | using. |
|
41 |
+ | |
|
42 |
+ | Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket. |
|
43 |
+ | In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose. |
|
44 |
+ | You will need to change this list if you are identifying services by something more or other than their callback URL. |
|
45 |
+ +--> |
|
46 |
+ <property name="credentialsToPrincipalResolvers"> |
|
47 |
+ <list> |
|
48 |
+ <!-- |
|
49 |
+ | UsernamePasswordCredentialsToPrincipalResolver supports the UsernamePasswordCredentials that we use for /login |
|
50 |
+ | by default and produces SimplePrincipal instances conveying the username from the credentials. |
|
51 |
+ | |
|
52 |
+ | If you've changed your LoginFormAction to use credentials other than UsernamePasswordCredentials then you will also |
|
53 |
+ | need to change this bean declaration (or add additional declarations) to declare a CredentialsToPrincipalResolver that supports the |
|
54 |
+ | Credentials you are using. |
|
55 |
+ +--> |
|
56 |
+ <!-- |
|
57 |
+ <bean |
|
58 |
+ class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" /> |
|
59 |
+ --> |
|
60 |
+ <bean |
|
61 |
+ class="org.esupportail.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" /> |
|
62 |
+ |
|
63 |
+ <!-- |
|
64 |
+ | HttpBasedServiceCredentialsToPrincipalResolver supports HttpBasedCredentials. It supports the CAS 2.0 approach of |
|
65 |
+ | authenticating services by SSL callback, extracting the callback URL from the Credentials and representing it as a |
|
66 |
+ | SimpleService identified by that callback URL. |
|
67 |
+ | |
|
68 |
+ | If you are representing services by something more or other than an HTTPS URL whereat they are able to |
|
69 |
+ | receive a proxy callback, you will need to change this bean declaration (or add additional declarations). |
|
70 |
+ +--> |
|
71 |
+ <bean |
|
72 |
+ class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" /> |
|
73 |
+ </list> |
|
74 |
+ </property> |
|
75 |
+ |
|
76 |
+ <!-- |
|
77 |
+ | Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, |
|
78 |
+ | AuthenticationHandlers actually authenticate credentials. Here we declare the AuthenticationHandlers that |
|
79 |
+ | authenticate the Principals that the CredentialsToPrincipalResolvers identified. CAS will try these handlers in turn |
|
80 |
+ | until it finds one that both supports the Credentials presented and succeeds in authenticating. |
|
81 |
+ +--> |
|
82 |
+ <property name="authenticationHandlers" > |
|
83 |
+ <ref bean="handlerList"/> |
|
84 |
+ </property> |
|
85 |
+ </bean> |
|
86 |
+ |
|
87 |
+ <bean id="handlerList" class="org.springframework.beans.factory.config.ListFactoryBean"> |
|
88 |
+ <property name="sourceList"> |
|
89 |
+ <list> |
|
90 |
+ <!-- |
|
91 |
+ | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating |
|
92 |
+ | a server side SSL certificate. |
|
93 |
+ +--> |
|
94 |
+ <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" |
|
95 |
+ p:httpClient-ref="httpClient" /> |
|
96 |
+ </list> |
|
97 |
+ </property> |
|
98 |
+ </bean> |
|
99 |
+ |
|
100 |
+ <bean id="handlerDiscover" class="org.esupportail.cas.HandlersDiscover"> |
|
101 |
+ <property name="handlersId" value="${cas.authHandlers}"/> |
|
102 |
+ <property name="listToAdd" ref="handlerList"/> |
|
103 |
+ </bean> |
|
104 |
+ |
|
105 |
+ <!-- |
|
106 |
+ This bean defines the security roles for the Services Management application. Simple deployments can use the in-memory version. |
|
107 |
+ More robust deployments will want to use another option, such as the Jdbc version. |
|
108 |
+ |
|
109 |
+ The name of this should remain "userDetailsService" in order for Spring Security to find it. |
|
110 |
+ --> |
|
111 |
+ <!-- <sec:user name="@@THIS SHOULD BE REPLACED@@" password="notused" authorities="ROLE_ADMIN" />--> |
|
112 |
+ |
|
113 |
+ <sec:user-service id="userDetailsService"> |
|
114 |
+ <sec:user name="${security.useradmin}" password="notused" authorities="ROLE_ADMIN" /> |
|
115 |
+ </sec:user-service> |
|
116 |
+ |
|
117 |
+ <!-- |
|
118 |
+ Bean that defines the attributes that a service may return. This example uses the Stub/Mock version. A real implementation |
|
119 |
+ may go against a database or LDAP server. The id should remain "attributeRepository" though. |
|
120 |
+ --> |
|
121 |
+ <bean id="attributeRepository" |
|
122 |
+ class="org.jasig.services.persondir.support.StubPersonAttributeDao"> |
|
123 |
+ <property name="backingMap"> |
|
124 |
+ <map> |
|
125 |
+ <entry key="uid" value="uid" /> |
|
126 |
+ <entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> |
|
127 |
+ <entry key="groupMembership" value="groupMembership" /> |
|
128 |
+ </map> |
|
129 |
+ </property> |
|
130 |
+ </bean> |
|
131 |
+ |
|
132 |
+ <!-- |
|
133 |
+ Sample, in-memory data store for the ServiceRegistry. A real implementation |
|
134 |
+ would probably want to replace this with the JPA-backed ServiceRegistry DAO |
|
135 |
+ The name of this bean should remain "serviceRegistryDao". |
|
136 |
+ --> |
|
137 |
+ <bean |
|
138 |
+ id="serviceRegistryDao" |
|
139 |
+ class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl"> |
|
140 |
+ <property name="registeredServices"> |
|
141 |
+ <list> |
|
142 |
+ <bean class="org.jasig.cas.services.RegisteredServiceImpl"> |
|
143 |
+ <property name="id" value="0" /> |
|
144 |
+ <property name="name" value="HTTP" /> |
|
145 |
+ <property name="description" value="Only Allows HTTP Urls" /> |
|
146 |
+ <property name="serviceId" value="http://**" /> |
|
147 |
+ </bean> |
|
148 |
+ |
|
149 |
+ <bean class="org.jasig.cas.services.RegisteredServiceImpl"> |
|
150 |
+ <property name="id" value="1" /> |
|
151 |
+ <property name="name" value="HTTPS" /> |
|
152 |
+ <property name="description" value="Only Allows HTTPS Urls" /> |
|
153 |
+ <property name="serviceId" value="https://**" /> |
|
154 |
+ </bean> |
|
155 |
+ |
|
156 |
+ <bean class="org.jasig.cas.services.RegisteredServiceImpl"> |
|
157 |
+ <property name="id" value="2" /> |
|
158 |
+ <property name="name" value="IMAPS" /> |
|
159 |
+ <property name="description" value="Only Allows HTTPS Urls" /> |
|
160 |
+ <property name="serviceId" value="imaps://**" /> |
|
161 |
+ </bean> |
|
162 |
+ |
|
163 |
+ <bean class="org.jasig.cas.services.RegisteredServiceImpl"> |
|
164 |
+ <property name="id" value="3" /> |
|
165 |
+ <property name="name" value="IMAP" /> |
|
166 |
+ <property name="description" value="Only Allows IMAP Urls" /> |
|
167 |
+ <property name="serviceId" value="imap://**" /> |
|
168 |
+ </bean> |
|
169 |
+ </list> |
|
170 |
+ </property> |
|
171 |
+ </bean> |
|
172 |
+ |
|
173 |
+ <!-- <bean id="auditTrailManager" class="com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager" /> --> |
|
174 |
+ <bean id="auditTrailManager" class="org.esupportail.cas.audit.support.AuthAuditTrailManager" /> |
|
175 |
+</beans> |
|
0 | 176 |