
com.hivemq.extension.sdk.api.auth.PublishAuthorizer Maven / Gradle / Ivy
Show all versions of hivemq-extension-sdk Show documentation
/*
* Copyright 2018-present HiveMQ GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hivemq.extension.sdk.api.auth;
import com.hivemq.extension.sdk.api.annotations.NotNull;
import com.hivemq.extension.sdk.api.auth.parameter.PublishAuthorizerInput;
import com.hivemq.extension.sdk.api.auth.parameter.PublishAuthorizerOutput;
/**
* Interface for the PUBLISH authorization.
*
* An Authorizer is always called by the same Thread for all messages from the same client.
*
* If the same instance is shared between multiple clients it can be called in different Threads and must therefore be
* thread-safe.
*
* @author Christoph Schäbel
* @since 4.0.0, CE 2019.1
*/
public interface PublishAuthorizer extends Authorizer {
/**
* This method is called for every PUBLISH packet and Will Publish, that the {@link PublishAuthorizer} is delegated
* to authorize.
*
* When the extension is enabled after HiveMQ is already running, this method will also be called for future
* PUBLISHes of clients that are already connected.
*
* @param publishAuthorizerInput The {@link PublishAuthorizerInput}.
* @param publishAuthorizerOutput The {@link PublishAuthorizerOutput}.
* @since 4.0.0, CE 2019.1
*/
void authorizePublish(
@NotNull PublishAuthorizerInput publishAuthorizerInput,
@NotNull PublishAuthorizerOutput publishAuthorizerOutput);
}