Java Reference
In-Depth Information
Figure 6-5.
Class diagram: authentication provider
The providers implement the
AuthenticationProvider
interface. It defines two
methods. The
authenticate
method is used to trigger the actual authentication process.
The authentication manager invokes this method and passes a reference to the
Authentication
object. The
supports
method checks whether the authentication provider
can work with the given
Authentication
object. As shown in Figure 6-5, Spring provides
several concrete implementations catering to most security requirements. Listing 6-9
shows the authentication provider for the current example.
Listing 6-9.
applicationContext-security.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
<beans>
<!—Other beans -->
<bean id="authenticationManager"
class="org.springframework.security.providers.ProviderManager">
<property name="providers">
<list>
<ref local="daoAuthenticationProvider"/>
</list>
