Hi Andrei
Thanks so much for putting in that much effort.
I think there is no problem with voter. The exception you r getting shows up when u try to access secured method without going thru authentication process with success, as it stores authentication object in security context after authentication success. So every time u try to access secured method it will fetch that authentication object from securityContext.
I m not able to deploy your test application as it is giving me some errors which i fail to understand :
Code:
08:28:36,283 INFO [STDOUT] 08:28:36,252 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'springSecurityFilterChain' defined in class path resource
[applicationContext.xml]: Invocation of init method failed; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'logoutFilter' defined in class path resource
[applicationContext.xml]: Cannot resolve reference to bean
'rememberMeServices' while setting constructor argument with key [0];
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'rememberMeServices' defined in class path resource
[applicationContext.xml]: Cannot resolve reference to bean
'userDetailsService' while setting bean property 'userDetailsService'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userDetailsService' defined in class path resource
[applicationContext.xml]: Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [com.maverick.UserDetailsServiceImpl]: Constructor threw
exception; nested exception is java.lang.Error: Unresolved compilation
problems:
The import org.springframework cannot be resolved
The import org.springframework cannot be resolved
The import org.springframework cannot be resolved
The import org.springframework cannot be resolved
UserDetailsService cannot be resolved to a type
UserDetails cannot be resolved to a type
UsernameNotFoundException cannot be resolved to a type
DataAccessException cannot be resolved to a type
The method retrieve() is undefined for the type IDatabaseAPI