diff --git a/Jenkinsfile b/Jenkinsfile index 96dedf6129..a24598bb2c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -89,7 +89,7 @@ try { "GRADLE_ENTERPRISE_CACHE_USERNAME=${GRADLE_ENTERPRISE_CACHE_USERNAME}", "GRADLE_ENTERPRISE_CACHE_PASSWORD=${GRADLE_ENTERPRISE_CACHE_PASSWORD}", "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) { diff --git a/rsocket/src/main/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadExchangeConverter.java b/rsocket/src/main/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadExchangeConverter.java index 8c38b1e315..9b7e1ddae0 100644 --- a/rsocket/src/main/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadExchangeConverter.java +++ b/rsocket/src/main/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadExchangeConverter.java @@ -19,8 +19,8 @@ package org.springframework.security.rsocket.authentication; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.rsocket.metadata.WellKnownMimeType; -import io.rsocket.metadata.security.AuthMetadataFlyweight; -import io.rsocket.metadata.security.WellKnownAuthType; +import io.rsocket.metadata.AuthMetadataCodec; +import io.rsocket.metadata.WellKnownAuthType; import org.springframework.core.codec.ByteArrayDecoder; import org.springframework.messaging.rsocket.DefaultMetadataExtractor; import org.springframework.messaging.rsocket.MetadataExtractor; @@ -68,10 +68,10 @@ public class AuthenticationPayloadExchangeConverter implements PayloadExchangeAu return null; } ByteBuf rawAuthentication = ByteBufAllocator.DEFAULT.buffer().writeBytes(authenticationMetadata); - if (!AuthMetadataFlyweight.isWellKnownAuthType(rawAuthentication)) { + if (!AuthMetadataCodec.isWellKnownAuthType(rawAuthentication)) { return null; } - WellKnownAuthType wellKnownAuthType = AuthMetadataFlyweight.decodeWellKnownAuthType(rawAuthentication); + WellKnownAuthType wellKnownAuthType = AuthMetadataCodec.readWellKnownAuthType(rawAuthentication); if (WellKnownAuthType.SIMPLE.equals(wellKnownAuthType)) { return simple(rawAuthentication); } else if (WellKnownAuthType.BEARER.equals(wellKnownAuthType)) { @@ -81,15 +81,15 @@ public class AuthenticationPayloadExchangeConverter implements PayloadExchangeAu } private Authentication simple(ByteBuf rawAuthentication) { - ByteBuf rawUsername = AuthMetadataFlyweight.decodeUsername(rawAuthentication); + ByteBuf rawUsername = AuthMetadataCodec.readUsername(rawAuthentication); String username = rawUsername.toString(StandardCharsets.UTF_8); - ByteBuf rawPassword = AuthMetadataFlyweight.decodePassword(rawAuthentication); + ByteBuf rawPassword = AuthMetadataCodec.readPassword(rawAuthentication); String password = rawPassword.toString(StandardCharsets.UTF_8); return new UsernamePasswordAuthenticationToken(username, password); } private Authentication bearer(ByteBuf rawAuthentication) { - char[] rawToken = AuthMetadataFlyweight.decodeBearerTokenAsCharArray(rawAuthentication); + char[] rawToken = AuthMetadataCodec.readBearerTokenAsCharArray(rawAuthentication); String token = new String(rawToken); return new BearerTokenAuthenticationToken(token); } diff --git a/rsocket/src/main/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocket.java b/rsocket/src/main/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocket.java index 418fb67121..b1c7271ed9 100644 --- a/rsocket/src/main/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocket.java +++ b/rsocket/src/main/java/org/springframework/security/rsocket/core/PayloadInterceptorRSocket.java @@ -18,7 +18,6 @@ package org.springframework.security.rsocket.core; import io.rsocket.Payload; import io.rsocket.RSocket; -import io.rsocket.ResponderRSocket; import io.rsocket.util.RSocketProxy; import org.reactivestreams.Publisher; import org.springframework.security.rsocket.api.PayloadExchangeType; @@ -31,11 +30,11 @@ import reactor.util.context.Context; import java.util.List; /** - * Combines the {@link PayloadInterceptor} with a {@link ResponderRSocket} + * Combines the {@link PayloadInterceptor} with an {@link RSocketProxy} * @author Rob Winch * @since 5.2 */ -class PayloadInterceptorRSocket extends RSocketProxy implements ResponderRSocket { +class PayloadInterceptorRSocket extends RSocketProxy { private final List interceptors; private final MimeType metadataMimeType; diff --git a/rsocket/src/main/java/org/springframework/security/rsocket/metadata/BearerTokenAuthenticationEncoder.java b/rsocket/src/main/java/org/springframework/security/rsocket/metadata/BearerTokenAuthenticationEncoder.java index 3a513c4dd5..ead8f960fa 100644 --- a/rsocket/src/main/java/org/springframework/security/rsocket/metadata/BearerTokenAuthenticationEncoder.java +++ b/rsocket/src/main/java/org/springframework/security/rsocket/metadata/BearerTokenAuthenticationEncoder.java @@ -18,7 +18,7 @@ package org.springframework.security.rsocket.metadata; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import io.rsocket.metadata.security.AuthMetadataFlyweight; +import io.rsocket.metadata.AuthMetadataCodec; import org.reactivestreams.Publisher; import org.springframework.core.ResolvableType; import org.springframework.core.codec.AbstractEncoder; @@ -64,7 +64,7 @@ public class BearerTokenAuthenticationEncoder extends String token = credentials.getToken(); NettyDataBufferFactory factory = nettyFactory(bufferFactory); ByteBufAllocator allocator = factory.getByteBufAllocator(); - ByteBuf simpleAuthentication = AuthMetadataFlyweight + ByteBuf simpleAuthentication = AuthMetadataCodec .encodeBearerMetadata(allocator, token.toCharArray()); return factory.wrap(simpleAuthentication); } diff --git a/rsocket/src/main/java/org/springframework/security/rsocket/metadata/SimpleAuthenticationEncoder.java b/rsocket/src/main/java/org/springframework/security/rsocket/metadata/SimpleAuthenticationEncoder.java index 64e4dc2e2b..eb4b0c737e 100644 --- a/rsocket/src/main/java/org/springframework/security/rsocket/metadata/SimpleAuthenticationEncoder.java +++ b/rsocket/src/main/java/org/springframework/security/rsocket/metadata/SimpleAuthenticationEncoder.java @@ -18,7 +18,7 @@ package org.springframework.security.rsocket.metadata; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import io.rsocket.metadata.security.AuthMetadataFlyweight; +import io.rsocket.metadata.AuthMetadataCodec; import org.reactivestreams.Publisher; import org.springframework.core.ResolvableType; import org.springframework.core.codec.AbstractEncoder; @@ -67,7 +67,7 @@ public class SimpleAuthenticationEncoder extends String password = credentials.getPassword(); NettyDataBufferFactory factory = nettyFactory(bufferFactory); ByteBufAllocator allocator = factory.getByteBufAllocator(); - ByteBuf simpleAuthentication = AuthMetadataFlyweight + ByteBuf simpleAuthentication = AuthMetadataCodec .encodeSimpleMetadata(allocator, username.toCharArray(), password.toCharArray()); return factory.wrap(simpleAuthentication); } diff --git a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java index 7c3926e231..7da8b63bcf 100644 --- a/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java +++ b/rsocket/src/test/java/org/springframework/security/rsocket/authentication/AuthenticationPayloadInterceptorTests.java @@ -19,7 +19,7 @@ package org.springframework.security.rsocket.authentication; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.CompositeByteBuf; import io.rsocket.Payload; -import io.rsocket.metadata.CompositeMetadataFlyweight; +import io.rsocket.metadata.CompositeMetadataCodec; import io.rsocket.metadata.WellKnownMimeType; import io.rsocket.util.DefaultPayload; import org.junit.Test; @@ -132,7 +132,7 @@ public class AuthenticationPayloadInterceptorTests { ByteBufAllocator allocator = ByteBufAllocator.DEFAULT; CompositeByteBuf metadata = allocator.compositeBuffer(); - CompositeMetadataFlyweight.encodeAndAddMetadata( + CompositeMetadataCodec.encodeAndAddMetadata( metadata, allocator, mimeType.toString(), NettyDataBufferFactory.toByteBuf(dataBuffer)); return DefaultPayload.create(allocator.buffer(),