In Spring 2, I've created a custom authentication provider, because I can't grab the password out of the database like Spring seems to prefer, because there's a black box in the way. When I try to authenticate, I get:
No AuthenticationProvider found for org.springframework.security.providers.UsernamePasswordAuthenticationToken
I've put this bean in my security.xml:
<bean id="imsAuthProvider" class="com.terrapages.mokbeecds.ims.IMSAuthenticationProvider">
<security:custom-authentication-provider />
</bean>
Which is, I believe, all I need. It should just grab the username and password from the form and pass it to my provider to deal with as it sees fit. I also have this in my customAuthenticationProvider:
public boolean supports(@SuppressWarnings("rawtypes") Class authentication) {
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
}
Which, as I understand it, is checked before giving the authentication token to the custom authentication provider. If it returns false, then Spring checks the next authentication provider.
The main authenticate(Authentication)
method can only throw a BadCredentialsException
or an AuthenticationServiceException
, which, as I understand, should not cause the output above.
Information on Spring 2 is a little hard to find, with Spring 3 being everywhere at the moment.
How do I get my provider to accept the UsernamePasswordAuthenticationToken
?
Spring Security 2 is also documented pretty well: http://static.springsource.org/spring-security/site/docs/2.0.x/reference/html/springsecurity.html Please use the following support method:
Edited
Suggestions: