azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[Event Hubs] Emulator connection string support

Open jsquire opened this issue 1 year ago • 2 comments

Summary

The Azure Messaging team is working on a service emulator intended to provide a local development experience. To reduce friction for developers, the emulator will be using connections without TLS so that certificates do not need to be managed. To support this flow, the emulator will emit a connection string that contains an identifying slug to indicate to clients that they should not use TLS and should restrict communication to the local environment.

Emulator connection string slug:

;UseDevelopmentEmulator=true

Full example:

Endpoint=localhost:6765;SharedAccessKeyName=<< REDACTED >>;SharedAccessKey=<< REDACTED >>;UseDevelopmentEmulator=true

Scope of work

  • Update connection string parsing to recognize the emulator slug.
  • When the emulator slug is present in a connection string, validate that the endpoint resolves to the local host.
  • When the emulator slug is present in a connection string, do not use TLS for service operations.
  • Do not allow non-TLS communication for non-local hosts.

Out of scope

  • Support for validating that custom host names (via local DNS or hosts file) resolve to localhost

Success Criteria

  • Connection string parsing recognizes the emulator slug.
  • Connection string parsing preserves a custom port for the endpoint.
  • When the emulator slug is present, connection string parsing validates that the endpoint resolves to local host.
  • Local host validation allows for localhost, IPv4, and IPv6 forms.
  • Clients support non-TLS communication for service operations.
  • Clients require TLS communication for non-local hosts.
  • New tests necessary to validate the feature have been created and pass reliably.
  • The existing test suite continues to produce deterministic results and pass reliably.

References and related

jsquire avatar Feb 09 '24 22:02 jsquire

//cc: @conniey, @anuchandy, @lmolkova

jsquire avatar Feb 09 '24 22:02 jsquire

Hi, this will unblock adding Service Connection support for EventHub using Testcontainers. See #40329. Looking forward to it

eddumelendez avatar Jun 26 '24 02:06 eddumelendez

resolved by https://github.com/Azure/azure-sdk-for-java/pull/40483

anuchandy avatar Nov 13 '24 21:11 anuchandy