Commit 0acb4272a59c37e1aea828e9e05e3a5c84488275
1 parent
1b531e28
Create default edge rule chains oauth2
Showing
1 changed file
with
9 additions
and
0 deletions
... | ... | @@ -17,8 +17,10 @@ package org.thingsboard.server.service.security.auth.oauth2; |
17 | 17 | |
18 | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
19 | 19 | import com.fasterxml.jackson.databind.node.ObjectNode; |
20 | +import lombok.Getter; | |
20 | 21 | import lombok.extern.slf4j.Slf4j; |
21 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | +import org.springframework.beans.factory.annotation.Value; | |
22 | 24 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
23 | 25 | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
24 | 26 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
... | ... | @@ -85,6 +87,10 @@ public abstract class AbstractOAuth2ClientMapper { |
85 | 87 | @Autowired |
86 | 88 | protected TbClusterService tbClusterService; |
87 | 89 | |
90 | + @Value("${edges.enabled}") | |
91 | + @Getter | |
92 | + private boolean edgesEnabled; | |
93 | + | |
88 | 94 | private final Lock userCreationLock = new ReentrantLock(); |
89 | 95 | |
90 | 96 | protected SecurityUser getOrCreateSecurityUserFromOAuth2User(OAuth2User oauth2User, OAuth2ClientRegistrationInfo clientRegistration) { |
... | ... | @@ -171,6 +177,9 @@ public abstract class AbstractOAuth2ClientMapper { |
171 | 177 | tenant.setTitle(tenantName); |
172 | 178 | tenant = tenantService.saveTenant(tenant); |
173 | 179 | installScripts.createDefaultRuleChains(tenant.getId()); |
180 | + if (edgesEnabled) { | |
181 | + installScripts.createDefaultEdgeRuleChains(tenant.getId()); | |
182 | + } | |
174 | 183 | tenantProfileCache.evict(tenant.getId()); |
175 | 184 | tbClusterService.onTenantChange(tenant, null); |
176 | 185 | tbClusterService.onEntityStateChange(tenant.getId(), tenant.getId(), | ... | ... |