Added removing full OAuth2 config on tenant deletion
This commit is contained in:
parent
32b9f58997
commit
84a06e65fa
@ -37,7 +37,7 @@ public interface OAuth2Service {
|
||||
|
||||
OAuth2ClientsParams getTenantOAuth2ClientsParams(TenantId tenantId);
|
||||
|
||||
void deleteDomainOAuth2ClientRegistrationByTenant(TenantId tenantId);
|
||||
void deleteTenantOAuth2ClientsParams(TenantId tenantId);
|
||||
|
||||
boolean isOAuth2ClientRegistrationAllowed(TenantId tenantId);
|
||||
|
||||
|
||||
@ -291,12 +291,13 @@ public class OAuth2ServiceImpl implements OAuth2Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDomainOAuth2ClientRegistrationByTenant(TenantId tenantId) {
|
||||
public void deleteTenantOAuth2ClientsParams(TenantId tenantId) {
|
||||
OAuth2ClientsParams params = getTenantOAuth2ClientsParams(tenantId);
|
||||
if (!StringUtils.isEmpty(params.getDomainName())) {
|
||||
// TODO don't we need to delete from attributes?
|
||||
String settingsKey = constructAdminSettingsDomainKey(params.getDomainName());
|
||||
adminSettingsService.deleteAdminSettingsByKey(tenantId, settingsKey);
|
||||
attributesService.removeAll(tenantId, tenantId, DataConstants.SERVER_SCOPE, Collections.singletonList(OAUTH2_CLIENT_REGISTRATIONS_PARAMS));
|
||||
clientsParams.remove(tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.thingsboard.server.common.data.Tenant;
|
||||
import org.thingsboard.server.common.data.asset.Asset;
|
||||
import org.thingsboard.server.common.data.id.EntityId;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
import org.thingsboard.server.common.data.page.PageData;
|
||||
@ -41,8 +40,6 @@ import org.thingsboard.server.dao.service.Validator;
|
||||
import org.thingsboard.server.dao.user.UserService;
|
||||
import org.thingsboard.server.dao.widget.WidgetsBundleService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.thingsboard.server.dao.service.Validator.validateId;
|
||||
|
||||
@Service
|
||||
@ -108,7 +105,7 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe
|
||||
public void deleteTenant(TenantId tenantId) {
|
||||
log.trace("Executing deleteTenant [{}]", tenantId);
|
||||
Validator.validateId(tenantId, INCORRECT_TENANT_ID + tenantId);
|
||||
oAuth2Service.deleteDomainOAuth2ClientRegistrationByTenant(tenantId);
|
||||
oAuth2Service.deleteTenantOAuth2ClientsParams(tenantId);
|
||||
customerService.deleteCustomersByTenantId(tenantId);
|
||||
widgetsBundleService.deleteWidgetsBundlesByTenantId(tenantId);
|
||||
dashboardService.deleteDashboardsByTenantId(tenantId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user