mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 14:52:24 +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>
|
* <ol>
|
||||||
* <li>If only one, use that one.</li>
|
* <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 more than one, use the form login entry point (if form login is being used), then try basic</li>
|
||||||
* <li>If still ambiguous, throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
* <li>If still null, throw an exception (for now). TODO: Examine additional beans and types and make decision</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -123,12 +123,21 @@ public class HttpSecurityConfigPostProcessor implements BeanFactoryPostProcessor
|
|||||||
|
|
||||||
Assert.isTrue(entryPoints.size() > 0, "No AuthenticationEntryPoint instances defined");
|
Assert.isTrue(entryPoints.size() > 0, "No AuthenticationEntryPoint instances defined");
|
||||||
|
|
||||||
AuthenticationEntryPoint mainEntryPoint = (AuthenticationEntryPoint)
|
AuthenticationEntryPoint mainEntryPoint;
|
||||||
entryPointMap.get(BeanIds.FORM_LOGIN_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) {
|
if (mainEntryPoint == null) {
|
||||||
throw new SecurityConfigurationException("Failed to resolve authentication entry point");
|
throw new SecurityConfigurationException("Failed to resolve authentication entry point");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger.info("Main AuthenticationEntryPoint set to " + mainEntryPoint);
|
logger.info("Main AuthenticationEntryPoint set to " + mainEntryPoint);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user