Skip to content

metadata not properly encoded when sending requestStream with BearerAuthMetadata(jwt) #234

@kumaraish

Description

@kumaraish

metadata in REQUEST_STREAM is not properly encoded when compositeMetadata is used and it includes both RoutingMetadata and BearerAuthMetadata

Expected Behavior

The following requestStream should be accepted by the Spring Boot Rsocket Server

scope.launch {
  rsocket
  .requestStream(
    buildPayload {
      data(ByteReadPacket(clientId.toByteArray())) // clientid is 1523ad4b-5035-4791-a788-3268a98e296a
      compositeMetadata {
        add(RoutingMetadata("api.v1.authenticate"))
        add(BearerAuthMetadata(jwt))  // jwt is a 1192 characters long token
      }
    }
  )
  .catch { console.log("Exception ${it.message}") }   // 'metadata is malformed'
  .onEach { handler(it) }
  .launchIn(this)
}

The exact same code works when sending a requestResponse() frame

In the Setup Frame, payload MimeType is MessageRSocketCompositeMetadata. Setup frame doesn't sends any metadata

PayloadMimeType(
    data = WellKnownMimeType.ApplicationJson,
    metadata = WellKnownMimeType.MessageRSocketCompositeMetadata
  )

Actual Behavior

The Server returns ERROR frame with 'metadata is malformed'

  • SETUP FRAME
    SETUP FRAME

  • REQUEST_RESPONSE FRAME
    REQUEST_RESPONSE FRAME

  • REQUEST_STREAM FRAME (Reported 'metadata is malformed' by the server)
    REQUEST_STREAM FRAME

Steps to Reproduce

Possible Solution

Your Environment

  • RSocket version(s) used: io.rsocket.kotlin:rsocket-core:0.15.4 and io.rsocket.kotlin:rsocket-ktor-client:0.15.4
  • Platform (eg. JVM version (javar -version) or Node version (node --version)): JAVA 19
  • OS and version (eg uname -a): Ubuntu 20.04.6 LTS

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions