mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
Merge branch '3.0.x' into 3.1.x
This commit is contained in:
commit
607ed86edb
@ -53,8 +53,6 @@ class ReactiveCloudFoundrySecurityService {
|
||||
|
||||
private final String cloudControllerUrl;
|
||||
|
||||
private Mono<String> uaaUrl;
|
||||
|
||||
ReactiveCloudFoundrySecurityService(WebClient.Builder webClientBuilder, String cloudControllerUrl,
|
||||
boolean skipSslValidation) {
|
||||
Assert.notNull(webClientBuilder, "WebClient must not be null");
|
||||
@ -149,7 +147,7 @@ class ReactiveCloudFoundrySecurityService {
|
||||
* @return the UAA url Mono
|
||||
*/
|
||||
Mono<String> getUaaUrl() {
|
||||
this.uaaUrl = this.webClient.get()
|
||||
return this.webClient.get()
|
||||
.uri(this.cloudControllerUrl + "/info")
|
||||
.retrieve()
|
||||
.bodyToMono(Map.class)
|
||||
@ -157,7 +155,6 @@ class ReactiveCloudFoundrySecurityService {
|
||||
.cache()
|
||||
.onErrorMap((ex) -> new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE,
|
||||
"Unable to fetch token keys from UAA."));
|
||||
return this.uaaUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,9 +24,8 @@ import java.security.Signature;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
@ -44,7 +43,7 @@ class ReactiveTokenValidator {
|
||||
|
||||
private final ReactiveCloudFoundrySecurityService securityService;
|
||||
|
||||
private volatile ConcurrentMap<String, String> cachedTokenKeys = new ConcurrentHashMap<>();
|
||||
private volatile Map<String, String> cachedTokenKeys = Collections.emptyMap();
|
||||
|
||||
ReactiveTokenValidator(ReactiveCloudFoundrySecurityService securityService) {
|
||||
this.securityService = securityService;
|
||||
@ -92,7 +91,7 @@ class ReactiveTokenValidator {
|
||||
}
|
||||
|
||||
private void cacheTokenKeys(Map<String, String> tokenKeys) {
|
||||
this.cachedTokenKeys = new ConcurrentHashMap<>(tokenKeys);
|
||||
this.cachedTokenKeys = Map.copyOf(tokenKeys);
|
||||
}
|
||||
|
||||
private boolean hasValidSignature(Token token, String key) {
|
||||
|
@ -67,7 +67,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.OrRequestMatcher;
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
@ -125,8 +124,8 @@ public class CloudFoundryActuatorAutoConfiguration {
|
||||
allEndpoints.addAll(webEndpoints);
|
||||
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
|
||||
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
|
||||
return new CloudFoundryWebEndpointServletHandlerMapping(new EndpointMapping("/cloudfoundryapplication"),
|
||||
webEndpoints, endpointMediaTypes, getCorsConfiguration(), securityInterceptor, allEndpoints);
|
||||
return new CloudFoundryWebEndpointServletHandlerMapping(new EndpointMapping(BASE_PATH), webEndpoints,
|
||||
endpointMediaTypes, getCorsConfiguration(), securityInterceptor, allEndpoints);
|
||||
}
|
||||
|
||||
private CloudFoundrySecurityInterceptor getSecurityInterceptor(RestTemplateBuilder restTemplateBuilder,
|
||||
@ -189,9 +188,7 @@ public class CloudFoundryActuatorAutoConfiguration {
|
||||
.forEach((path) -> requestMatchers.add(new AntPathRequestMatcher(path + "/**")));
|
||||
requestMatchers.add(new AntPathRequestMatcher(BASE_PATH));
|
||||
requestMatchers.add(new AntPathRequestMatcher(BASE_PATH + "/"));
|
||||
if (!CollectionUtils.isEmpty(requestMatchers)) {
|
||||
web.ignoring().requestMatchers(new OrRequestMatcher(requestMatchers));
|
||||
}
|
||||
web.ignoring().requestMatchers(new OrRequestMatcher(requestMatchers));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class CompositePropagationFactoryTests {
|
||||
}
|
||||
|
||||
@Nested
|
||||
static class CompostePropagationTests {
|
||||
class CompositePropagationTests {
|
||||
|
||||
@Test
|
||||
void keys() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@ -152,12 +152,12 @@ class DevToolsR2dbcAutoConfigurationTests {
|
||||
|
||||
@Nested
|
||||
@ClassPathExclusions("r2dbc-pool*.jar")
|
||||
static class Embedded extends Common {
|
||||
class Embedded extends Common {
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
static class Pooled extends Common {
|
||||
class Pooled extends Common {
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@ import org.springframework.core.Ordered;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@ -117,7 +116,7 @@ class RestartApplicationListenerTests {
|
||||
SpringApplication application = new SpringApplication();
|
||||
ConfigurableApplicationContext context = mock(ConfigurableApplicationContext.class);
|
||||
listener.onApplicationEvent(new ApplicationStartingEvent(bootstrapContext, application, ARGS));
|
||||
assertThat(Restarter.getInstance()).isNotEqualTo(nullValue());
|
||||
assertThat(Restarter.getInstance()).isNotNull();
|
||||
assertThat(Restarter.getInstance().isFinished()).isFalse();
|
||||
listener.onApplicationEvent(new ApplicationPreparedEvent(application, ARGS, context));
|
||||
if (failed) {
|
||||
|
@ -253,7 +253,7 @@ public class SpringBootMockMvcBuilderCustomizer implements MockMvcBuilderCustomi
|
||||
}
|
||||
|
||||
void clear() {
|
||||
this.lines.get().clear();
|
||||
this.lines.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 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.
|
||||
@ -64,13 +64,14 @@ public class JsonStream {
|
||||
*/
|
||||
public <T> void get(InputStream content, Class<T> type, Consumer<T> consumer) throws IOException {
|
||||
JsonFactory jsonFactory = this.objectMapper.getFactory();
|
||||
JsonParser parser = jsonFactory.createParser(content);
|
||||
while (!parser.isClosed()) {
|
||||
JsonToken token = parser.nextToken();
|
||||
if (token != null && token != JsonToken.END_OBJECT) {
|
||||
T node = read(parser, type);
|
||||
if (node != null) {
|
||||
consumer.accept(node);
|
||||
try (JsonParser parser = jsonFactory.createParser(content)) {
|
||||
while (!parser.isClosed()) {
|
||||
JsonToken token = parser.nextToken();
|
||||
if (token != null && token != JsonToken.END_OBJECT) {
|
||||
T node = read(parser, type);
|
||||
if (node != null) {
|
||||
consumer.accept(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ class BeanDefinitionLoader {
|
||||
.getResources(ClassUtils.convertClassNameToResourcePath(source.toString()) + "/*.class");
|
||||
for (Resource resource : resources) {
|
||||
String className = StringUtils.stripFilenameExtension(resource.getFilename());
|
||||
load(Class.forName(source.toString() + "." + className));
|
||||
load(Class.forName(source + "." + className));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class StandardConfigDataResource extends ConfigDataResource {
|
||||
}
|
||||
|
||||
private boolean isSameFile(File ours, File other) {
|
||||
return (ours != null) && (other != null) && ours.equals(other);
|
||||
return (ours != null) && ours.equals(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -119,9 +119,10 @@ public class StandardConfigDataResource extends ConfigDataResource {
|
||||
public String toString() {
|
||||
if (this.resource instanceof FileSystemResource || this.resource instanceof FileUrlResource) {
|
||||
try {
|
||||
return "file [" + this.resource.getFile().toString() + "]";
|
||||
return "file [" + this.resource.getFile() + "]";
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
return this.resource.toString();
|
||||
@ -131,11 +132,11 @@ public class StandardConfigDataResource extends ConfigDataResource {
|
||||
try {
|
||||
if (resource instanceof ClassPathResource || resource instanceof FileSystemResource
|
||||
|| resource instanceof FileUrlResource) {
|
||||
File file = resource.getFile();
|
||||
return (file != null) ? file.getAbsoluteFile() : null;
|
||||
return resource.getFile().getAbsoluteFile();
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// Ignore
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user