Hi,
I'm new to Spring Security 2.0.x. I've read through the documentation to get a first look how Spring Security works. Now I'm experimenting with PreAuth mechanisms.
I want to implement a custom AbstractPreAuthenticatedProcessingFilter, so I can extract some information from the HttpServletRequest about the user principals. Then I want to invoke a custom service to get all the GrantedAuthorities and user details for the principal.
I got in trouble setting up the configuration for this scenario. I get the following exception:
Here is my configuration:Code:java.lang.IllegalArgumentException: Object of class [org.springframework.security.ui.WebAuthenticationDetails] must be an instance of interface org.springframework.security.GrantedAuthoritiesContainer
The exception is thrown after b2bProcessingFilter#getPreAuthenticatedCredentials () has been invoked but before the UserDetailsService is called.Code:<sec:http entry-point-ref="entryPoint"> <sec:intercept-url pattern="/**" access="ROLE_USER" /> </sec:http> <sec:authentication-manager alias="authenticationManager" /> <bean id="b2bProcessingFilter" class="my.custom.security.B2bProcessingFilter"> <sec:custom-filter position="PRE_AUTH_FILTER" /> <property name="authenticationManager" ref="authenticationManager" /> </bean> <bean id="b2bAuthenticationProvider" class="org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationProvider"> <sec:custom-authentication-provider /> <property name="preAuthenticatedUserDetailsService" ref="b2bUserDetailsService" /> </bean> <bean id="b2bUserDetailsService" class="my.custom.security.B2bUserDetailsService" /> <bean id="entryPoint" class="org.springframework.security.ui.preauth.PreAuthenticatedProcessingFilterEntryPoint" /> <sec:global-method-security secured-annotations="enabled" />
Am I missing something? Is my configuration wrong? Any hints?
Thanks in advance...
Edit:
After taking a look into the spring sources I realized, that per default AbstractPreAuthenticatedProcessingFilter is using a WebAuthenticationDetailsSource which returns WebAuthenticationDetails objects. WebAuthenticationDetails does not implement GrantedAuthoritiesContainer, but PreAuthenticatedGrantedAuthoritiesWebAuthenticatio nDetails does.
Do I have to manually configure a WebAuthenticationDetailsSource which return PreAuthenticatedGrantedAuthoritiesWebAuthenticatio nDetails objects? I'm a little bit confused because I thought that the AuthenticationProvider is resonsible to retrieve the GrantedAuthorities.
In my case the GrantedAuthorities are not part of the Request. I have to invoke a service the get them in combination with the user details.


