|
|
@ -104,7 +104,7 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String topics[] = topic.split("/");
|
|
|
|
String topics[] = topic.split("/");
|
|
|
|
String tenantDomainFromTopic = topics[0];
|
|
|
|
String tenantDomainFromTopic = topics[0];
|
|
|
|
if ("+".equals(tenantDomainFromTopic)) {
|
|
|
|
if (ALL_TENANT_DOMAIN.equals(tenantDomainFromTopic)) {
|
|
|
|
if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(authorizationSubject.getTenantDomain())
|
|
|
|
if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(authorizationSubject.getTenantDomain())
|
|
|
|
&& isUserAuthorized(authorizationSubject, DEFAULT_ADMIN_PERMISSION, UI_EXECUTE)) {
|
|
|
|
&& isUserAuthorized(authorizationSubject, DEFAULT_ADMIN_PERMISSION, UI_EXECUTE)) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -133,8 +133,8 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} catch (FeignException e) {
|
|
|
|
} catch (FeignException e) {
|
|
|
|
oAuthRequestInterceptor.resetApiApplicationKey();
|
|
|
|
oAuthRequestInterceptor.resetApiApplicationKey();
|
|
|
|
if (e.getMessage().contains(GATEWAY_ERROR_CODE) || e.status() == 404) {
|
|
|
|
if (e.getMessage().contains(GATEWAY_ERROR_CODE) || e.status() == 404 || e.status() == 403) {
|
|
|
|
log.error("Failed to connect to the device authorization service.");
|
|
|
|
log.error("Failed to connect to the device authorization service, Retrying....");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -181,8 +181,9 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (FeignException e) {
|
|
|
|
} catch (FeignException e) {
|
|
|
|
oAuthRequestInterceptor.resetApiApplicationKey();
|
|
|
|
oAuthRequestInterceptor.resetApiApplicationKey();
|
|
|
|
if (e.getMessage().contains(GATEWAY_ERROR_CODE)) {
|
|
|
|
//This is to avoid failure where it tries to call authorization service before the api is published
|
|
|
|
log.error("Failed to connect to the device authorization service.", e);
|
|
|
|
if (e.getMessage().contains(GATEWAY_ERROR_CODE) || e.status() == 404 || e.status() == 403) {
|
|
|
|
|
|
|
|
log.error("Failed to connect to the device authorization service, Retrying....");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|