Interface EnhancedAuthOutput

    • Method Detail

      • continueAuthentication

        void continueAuthentication()
        Continues the authentication of the client by sending an AUTH packet to the client and expecting another AUTH packet in response from the client.

        Sends an AUTH packet with reason code CONTINUE_AUTHENTICATION and no authentication data to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Throws:
        UnsupportedOperationException - If the client does not support enhanced authentication (it did not specify a authentication method in the CONNECT packet).
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • continueAuthentication

        void continueAuthentication​(@NotNull ByteBuffer authenticationData)
        Continues the authentication of the client by sending an AUTH packet to the client and expecting another AUTH packet in response from the client.

        Sends an AUTH packet with reason code CONTINUE_AUTHENTICATION and the specified authentication data to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        authenticationData - The authentication data of the AUTH packet.
        Throws:
        UnsupportedOperationException - If the client does not support enhanced authentication (it did not specify a authentication method in the CONNECT packet).
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • continueAuthentication

        void continueAuthentication​(@NotNull
                                    @com.hivemq.extension.sdk.api.annotations.NotNull byte[] authenticationData)
        Continues the authentication of the client by sending an AUTH packet to the client and expecting another AUTH packet in response from the client.

        Sends AUTH packet with reason code CONTINUE_AUTHENTICATION and the specified authentication data to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        authenticationData - The authentication data of the AUTH packet.
        Throws:
        UnsupportedOperationException - If the client does not support enhanced authentication (it did not specify a authentication method in the CONNECT packet).
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • authenticateSuccessfully

        void authenticateSuccessfully()
        Successfully authenticates the client.

        During authentication a CONNACK packet with reason code SUCCESS and no authentication data is sent to the client.

        During re-authentication an AUTH packet with reason code SUCCESS and no authentication data is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • authenticateSuccessfully

        void authenticateSuccessfully​(@NotNull ByteBuffer authenticationData)
        Successfully authenticates the client.

        During authentication a CONNACK packet with reason code SUCCESS and the specified authentication data is sent to the client.

        During re-authentication an AUTH packet with reason code SUCCESS and the specified authentication data is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        authenticationData - The authentication data of the CONNACK or AUTH packet.
        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • authenticateSuccessfully

        void authenticateSuccessfully​(@NotNull
                                      @com.hivemq.extension.sdk.api.annotations.NotNull byte[] authenticationData)
        Successfully authenticates the client.

        During authentication a CONNACK packet with reason code SUCCESS and the specified authentication data is sent to the client.

        During re-authentication an AUTH packet with reason code SUCCESS and the specified authentication data is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        authenticationData - The authentication data of the CONNACK or AUTH packet.
        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • failAuthentication

        void failAuthentication()
        Fails the authentication of the client.

        During authentication a CONNACK packet with reason code NOT_AUTHORIZED and reason string Authentication failed is sent to the client.

        During re-authentication a DISCONNECT packet with reason code NOT_AUTHORIZED and reason string Re-authentication failed is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • failAuthentication

        void failAuthentication​(@NotNull DisconnectedReasonCode reasonCode)
        Fails the authentication of the client.

        During authentication a CONNACK packet with the specified reason code and reason string Authentication failed is sent to the client.

        During re-authentication a DISCONNECT packet with the specified reason code and reason string Re-authentication failed is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        reasonCode - The reason code of the CONNACK or DISCONNECT packet.
        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        IllegalArgumentException - when DisconnectedReasonCode is set to a DISCONNECT only reason code during authentication.
        IllegalArgumentException - when DisconnectedReasonCode is set to a CONNACK only reason code during re-authentication.
        Since:
        4.3.0, CE 2020.1
      • failAuthentication

        void failAuthentication​(@Nullable String reasonString)
        Fails the authentication of the client.

        During authentication a CONNACK packet with reason code NOT_AUTHORIZED and the specified reason string is sent to the client.

        During re-authentication a DISCONNECT packet with reason code NOT_AUTHORIZED and the specified reason string is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        reasonString - The reason string of the CONNACK or DISCONNECT packet.
        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • failAuthentication

        void failAuthentication​(@NotNull DisconnectedReasonCode reasonCode,
                                @Nullable String reasonString)
        Fails the authentication of the client.

        During authentication a CONNACK packet with the specified reason code and reason string is sent to the client.

        During re-authentication a DISCONNECT packet with the specified reason code and reason string is sent to the client.

        This is a final decision, authenticators of the next extensions (with lower priority) are not called.

        Parameters:
        reasonCode - The reason code of the CONNACK or DISCONNECT packet.
        reasonString - The reason string of the CONNACK or DISCONNECT packet.
        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        IllegalArgumentException - when DisconnectedReasonCode is set to a DISCONNECT only reason code during authentication.
        IllegalArgumentException - when DisconnectedReasonCode is set to a CONNACK only reason code during re-authentication.
        Since:
        4.3.0, CE 2020.1
      • nextExtensionOrDefault

        void nextExtensionOrDefault()
        The outcome of the authentication is determined by an authenticator of the next extension (with lower priority).

        If no extension with an authenticator is left the default behaviour is used. The default behaviour is the same as failAuthentication().

        Throws:
        UnsupportedOperationException - When authenticateSuccessfully, failAuthentication, continueAuthentication or nextExtensionOrDefault has already been called.
        Since:
        4.3.0, CE 2020.1
      • setTimeout

        void setTimeout​(int timeout)
        Sets the time interval (in seconds) in which a response from the client is expected before the authentication times out.

        This only applies if continueAuthentication is called.

        If the authentication times out a CONNACK packet with reason code NOT_AUTHORIZED and reason string Authentication failed, timeout before the client provided required authentication data is sent to the client.

        If the re-authentication times out a DISCONNECT packet with reason code NOT_AUTHORIZED and reason string Re-authentication failed, timeout before the client provided required authentication data is sent to the client.

        Parameters:
        timeout - The timeout in seconds.
        Since:
        4.3.0, CE 2020.1