Revert unnecessary merges on 6.0.x

This commit removes unnecessary main-branch merges starting from
8750608b5b and adds the following
needed commit(s) that were made afterward:

- 5dce82c48b
This commit is contained in:
Steve Riesenberg
2023-10-31 15:11:45 -05:00
parent e9d4223402
commit 9db33f33c7
676 changed files with 6306 additions and 43249 deletions

View File

@@ -94,7 +94,7 @@ class PayloadInterceptorRSocket extends RSocketProxy {
return intercept(PayloadExchangeType.REQUEST_CHANNEL, firstPayload)
.flatMapMany((context) -> innerFlux.index()
.concatMap((tuple) -> justOrIntercept(tuple.getT1(), tuple.getT2()))
.transform(this.source::requestChannel)
.transform((securedPayloads) -> this.source.requestChannel(securedPayloads))
.contextWrite(context));
});
}
@@ -115,7 +115,7 @@ class PayloadInterceptorRSocket extends RSocketProxy {
DefaultPayloadExchange exchange = new DefaultPayloadExchange(type, payload, this.metadataMimeType,
this.dataMimeType);
return chain.next(exchange)
.then(Mono.fromCallable(chain::getContext))
.then(Mono.fromCallable(() -> chain.getContext()))
.defaultIfEmpty(Context.empty())
.contextWrite(this.context);
});

View File

@@ -81,7 +81,9 @@ class PayloadSocketAcceptor implements SocketAcceptor {
ContextPayloadInterceptorChain chain = new ContextPayloadInterceptorChain(this.interceptors);
DefaultPayloadExchange exchange = new DefaultPayloadExchange(PayloadExchangeType.SETUP, payload,
metadataMimeType, dataMimeType);
return chain.next(exchange).then(Mono.fromCallable(chain::getContext)).defaultIfEmpty(Context.empty());
return chain.next(exchange)
.then(Mono.fromCallable(() -> chain.getContext()))
.defaultIfEmpty(Context.empty());
});
}

View File

@@ -16,6 +16,9 @@
package org.springframework.security.rsocket.util.matcher;
import reactor.core.publisher.Mono;
import org.springframework.security.rsocket.api.PayloadExchange;
import org.springframework.security.rsocket.api.PayloadExchangeType;
/**
@@ -27,17 +30,37 @@ public final class PayloadExchangeMatchers {
}
public static PayloadExchangeMatcher setup() {
return (exchange) -> PayloadExchangeType.SETUP.equals(exchange.getType())
? PayloadExchangeMatcher.MatchResult.match() : PayloadExchangeMatcher.MatchResult.notMatch();
return new PayloadExchangeMatcher() {
@Override
public Mono<MatchResult> matches(PayloadExchange exchange) {
return PayloadExchangeType.SETUP.equals(exchange.getType()) ? MatchResult.match()
: MatchResult.notMatch();
}
};
}
public static PayloadExchangeMatcher anyRequest() {
return (exchange) -> exchange.getType().isRequest() ? PayloadExchangeMatcher.MatchResult.match()
: PayloadExchangeMatcher.MatchResult.notMatch();
return new PayloadExchangeMatcher() {
@Override
public Mono<MatchResult> matches(PayloadExchange exchange) {
return exchange.getType().isRequest() ? MatchResult.match() : MatchResult.notMatch();
}
};
}
public static PayloadExchangeMatcher anyExchange() {
return (exchange) -> PayloadExchangeMatcher.MatchResult.match();
return new PayloadExchangeMatcher() {
@Override
public Mono<MatchResult> matches(PayloadExchange exchange) {
return MatchResult.match();
}
};
}
}

View File

@@ -52,9 +52,9 @@ public class RoutePayloadExchangeMatcher implements PayloadExchangeMatcher {
Map<String, Object> metadata = this.metadataExtractor.extract(exchange.getPayload(),
exchange.getMetadataMimeType());
return Optional.ofNullable((String) metadata.get(MetadataExtractor.ROUTE_KEY))
.map(this.routeMatcher::parseRoute)
.map((routeValue) -> this.routeMatcher.parseRoute(routeValue))
.map((route) -> this.routeMatcher.matchAndExtract(this.pattern, route))
.map(MatchResult::match)
.map((v) -> MatchResult.match(v))
.orElse(MatchResult.notMatch());
}

View File

@@ -89,8 +89,8 @@ public class AuthenticationPayloadInterceptorTests {
interceptor.intercept(exchange, authenticationPayloadChain).block();
Authentication authentication = authenticationPayloadChain.getAuthentication();
verify(this.authenticationManager).authenticate(this.authenticationArg.capture());
assertThat(this.authenticationArg.getValue()).usingRecursiveComparison()
.isEqualTo(UsernamePasswordAuthenticationToken.unauthenticated("user", "password"));
assertThat(this.authenticationArg.getValue())
.isEqualToComparingFieldByField(UsernamePasswordAuthenticationToken.unauthenticated("user", "password"));
assertThat(authentication).isEqualTo(expectedAuthentication);
}

View File

@@ -46,7 +46,7 @@ public class BasicAuthenticationDecoderTests {
UsernamePasswordMetadata actualCredentials = decoder
.decodeToMono(Mono.just(dataBuffer), elementType, mimeType, hints)
.block();
assertThat(actualCredentials).usingRecursiveComparison().isEqualTo(expectedCredentials);
assertThat(actualCredentials).isEqualToComparingFieldByField(expectedCredentials);
}
}