Skip to content

mqtt: design enhanced authentication (AUTH packet) and re-authentication #3401

Open

Description

@jfallows

Problem

MQTT 5.0 sections 3.1.2.11.9 and 3.1.2.11.10 (Authentication Method and Data), 3.15 (AUTH packet), 4.12 (Enhanced authentication) and 4.12.1 (Re-authentication). Today:

  • A CONNECT with an Authentication Method gets CONNACK 0x8C Bad authentication method, and Authentication Data is ignored.
  • The AUTH packet decoder is commented out in the v4 and v5 decoder maps of MqttServerFactory, so an AUTH packet gets Protocol Error 0x82. The reason codes 0x18 Continue authentication and 0x19 Re-authenticate exist as unused constants.
  • The guard contract is single-shot: GuardHandler.reauthorize takes one credentials string and returns one session id, and binding-mqtt calls it once per connection while decoding CONNECT. The asynchronous reauthorize, expiresAt and challenge entry points exist on the engine SPI but binding-mqtt never uses them, so no connection is closed or challenged when its credentials expire.

Scope of this issue: design only

No implementation until the design is agreed on this issue. Direction agreed so far: manage the multi-round exchange as chained authorization handles, building on #2149. The design should settle:

  • How a multi-round challenge/response (AUTH 0x18 both ways) maps onto chained guard handles, and what the guard SPI needs for a step that returns "continue with this challenge data".
  • Re-authentication on an established connection (client-initiated AUTH 0x19) and credential expiry (expiresAt, challenge): what happens to in-flight QoS state and to streams while re-authentication is pending, and when the connection is closed.
  • How the Authentication Method selects a guard, and what a binding with no matching guard answers (today 0x8C).
  • The application-level extension changes, if any, and the spec script structure for multi-step exchanges (.rpt pairs per round).
  • A staged delivery plan: for example CONNECT with an Authentication Method, then the AUTH exchange, then re-authentication.

Notes

Found by a clause-by-clause audit of MQTT conformance (the "Missing MQTT 5 features" section); listed in #512 together with $SYS/auth/challenge. Part of the MQTT conformance work under #512.

Activity

  1. self-assigned this
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions