Improvements
This commit is contained in:
parent
3d8b2cbbbf
commit
81585f04c8
@ -237,7 +237,7 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTenantUpdate(TenantId tenantId) {
|
public void onTenantUpdate(TenantId tenantId) {
|
||||||
log.info("[{}] On Tenant Update", tenantId);
|
log.info("[{}] On Tenant Update.", tenantId);
|
||||||
TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
|
TenantProfile tenantProfile = tenantProfileCache.get(tenantId);
|
||||||
updateLock.lock();
|
updateLock.lock();
|
||||||
try {
|
try {
|
||||||
@ -251,7 +251,6 @@ public class DefaultTbApiUsageStateService implements TbApiUsageStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTenantState(TenantApiUsageState state, TenantProfile profile) {
|
private void updateTenantState(TenantApiUsageState state, TenantProfile profile) {
|
||||||
log.info("[{}] On Tenant Update.", state.getTenantId());
|
|
||||||
TenantProfileData oldProfileData = state.getTenantProfileData();
|
TenantProfileData oldProfileData = state.getTenantProfileData();
|
||||||
state.setTenantProfileId(profile.getId());
|
state.setTenantProfileId(profile.getId());
|
||||||
state.setTenantProfileData(profile.getProfileData());
|
state.setTenantProfileData(profile.getProfileData());
|
||||||
|
|||||||
@ -164,21 +164,24 @@ public class DefaultTransportApiService implements TransportApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ListenableFuture<TransportApiResponseMsg> validateCredentials(TransportProtos.ValidateBasicMqttCredRequestMsg mqtt) {
|
private ListenableFuture<TransportApiResponseMsg> validateCredentials(TransportProtos.ValidateBasicMqttCredRequestMsg mqtt) {
|
||||||
DeviceCredentials credentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(mqtt.getUserName());
|
DeviceCredentials credentials = null;
|
||||||
if (credentials != null) {
|
if (mqtt.getUserName() != null) {
|
||||||
if (credentials.getCredentialsType() == DeviceCredentialsType.ACCESS_TOKEN) {
|
credentials = deviceCredentialsService.findDeviceCredentialsByCredentialsId(mqtt.getUserName());
|
||||||
return getDeviceInfo(credentials.getDeviceId(), credentials);
|
if (credentials != null) {
|
||||||
} else if (credentials.getCredentialsType() == DeviceCredentialsType.MQTT_BASIC) {
|
if (credentials.getCredentialsType() == DeviceCredentialsType.ACCESS_TOKEN) {
|
||||||
if (!checkMqttCredentials(mqtt, credentials)) {
|
return getDeviceInfo(credentials.getDeviceId(), credentials);
|
||||||
credentials = null;
|
} else if (credentials.getCredentialsType() == DeviceCredentialsType.MQTT_BASIC) {
|
||||||
|
if (!checkMqttCredentials(mqtt, credentials)) {
|
||||||
|
credentials = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (credentials == null) {
|
||||||
|
credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash("|", mqtt.getClientId(), mqtt.getUserName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (credentials == null) {
|
if (credentials == null) {
|
||||||
credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash("|", mqtt.getClientId(), mqtt.getUserName()));
|
credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash(mqtt.getClientId()));
|
||||||
if (credentials == null) {
|
|
||||||
credentials = checkMqttCredentials(mqtt, EncryptionUtil.getSha3Hash(mqtt.getClientId()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (credentials != null) {
|
if (credentials != null) {
|
||||||
return getDeviceInfo(credentials.getDeviceId(), credentials);
|
return getDeviceInfo(credentials.getDeviceId(), credentials);
|
||||||
|
|||||||
@ -58,7 +58,7 @@ In case of any issues you can examine service logs for errors.
|
|||||||
For example to see ThingsBoard node logs execute the following command:
|
For example to see ThingsBoard node logs execute the following command:
|
||||||
|
|
||||||
`
|
`
|
||||||
$ docker-compose logs -f tb-core1 tb-rule-engine1
|
$ docker-compose logs -f tb-core1 tb-core2 tb-rule-engine1 tb-rule-engine2 tb-mqtt-transport1 tb-mqtt-transport2
|
||||||
`
|
`
|
||||||
|
|
||||||
Or use `docker-compose ps` to see the state of all the containers.
|
Or use `docker-compose ps` to see the state of all the containers.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user