Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.security.config.Customizer;
import org.springframework.security.config.ObjectPostProcessor;
Expand All @@ -51,6 +52,7 @@
* @param <B> The type of this builder (that is returned by the base class)
* @author Rob Winch
* @author DingHao
* @author Andrey Litvitski
* @see WebSecurity
*/
public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBuilder<O>>
Expand Down Expand Up @@ -101,7 +103,7 @@ protected AbstractConfiguredSecurityBuilder(ObjectPostProcessor<Object> objectPo
* @return the result of {@link SecurityBuilder#build()} or {@link #getObject()}. If
* an error occurs while building, returns null.
*/
public O getOrBuild() {
public @Nullable O getOrBuild() {
if (!isUnbuilt()) {
return getObject();
}
Expand Down Expand Up @@ -182,7 +184,7 @@ public <C> void setSharedObject(Class<C> sharedType, C object) {
* @return the shared Object or null if it is not found
*/
@SuppressWarnings("unchecked")
public <C> C getSharedObject(Class<C> sharedType) {
public <C> @Nullable C getSharedObject(Class<C> sharedType) {
return (C) this.sharedObjects.get(sharedType);
}

Expand Down Expand Up @@ -276,7 +278,7 @@ public <C extends SecurityConfigurer<O, B>> C getConfigurer(Class<C> clazz) {
* @return
*/
@SuppressWarnings("unchecked")
public <C extends SecurityConfigurer<O, B>> C removeConfigurer(Class<C> clazz) {
public <C extends SecurityConfigurer<O, B>> @Nullable C removeConfigurer(Class<C> clazz) {
List<SecurityConfigurer<O, B>> configs = this.configurers.remove(clazz);
if (configs == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ operator fun HttpSecurity.invoke(httpConfiguration: HttpSecurityDsl.() -> Unit)
* in order to configure [HttpSecurity] using idiomatic Kotlin code.
*
* @author Eleftheria Stein
* @author Andrey Litvitski
* @since 5.3
* @param http the [HttpSecurity] which all configurations will be applied to
* @param init the configurations to apply to the provided [HttpSecurity]
Expand All @@ -82,7 +83,7 @@ operator fun HttpSecurity.invoke(httpConfiguration: HttpSecurityDsl.() -> Unit)
class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecurityDsl.() -> Unit) {

var authenticationManager: AuthenticationManager? = null
val context: ApplicationContext = http.getSharedObject(ApplicationContext::class.java)
val context: ApplicationContext = http.getSharedObject(ApplicationContext::class.java)!!

Comment on lines 84 to 87

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the build fails.

init {
applyFunction1HttpSecurityDslBeans(this.context, this)
Expand Down
Loading