|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2002-2024 the original author or authors.
|
|
|
+ * Copyright 2002-2025 the original author or authors.
|
|
|
*
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -50,6 +50,7 @@ import org.springframework.web.filter.DelegatingFilterProxy;
|
|
|
* @param <O> The object that this builder returns
|
|
|
* @param <B> The type of this builder (that is returned by the base class)
|
|
|
* @author Rob Winch
|
|
|
+ * @author DingHao
|
|
|
* @see WebSecurity
|
|
|
*/
|
|
|
public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBuilder<O>>
|
|
@@ -386,8 +387,10 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|
|
for (SecurityConfigurer<O, B> configurer : configurers) {
|
|
|
configurer.init((B) this);
|
|
|
}
|
|
|
- for (SecurityConfigurer<O, B> configurer : this.configurersAddedInInitializing) {
|
|
|
- configurer.init((B) this);
|
|
|
+ while (!this.configurersAddedInInitializing.isEmpty()) {
|
|
|
+ for (SecurityConfigurer<O, B> configurer : getConfigurersInInitializing()) {
|
|
|
+ configurer.init((B) this);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -407,6 +410,12 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private List<SecurityConfigurer<O, B>> getConfigurersInInitializing() {
|
|
|
+ List<SecurityConfigurer<O, B>> result = new ArrayList<>(this.configurersAddedInInitializing);
|
|
|
+ this.configurersAddedInInitializing.clear();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Determines if the object is unbuilt.
|
|
|
* @return true, if unbuilt else false
|