mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-01 14:59:50 +00:00
Merge branch '3.5.x'
Closes gh-48055
This commit is contained in:
+2
@@ -1 +1,3 @@
|
||||
org.springframework.security.config.annotation.web.WebSecurityConfigurer
|
||||
org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer
|
||||
org.springframework.security.web.SecurityFilterChain
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2012-present 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.security.test.autoconfigure.webmvc;
|
||||
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
|
||||
import org.springframework.security.config.annotation.web.WebSecurityConfigurer;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* {@link WebSecurityConfigurer} used to test their inclusion in
|
||||
* {@link WebMvcTest @WebMvcTest}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Component
|
||||
class ExampleWebSecurityConfigurer implements WebSecurityConfigurer<WebSecurity> {
|
||||
|
||||
@Override
|
||||
public void init(WebSecurity builder) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(WebSecurity builder) {
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2012-present 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.security.test.autoconfigure.webmvc;
|
||||
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* {@link WebSecurityCustomizer} used to test their inclusion in
|
||||
* {@link WebMvcTest @WebMvcTest}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Component
|
||||
class ExampleWebSecurityCustomizer implements WebSecurityCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(WebSecurity web) {
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2012-present 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.security.test.autoconfigure.webmvc;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration tests for SpringSecurity with {@link WebMvcTest @WebMvcTest}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@WebMvcTest
|
||||
class SecurityWebMvcTestIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
|
||||
@Test
|
||||
void includesWebSecurityConfigurer() {
|
||||
assertThat(AssertableApplicationContext.get(() -> this.context))
|
||||
.hasSingleBean(ExampleWebSecurityConfigurer.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void includesWebSecurityCustomizer() {
|
||||
assertThat(AssertableApplicationContext.get(() -> this.context))
|
||||
.hasSingleBean(ExampleWebSecurityCustomizer.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void includesSecurityFilterChain() {
|
||||
assertThat(AssertableApplicationContext.get(() -> this.context)).hasSingleBean(SecurityFilterChain.class);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-3
@@ -50,9 +50,7 @@ class WebMvcTypeExcludeFilter extends StandardAnnotationCustomizableTypeExcludeF
|
||||
private static final Class<?>[] NO_CONTROLLERS = {};
|
||||
|
||||
private static final String[] OPTIONAL_INCLUDES = { "tools.jackson.databind.JacksonModule",
|
||||
"org.springframework.boot.jackson.JacksonComponent",
|
||||
"org.springframework.security.config.annotation.web.WebSecurityConfigurer",
|
||||
"org.springframework.security.web.SecurityFilterChain", "org.thymeleaf.dialect.IDialect",
|
||||
"org.springframework.boot.jackson.JacksonComponent", "org.thymeleaf.dialect.IDialect",
|
||||
"com.fasterxml.jackson.databind.Module", "org.springframework.boot.jackson2.JsonComponent" };
|
||||
|
||||
private static final Set<Class<?>> KNOWN_INCLUDES;
|
||||
|
||||
Reference in New Issue
Block a user