Fix SNAPSHOT builds
- Stop using deprecated RSocket APIs - Update SNAPSHOT build to use Boot SNAPSHOT
This commit is contained in:
parent
12a8795c3d
commit
94cf4d1de7
|
@ -89,7 +89,7 @@ try {
|
||||||
"GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USERNAME}",
|
"GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USERNAME}",
|
||||||
"GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PASSWORD}",
|
"GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PASSWORD}",
|
||||||
"GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY}"]) {
|
"GRADLE_ENTERPRISE_ACCESS_KEY=${GRADLE_ENTERPRISE_ACCESS_KEY}"]) {
|
||||||
sh "./gradlew test -PforceMavenRepositories=snapshot -PspringVersion='5.+' -PreactorVersion=20+ -PspringDataVersion=Lovelace-BUILD-SNAPSHOT -PrsocketVersion=1.1.0-SNAPSHOT -PlocksDisabled --stacktrace"
|
sh "./gradlew test -PforceMavenRepositories=snapshot -PspringVersion='5.+' -PreactorVersion='20+' -PspringDataVersion='Lovelace-BUILD-SNAPSHOT' -PrsocketVersion=1.1.0-SNAPSHOT -PspringBootVersion=2.4.0-SNAPSHOT -PlocksDisabled --stacktrace"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
|
|
|
@ -19,8 +19,8 @@ package org.springframework.security.rsocket.authentication;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.rsocket.metadata.WellKnownMimeType;
|
import io.rsocket.metadata.WellKnownMimeType;
|
||||||
import io.rsocket.metadata.security.AuthMetadataFlyweight;
|
import io.rsocket.metadata.AuthMetadataCodec;
|
||||||
import io.rsocket.metadata.security.WellKnownAuthType;
|
import io.rsocket.metadata.WellKnownAuthType;
|
||||||
import org.springframework.core.codec.ByteArrayDecoder;
|
import org.springframework.core.codec.ByteArrayDecoder;
|
||||||
import org.springframework.messaging.rsocket.DefaultMetadataExtractor;
|
import org.springframework.messaging.rsocket.DefaultMetadataExtractor;
|
||||||
import org.springframework.messaging.rsocket.MetadataExtractor;
|
import org.springframework.messaging.rsocket.MetadataExtractor;
|
||||||
|
@ -68,10 +68,10 @@ public class AuthenticationPayloadExchangeConverter implements PayloadExchangeAu
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ByteBuf rawAuthentication = ByteBufAllocator.DEFAULT.buffer().writeBytes(authenticationMetadata);
|
ByteBuf rawAuthentication = ByteBufAllocator.DEFAULT.buffer().writeBytes(authenticationMetadata);
|
||||||
if (!AuthMetadataFlyweight.isWellKnownAuthType(rawAuthentication)) {
|
if (!AuthMetadataCodec.isWellKnownAuthType(rawAuthentication)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
WellKnownAuthType wellKnownAuthType = AuthMetadataFlyweight.decodeWellKnownAuthType(rawAuthentication);
|
WellKnownAuthType wellKnownAuthType = AuthMetadataCodec.readWellKnownAuthType(rawAuthentication);
|
||||||
if (WellKnownAuthType.SIMPLE.equals(wellKnownAuthType)) {
|
if (WellKnownAuthType.SIMPLE.equals(wellKnownAuthType)) {
|
||||||
return simple(rawAuthentication);
|
return simple(rawAuthentication);
|
||||||
} else if (WellKnownAuthType.BEARER.equals(wellKnownAuthType)) {
|
} else if (WellKnownAuthType.BEARER.equals(wellKnownAuthType)) {
|
||||||
|
@ -81,15 +81,15 @@ public class AuthenticationPayloadExchangeConverter implements PayloadExchangeAu
|
||||||
}
|
}
|
||||||
|
|
||||||
private Authentication simple(ByteBuf rawAuthentication) {
|
private Authentication simple(ByteBuf rawAuthentication) {
|
||||||
ByteBuf rawUsername = AuthMetadataFlyweight.decodeUsername(rawAuthentication);
|
ByteBuf rawUsername = AuthMetadataCodec.readUsername(rawAuthentication);
|
||||||
String username = rawUsername.toString(StandardCharsets.UTF_8);
|
String username = rawUsername.toString(StandardCharsets.UTF_8);
|
||||||
ByteBuf rawPassword = AuthMetadataFlyweight.decodePassword(rawAuthentication);
|
ByteBuf rawPassword = AuthMetadataCodec.readPassword(rawAuthentication);
|
||||||
String password = rawPassword.toString(StandardCharsets.UTF_8);
|
String password = rawPassword.toString(StandardCharsets.UTF_8);
|
||||||
return new UsernamePasswordAuthenticationToken(username, password);
|
return new UsernamePasswordAuthenticationToken(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Authentication bearer(ByteBuf rawAuthentication) {
|
private Authentication bearer(ByteBuf rawAuthentication) {
|
||||||
char[] rawToken = AuthMetadataFlyweight.decodeBearerTokenAsCharArray(rawAuthentication);
|
char[] rawToken = AuthMetadataCodec.readBearerTokenAsCharArray(rawAuthentication);
|
||||||
String token = new String(rawToken);
|
String token = new String(rawToken);
|
||||||
return new BearerTokenAuthenticationToken(token);
|
return new BearerTokenAuthenticationToken(token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.security.rsocket.core;
|
||||||
|
|
||||||
import io.rsocket.Payload;
|
import io.rsocket.Payload;
|
||||||
import io.rsocket.RSocket;
|
import io.rsocket.RSocket;
|
||||||
import io.rsocket.ResponderRSocket;
|
|
||||||
import io.rsocket.util.RSocketProxy;
|
import io.rsocket.util.RSocketProxy;
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import org.springframework.security.rsocket.api.PayloadExchangeType;
|
import org.springframework.security.rsocket.api.PayloadExchangeType;
|
||||||
|
@ -31,11 +30,11 @@ import reactor.util.context.Context;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines the {@link PayloadInterceptor} with a {@link ResponderRSocket}
|
* Combines the {@link PayloadInterceptor} with an {@link RSocketProxy}
|
||||||
* @author Rob Winch
|
* @author Rob Winch
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
class PayloadInterceptorRSocket extends RSocketProxy implements ResponderRSocket {
|
class PayloadInterceptorRSocket extends RSocketProxy {
|
||||||
private final List<PayloadInterceptor> interceptors;
|
private final List<PayloadInterceptor> interceptors;
|
||||||
|
|
||||||
private final MimeType metadataMimeType;
|
private final MimeType metadataMimeType;
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.springframework.security.rsocket.metadata;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.rsocket.metadata.security.AuthMetadataFlyweight;
|
import io.rsocket.metadata.AuthMetadataCodec;
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import org.springframework.core.ResolvableType;
|
import org.springframework.core.ResolvableType;
|
||||||
import org.springframework.core.codec.AbstractEncoder;
|
import org.springframework.core.codec.AbstractEncoder;
|
||||||
|
@ -64,7 +64,7 @@ public class BearerTokenAuthenticationEncoder extends
|
||||||
String token = credentials.getToken();
|
String token = credentials.getToken();
|
||||||
NettyDataBufferFactory factory = nettyFactory(bufferFactory);
|
NettyDataBufferFactory factory = nettyFactory(bufferFactory);
|
||||||
ByteBufAllocator allocator = factory.getByteBufAllocator();
|
ByteBufAllocator allocator = factory.getByteBufAllocator();
|
||||||
ByteBuf simpleAuthentication = AuthMetadataFlyweight
|
ByteBuf simpleAuthentication = AuthMetadataCodec
|
||||||
.encodeBearerMetadata(allocator, token.toCharArray());
|
.encodeBearerMetadata(allocator, token.toCharArray());
|
||||||
return factory.wrap(simpleAuthentication);
|
return factory.wrap(simpleAuthentication);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.springframework.security.rsocket.metadata;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.rsocket.metadata.security.AuthMetadataFlyweight;
|
import io.rsocket.metadata.AuthMetadataCodec;
|
||||||
import org.reactivestreams.Publisher;
|
import org.reactivestreams.Publisher;
|
||||||
import org.springframework.core.ResolvableType;
|
import org.springframework.core.ResolvableType;
|
||||||
import org.springframework.core.codec.AbstractEncoder;
|
import org.springframework.core.codec.AbstractEncoder;
|
||||||
|
@ -67,7 +67,7 @@ public class SimpleAuthenticationEncoder extends
|
||||||
String password = credentials.getPassword();
|
String password = credentials.getPassword();
|
||||||
NettyDataBufferFactory factory = nettyFactory(bufferFactory);
|
NettyDataBufferFactory factory = nettyFactory(bufferFactory);
|
||||||
ByteBufAllocator allocator = factory.getByteBufAllocator();
|
ByteBufAllocator allocator = factory.getByteBufAllocator();
|
||||||
ByteBuf simpleAuthentication = AuthMetadataFlyweight
|
ByteBuf simpleAuthentication = AuthMetadataCodec
|
||||||
.encodeSimpleMetadata(allocator, username.toCharArray(), password.toCharArray());
|
.encodeSimpleMetadata(allocator, username.toCharArray(), password.toCharArray());
|
||||||
return factory.wrap(simpleAuthentication);
|
return factory.wrap(simpleAuthentication);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.springframework.security.rsocket.authentication;
|
||||||
import io.netty.buffer.ByteBufAllocator;
|
import io.netty.buffer.ByteBufAllocator;
|
||||||
import io.netty.buffer.CompositeByteBuf;
|
import io.netty.buffer.CompositeByteBuf;
|
||||||
import io.rsocket.Payload;
|
import io.rsocket.Payload;
|
||||||
import io.rsocket.metadata.CompositeMetadataFlyweight;
|
import io.rsocket.metadata.CompositeMetadataCodec;
|
||||||
import io.rsocket.metadata.WellKnownMimeType;
|
import io.rsocket.metadata.WellKnownMimeType;
|
||||||
import io.rsocket.util.DefaultPayload;
|
import io.rsocket.util.DefaultPayload;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -132,7 +132,7 @@ public class AuthenticationPayloadInterceptorTests {
|
||||||
|
|
||||||
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
|
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
|
||||||
CompositeByteBuf metadata = allocator.compositeBuffer();
|
CompositeByteBuf metadata = allocator.compositeBuffer();
|
||||||
CompositeMetadataFlyweight.encodeAndAddMetadata(
|
CompositeMetadataCodec.encodeAndAddMetadata(
|
||||||
metadata, allocator, mimeType.toString(), NettyDataBufferFactory.toByteBuf(dataBuffer));
|
metadata, allocator, mimeType.toString(), NettyDataBufferFactory.toByteBuf(dataBuffer));
|
||||||
|
|
||||||
return DefaultPayload.create(allocator.buffer(),
|
return DefaultPayload.create(allocator.buffer(),
|
||||||
|
|
Loading…
Reference in New Issue