All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zhuang.mica.mqtt.server.handler.MyMqttServerAuthHandler Maven / Gradle / Ivy

The newest version!
package com.zhuang.mica.mqtt.server.handler;

import com.zhuang.mica.mqtt.service.DeviceService;
import net.dreamlu.iot.mqtt.core.server.auth.IMqttServerAuthHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import org.tio.core.ChannelContext;

//@Component
@ConditionalOnProperty(name = "mqtt.server.auth.enable", havingValue = "true")
public class MyMqttServerAuthHandler implements IMqttServerAuthHandler {

    @Autowired
    private DeviceService deviceService;

    @Override
    public boolean authenticate(ChannelContext context, String uniqueId, String clientId, String userName, String password) {
        return deviceService.login(clientId, userName, password);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy