Interface EnhancedAuthenticator
public interface EnhancedAuthenticator
Interface for the enhanced authentication of MQTT clients.
Enhanced authentication can use AUTH packets (introduced in MQTT 5) to implement:
- challenge/response style authentication and
- re-authentication
Enhanced authentication has two life cycles:
- When a client connects
- When a client triggers re-authentication
An EnhancedAuthenticator can be provided by an EnhancedAuthenticatorProvider.
The provider is only called once per client connection, enabling the EnhancedAuthenticator to store state between the
initial authentication and later re-authentication(s).
If an implementation stores state, an object of the implementation can not be shared by different clients. If no state is stored, the implementation has to be thread safe if it is shared by different clients.
- Since:
- 4.3.0, CE 2020.1
-
Method Summary
Modifier and Type Method Description voidonAuth(@NotNull EnhancedAuthInput enhancedAuthInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent an AUTH packet.voidonConnect(@NotNull EnhancedAuthConnectInput enhancedAuthConnectInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent the CONNECT packet.default voidonReAuth(@NotNull EnhancedAuthInput enhancedAuthInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent an AUTH packet with reason codeREAUTHENTICATE.
-
Method Details
-
onConnect
void onConnect(@NotNull EnhancedAuthConnectInput enhancedAuthConnectInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent the CONNECT packet.- Parameters:
enhancedAuthConnectInput- TheEnhancedAuthConnectInput.enhancedAuthOutput- TheEnhancedAuthOutput.- Since:
- 4.3.0, CE 2020.1
-
onReAuth
default void onReAuth(@NotNull EnhancedAuthInput enhancedAuthInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent an AUTH packet with reason codeREAUTHENTICATE.- Parameters:
enhancedAuthInput- TheEnhancedAuthInput.enhancedAuthOutput- TheEnhancedAuthOutput.- Since:
- 4.3.0, CE 2020.1
-
onAuth
void onAuth(@NotNull EnhancedAuthInput enhancedAuthInput, @NotNull EnhancedAuthOutput enhancedAuthOutput)This method is called when the MQTT client (that has to be authenticated) sent an AUTH packet.- Parameters:
enhancedAuthInput- TheEnhancedAuthInput.enhancedAuthOutput- TheEnhancedAuthOutput.- Since:
- 4.3.0, CE 2020.1
-