Interface PublishAuthorizerOutput

    • Method Detail

      • authorizeSuccessfully

        void authorizeSuccessfully()
        Successfully authorizes the PUBlISH.

        This is a final decision, other extensions or default permissions are ignored.

        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • failAuthorization

        void failAuthorization()
        Fails the authorization of the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • For an MQTT 5 client the PUBLISH is completed (if qos > 0) with a PUBACK/PUBREC containing the reason code NOT_AUTHORIZED. After that the client receives a DISCONNECT packet with reason code NOT_AUTHORIZED, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • failAuthorization

        void failAuthorization​(@NotNull AckReasonCode reasonCode)
        Fails the authorization of the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • For an MQTT 5 client the PUBLISH is completed (if qos > 0) with a PUBACK/PUBREC containing the specified reason code. After that the client receives a DISCONNECT packet with reason code NOT_AUTHORIZED, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Parameters:
        reasonCode - Used as the reason code in the PUBACK/PUBREC.
        Throws:
        IllegalArgumentException - If the specified reason code is not an error code.
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • failAuthorization

        void failAuthorization​(@NotNull AckReasonCode reasonCode,
                               @NotNull String reasonString)
        Fails the authorization of the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • For an MQTT 5 client the PUBLISH is completed (if qos > 0) with a PUBACK/PUBREC containing the specified reason code and reason string. After that the client receives a DISCONNECT packet with reason code NOT_AUTHORIZED, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Parameters:
        reasonCode - Used as the reason code in the PUBACK/PUBREC.
        reasonString - Used as the reason string in the PUBACK/PUBREC.
        Throws:
        IllegalArgumentException - If the specified reason code is not an error code.
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • disconnectClient

        void disconnectClient()
        Disconnects the client that sent the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • An MQTT 5 client receives a DISCONNECT packet with reason code NOT_AUTHORIZED, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • disconnectClient

        void disconnectClient​(@NotNull DisconnectReasonCode reasonCode)
        Disconnects the client that sent the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • An MQTT 5 client receives a DISCONNECT packet with the specified reason code, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Parameters:
        reasonCode - Used as the reason code in the DISCONNECT packet.
        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • disconnectClient

        void disconnectClient​(@NotNull DisconnectReasonCode reasonCode,
                              @NotNull String reasonString)
        Disconnects the client that sent the PUBLISH. The outcome depends on the MQTT version specified by the publishing client.
        • For an MQTT 3 client the connection is closed.
        • An MQTT 5 client receives a DISCONNECT with the specified reason code and reason string, then the connection is closed.

        This is a final decision, other extensions or default permissions are ignored.

        Parameters:
        reasonCode - Used as the reason code in the DISCONNECT packet.
        reasonString - Used as the reason string in the DISCONNECT packet.
        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1
      • nextExtensionOrDefault

        void nextExtensionOrDefault()
        The outcome of the authorization is determined by the next extension with a PublishAuthorizer.

        If no extension with a PublishAuthorizer is left the default permissions (see ModifiableDefaultPermissions) are used.

        Throws:
        UnsupportedOperationException - When authorizeSuccessfully, failAuthorization, disconnectClient or nextExtensionOrDefault has already been called.
        Since:
        4.0.0, CE 2019.1