java.lang.Object | ||
↳ | org.springframework.security.authentication.jaas.AbstractJaasAuthenticationProvider | |
↳ | org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider |
Creates a LoginContext using the Configuration provided to it. This allows
the configuration to be injected regardless of the value of
getConfiguration()
.
While not bound to any particular Configuration implementation, an in memory version of a JAAS
configuration can be represented using InMemoryConfiguration
.
The following JAAS configuration:
SPRINGSECURITY { sample.SampleLoginModule required; };
Can be represented as follows:
<bean id="jaasAuthProvider" class="org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider"> <property name="configuration"> <bean class="org.springframework.security.authentication.jaas.memory.InMemoryConfiguration"> <constructor-arg> <map> <!-- SPRINGSECURITY is the default loginContextName for AbstractJaasAuthenticationProvider--> <entry key="SPRINGSECURITY"> <array> <bean class="javax.security.auth.login.AppConfigurationEntry"> <constructor-arg value="sample.SampleLoginModule" /> <constructor-arg> <util:constant static-field="javax.security.auth.login.AppConfigurationEntry$LoginModuleControlFlag.REQUIRED" /> </constructor-arg> <constructor-arg> <map></map> </constructor-arg> </bean> </array> </entry> </map> </constructor-arg> </bean> </property> <property name="authorityGranters"> <list> <!-- You will need to write your own implementation of AuthorityGranter --> <bean class="org.springframework.security.authentication.jaas.TestAuthorityGranter"/> </list> </property> </bean>
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.security.authentication.jaas.AbstractJaasAuthenticationProvider
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Validates the required properties are set.
| |||||||||||
Sets the Configuration to use for Authentication.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a LoginContext using the Configuration that was specified in
setConfiguration(Configuration) . | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.security.authentication.jaas.AbstractJaasAuthenticationProvider
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.context.ApplicationEventPublisherAware
| |||||||||||
From interface
org.springframework.security.authentication.AuthenticationProvider
|
Validates the required properties are set. In addition, if
setCallbackHandlers(JaasAuthenticationCallbackHandler[])
has not
been called with valid handlers, initializes to use
JaasNameCallbackHandler
and JaasPasswordCallbackHandler
.
Exception |
---|
Sets the Configuration to use for Authentication.
configuration | the Configuration that is used when
createLoginContext(CallbackHandler) is called.
|
---|
Creates a LoginContext using the Configuration that was specified in
setConfiguration(Configuration)
.
handler | The CallbackHandler that should be used for the LoginContext (never null ). |
---|
LoginException |
---|