3333from springpython .security .vote import RoleVoter
3434from springpython .security .web import AuthenticationProcessingFilter
3535from springpython .security .web import AuthenticationProcessingFilterEntryPoint
36- from springpython .security .web import CherryPySessionStrategy
36+ from springpython .security .web import CP3SessionStrategy
3737from springpython .security .web import ExceptionTranslationFilter
38- from springpython .security .web import FilterChainProxy
38+ from springpython .security .web import CP3FilterChainProxy
3939from springpython .security .web import FilterSecurityInterceptor
4040from springpython .security .web import HttpSessionContextIntegrationFilter
4141from springpython .security .web import MiddlewareFilter
42- from springpython .security .web import RedirectStrategy
42+ from springpython .security .web import CP3RedirectStrategy
4343from springpython .security .web import SimpleAccessDeniedHandler
4444
4545class PetClinicClientAndServer (PythonConfig ):
@@ -62,11 +62,18 @@ def connectionFactory(self):
6262
6363 @Object
6464 def controller (self ):
65- return controller .PetClinicController (self .connectionFactory ())
65+ return controller .PetClinicController (self .connectionFactory ())
6666
6767 @Object
6868 def root (self ):
69- return view .PetClinicView (self .controller ())
69+ form = view .PetClinicView (controller = self .controller ())
70+ form .filter = self .authenticationProcessingFilter ()
71+ form .hashedUserDetailsServiceList = [self .md5UserDetailsService (),
72+ self .shaUserDetailsService ()]
73+ form .authenticationManager = self .authenticationManager ()
74+ form .redirectStrategy = self .redirectStrategy ()
75+ form .httpContextFilter = self .httpContextFilter ()
76+ return form
7077
7178 @Object
7279 def userDetailsService (self ):
@@ -164,11 +171,11 @@ def accessDecisionManager(self):
164171
165172 @Object
166173 def cherrypySessionStrategy (self ):
167- return CherryPySessionStrategy ()
174+ return CP3SessionStrategy ()
168175
169176 @Object
170177 def redirectStrategy (self ):
171- return RedirectStrategy ()
178+ return CP3RedirectStrategy ()
172179
173180 @Object
174181 def httpContextFilter (self ):
@@ -187,7 +194,7 @@ def authenticationProcessingFilter(self):
187194 def filterSecurityInterceptor (self ):
188195 filter = FilterSecurityInterceptor ()
189196 filter .auth_manager = self .authenticationManager ()
190- filter .access_decision_manager = self .accessDecisionManager ()
197+ filter .access_decision_mgr = self .accessDecisionManager ()
191198 filter .sessionStrategy = self .cherrypySessionStrategy ()
192199 filter .obj_def_source = [
193200 ("/vets.*" , ["VET_ANY" ]),
@@ -219,28 +226,17 @@ def exceptionTranslationFilter(self):
219226
220227 @Object
221228 def filterChainProxy (self ):
222- return FilterChainProxy (filterInvocationDefinitionSource =
229+ return CP3FilterChainProxy (filterInvocationDefinitionSource =
223230 [
224231 ("/images.*" , []),
225232 ("/html.*" , []),
226- ("/login.*" , [self . httpContextFilter () ]),
227- ("/.*" , [self . httpContextFilter () ,
228- self . exceptionTranslationFilter () ,
229- self . authenticationProcessingFilter () ,
230- self . filterSecurityInterceptor () ])
233+ ("/login.*" , [" httpContextFilter" ]),
234+ ("/.*" , [" httpContextFilter" ,
235+ " exceptionTranslationFilter" ,
236+ " authenticationProcessingFilter" ,
237+ " filterSecurityInterceptor" ])
231238 ])
232239
233- @Object
234- def loginForm (self ):
235- loginForm = view .CherryPyAuthenticationForm ()
236- loginForm .filter = self .authenticationProcessingFilter ()
237- loginForm .controller = self .controller ()
238- loginForm .hashedUserDetailsServiceList = [self .md5UserDetailsService (),
239- self .shaUserDetailsService ()]
240- loginForm .authenticationManager = self .authenticationManager ()
241- loginForm .redirectStrategy = self .redirectStrategy ()
242- return loginForm
243-
244240class PetClinicServerOnly (PythonConfig ):
245241 """
246242 This is a non-XML, decorator based IoC container definition which includes
@@ -308,7 +304,16 @@ def view(self):
308304
309305 @Object
310306 def root (self ):
311- return view .PetClinicView (self .controller ())
307+ form = view .PetClinicView (self .controller ())
308+ form .filter = self .authenticationProcessingFilter ()
309+ form .controller = self .controller ()
310+ form .hashedUserDetailsServiceList = []
311+ form .hashedUserDetailsServiceList .append (self .md5UserDetailsService ())
312+ form .hashedUserDetailsServiceList .append (self .shaUserDetailsService ())
313+ form .authenticationManager = self .authenticationManager ()
314+ form .redirectStrategy = self .redirectStrategy ()
315+ form .httpContextFilter = self .httpContextFilter ()
316+ return form
312317
313318 @Object
314319 def userDetailsService (self ):
@@ -408,11 +413,11 @@ def accessDecisionManager(self):
408413
409414 @Object
410415 def cherrypySessionStrategy (self ):
411- return CherryPySessionStrategy ()
416+ return CP3SessionStrategy ()
412417
413418 @Object
414419 def redirectStrategy (self ):
415- return RedirectStrategy ()
420+ return CP3RedirectStrategy ()
416421
417422 @Object
418423 def httpContextFilter (self ):
@@ -432,7 +437,7 @@ def filterSecurityInterceptor(self):
432437 filter = FilterSecurityInterceptor ()
433438 filter .validate_config_attributes = False
434439 filter .auth_manager = self .authenticationManager ()
435- filter .access_decision_manager = self .accessDecisionManager ()
440+ filter .access_decision_mgr = self .accessDecisionManager ()
436441 filter .sessionStrategy = self .cherrypySessionStrategy ()
437442 filter .obj_def_source = [("/vets.*" , ["VET_ANY" ]),
438443 ("/editOwner.*" , ["VET_ANY" , "OWNER" ]),
@@ -462,25 +467,14 @@ def exceptionTranslationFilter(self):
462467
463468 @Object
464469 def filterChainProxy (self ):
465- return FilterChainProxy (filterInvocationDefinitionSource =
470+ return CP3FilterChainProxy (filterInvocationDefinitionSource =
466471 [
467472 ("/images.*" , []),
468473 ("/html.*" , []),
469- ("/login.*" , [self . httpContextFilter () ]),
470- ("/.*" , [self . httpContextFilter () ,
471- self . exceptionTranslationFilter () ,
472- self . authenticationProcessingFilter () ,
473- self . filterSecurityInterceptor () ])
474+ ("/login.*" , [" httpContextFilter" ]),
475+ ("/.*" , [" httpContextFilter" ,
476+ " exceptionTranslationFilter" ,
477+ " authenticationProcessingFilter" ,
478+ " filterSecurityInterceptor" ])
474479 ])
475480
476- @Object
477- def loginForm (self ):
478- loginForm = view .CherryPyAuthenticationForm ()
479- loginForm .filter = self .authenticationProcessingFilter ()
480- loginForm .controller = self .controller ()
481- loginForm .hashedUserDetailsServiceList = []
482- loginForm .hashedUserDetailsServiceList .append (self .md5UserDetailsService ())
483- loginForm .hashedUserDetailsServiceList .append (self .shaUserDetailsService ())
484- loginForm .authenticationManager = self .authenticationManager ()
485- loginForm .redirectStrategy = self .redirectStrategy ()
486- return loginForm
0 commit comments