|
6 | 6 |
|
7 | 7 | import io.openaev.database.model.Tenant; |
8 | 8 | import io.openaev.database.model.User; |
| 9 | +import io.openaev.database.repository.TenantRepository; |
9 | 10 | import io.openaev.database.repository.UserRepository; |
10 | 11 | import io.openaev.service.UserMappingService; |
11 | 12 | import io.openaev.service.UserService; |
12 | | -import io.openaev.service.tenants.TenantService; |
13 | 13 | import io.openaev.service.user_events.UserEventService; |
14 | 14 | import jakarta.persistence.EntityNotFoundException; |
15 | 15 | import jakarta.validation.constraints.NotBlank; |
@@ -40,7 +40,7 @@ public class SecurityService { |
40 | 40 | private final UserMappingService userMappingService; |
41 | 41 | private final Environment env; |
42 | 42 | private final UserEventService userEventService; |
43 | | - private final TenantService tenantService; |
| 43 | + private final TenantRepository tenantRepository; |
44 | 44 |
|
45 | 45 | public User userManagement( |
46 | 46 | String emailAttribute, |
@@ -114,7 +114,11 @@ private void attachTenant(String registrationId, User user) { |
114 | 114 | return; |
115 | 115 | } |
116 | 116 | try { |
117 | | - Tenant tenant = tenantService.findById(tenantId); |
| 117 | + Tenant tenant = |
| 118 | + tenantRepository |
| 119 | + .findById(tenantId) |
| 120 | + .orElseThrow(() -> new EntityNotFoundException("Tenant not found: " + tenantId)); |
| 121 | + ; |
118 | 122 | user.getTenants().add(tenant); |
119 | 123 | } catch (EntityNotFoundException e) { |
120 | 124 | log.warn("SSO tenant ID '{}' configured but not found in database", tenantId); |
|
0 commit comments