mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-26 22:02:41 +00:00
Corrected code for choosing entry point in namespace configuration.
This commit is contained in:
parent
7ff533735f
commit
0f12d31d90
@ -108,8 +108,8 @@ public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor
|
||||
*
|
||||
* <ol>
|
||||
* <li>If only one, use that one.</li>
|
||||
* <li>If more than one, use the form login entry point (if form login is being used)</li>
|
||||
* <li>If still ambiguous, throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
||||
* <li>If more than one, use the form login entry point (if form login is being used), then try basic</li>
|
||||
* <li>If still null, throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
||||
* </ol>
|
||||
*
|
||||
*/
|
||||
@ -123,11 +123,20 @@ public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor
|
||||
|
||||
Assert.isTrue(entryPoints.size() > 0, "No AuthenticationEntryPoint instances defined");
|
||||
|
||||
AuthenticationEntryPoint mainEntryPoint = (AuthenticationEntryPoint)
|
||||
entryPointMap.get(BeanIds.FORM_LOGIN_ENTRY_POINT);
|
||||
AuthenticationEntryPoint mainEntryPoint;
|
||||
|
||||
if (mainEntryPoint == null) {
|
||||
throw new SecurityConfigurationException("Failed to resolve authentication entry point");
|
||||
if (entryPoints.size() == 1) {
|
||||
mainEntryPoint = (AuthenticationEntryPoint) entryPoints.get(0);
|
||||
} else {
|
||||
mainEntryPoint = (AuthenticationEntryPoint) entryPointMap.get(BeanIds.FORM_LOGIN_ENTRY_POINT);
|
||||
|
||||
if (mainEntryPoint == null) {
|
||||
mainEntryPoint = (AuthenticationEntryPoint)
|
||||
entryPointMap.get(BeanIds.BASIC_AUTHENTICATION_ENTRY_POINT);
|
||||
if (mainEntryPoint == null) {
|
||||
throw new SecurityConfigurationException("Failed to resolve authentication entry point");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Main AuthenticationEntryPoint set to " + mainEntryPoint);
|
||||
|
Loading…
x
Reference in New Issue
Block a user