Re: Custom Authenticator notfiring...?!?? !@?
"Griffith, Michael *" <[email protected]>
| Newsgroups | gmane.comp.java.springframework.user |
|---|---|
| Message-ID | <[email protected]> |
Rodrigo, Thanks for the reply! This is really confusing. I get what you are telling me, but I thought that the Filters fired in the order defined in the chain. In this case, anonymousProcessingFilter is configured as the 5th filter, and my MockAuthenticationFilter should be the 3rd filter. Is the problem the httpSessionContextIntegrationFilter? What should I do to get my filter to fire beforehand? Cheers! MG -----Original Message----- From: CV - Peinado Rodrigo [mailto:[email protected]] Sent: Monday, March 23, 2009 4:36 PM To: List for Spring users Subject: Re: [Springframework-user] Custom Authenticator notfiring...?!?? !@? Hi Michael, the method attemptAuthentication from MockAuthenticationFilter is not invoked because there is already a security context in the session. As you can read in the logs, a previous filter (the first) detected that: [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 1 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.context.HttpSessionContextIntegrationFilter@b3869c' [Repository] DEBUG - HttpSessionContextIntegrationFilter.doFilter(227) | Obtained a valid SecurityContext from ACEGI_SECURITY_CONTEXT to associate with SecurityContextHolder: 'org.acegisecurity.context.SecurityContextImpl@6faaf9b0: Authentication: org.acegisecurity.provid ers.anonymous.AnonymousAuthenticationToken@6faaf9b0: Username: anonymousUser; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@ffff8868: RemoteIpAddress: 10.148.0.185; SessionId: null; Granted Authorities: ROLE_ANONYMOUS' Rodrigo. -----Mensaje original----- De: Griffith, Michael * [mailto:[email protected]] Enviado el: Lunes, 23 de Marzo de 2009 06:17 p.m. Para: List for Spring users Asunto: [Springframework-user] Custom Authenticator not firing...?!??!@? Hi everyone, I'm trying to stub out a custom authenticator, which I will later get to authenticate against Quest's Web SSO. I am using Acegi 1.0.7 and Spring 2.5.x It doesn't seem that the custom filter is doing its job and the authentication mechanism always returns anonymous user because of the anonymousProcessingFilter. I have my filterProxy Chain defined as such: <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=httpSessionContextIntegrationFilter,logoutFilter,mockAuthenticationF ilter,securityContextHolderAwareRequestFilter,anonymousProcessingFilter, exceptionTranslationFilter,filterInvocationInterceptor </value> </property> </bean> The rest of the authentication wiring looks like: <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref bean="mockAuthenticatorProvider"/> </list> </property> </bean> <bean id="mockAuthenticatorProvider" class="...web.util.MockAuthenticatorProvider"/> <bean id="mockAuthenticationFilter" class="...web.filter.MockAuthenticationFilter"> <property name="authenticationManager"><ref local="authenticationManager"/></property> <property name="authenticationFailureUrl"><value>/public/login.action?login_error= 1</value></property> <property name="defaultTargetUrl"><value>/</value></property> <property name="filterProcessesUrl"><value>/j_acegi_mock_security_check</value></p roperty> </bean> My filter looks as such: public class MockAuthenticationFilter extends AbstractProcessingFilter { private static final Log logger = LogFactory.getLog(MockAuthenticationFilter.class); @Override public Authentication attemptAuthentication(HttpServletRequest requests) throws AuthenticationException { logger.debug("**** in MockAuthenticationFilter.attemptAuthentication"); Authentication authentication= getAuthenticationManager().authenticate(null); logger.debug("Returning Authentication: " + authentication); return authentication; } @Override public String getDefaultFilterProcessesUrl() { // TODO Auto-generated method stub return "/j_acegi_mock_security_check"; } } What am I missing about this configuration? The whole chain is supposed to return a MockAuthentication object with my hard coded info for principle and granted authorities, but I never see any of the debugging statements in the log. From the log info below, it looks as if the filter is being referenced in the chain, but none of the authentication mechanisms seems to be firing: [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 1 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.context.HttpSessionContextIntegrationFilter@b3869c' [Repository] DEBUG - HttpSessionContextIntegrationFilter.doFilter(227) | Obtained a valid SecurityContext from ACEGI_SECURITY_CONTEXT to associate with SecurityContextHolder: 'org.acegisecurity.context.SecurityContextImpl@6faaf9b0: Authentication: org.acegisecurity.provid ers.anonymous.AnonymousAuthenticationToken@6faaf9b0: Username: anonymousUser; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@ffff8868: RemoteIpAddress: 10.148.0.185; SessionId: null; Granted Authorities: ROLE_ANONYMOUS' [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 2 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.ui.logout.LogoutFilter@192b987' [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 3 of 7 in additional filter chain; firing Filter: 'gov.hhs.fda.ocio.fastar.repository.web.filter.MockAuthenticationFilter@ 1d2625d' [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 4 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter@137d0 cf' [Repository] DEBUG - SavedRequestAwareWrapper.<init>(107) | Wrapper not replaced; SavedRequest was: null [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 5 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.providers.anonymous.AnonymousProcessingFilter@16dcbc9 ' [Repository] DEBUG - AnonymousProcessingFilter.doFilter(118) | SecurityContextHolder not populated with anonymous token, as it already contained: 'org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken@6faa f9b0: Username: anonymousUser; Password: [PROTECTED]; Authenticated: true; Details: org.acegisecurity.ui.WebAuthenticationDetails@ffff8868: RemoteIpAddress: 10.148.0.185; SessionId: null; Granted Authorities: ROLE_ANONYMOUS' [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 6 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.ui.ExceptionTranslationFilter@15e3974' [STDOUT] [Repository] DEBUG - FilterChainProxy$VirtualFilterChain.doFilter(270) | /js/script.aculo.us/dragdrop.js at position 7 of 7 in additional filter chain; firing Filter: 'org.acegisecurity.intercept.web.FilterSecurityInterceptor@10e0904' Any reply would be appreciated. Best Regards, MG ------------------------------------------------------------------------ ---- -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Springframework-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/springframework-user *** ADVERTENCIA *** - El contenido del presente mensaje y los archivos adjuntos que pudiera contener son privados, estrictamente confidenciales y exclusivos para su destinatario, pudiendo contener informacion protegida por normas legales y de secreto profesional. Bajo ninguna circunstancia su contenido puede ser transmitido o revelado a terceros ni divulgado en forma alguna. En consecuencia de haberlo recibido por error, rogamos contactar al remitente y eliminarlo de su sistema. No nos responsabilizamos por la integridad y la seguridad de este mensaje, ya que el mismo podria estar sujeto a manipulaciones ilegales de informacion. *** WARNING *** - The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The integrity and security of this message cannot be guaranteed and it may be subject to unauthorized amendment, for which we accept no liability. ------------------------------------------------------------------------ ------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Springframework-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/springframework-user ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com