Skip to content

Commit b50f447

Browse files
committed
Reput everything
1 parent 510cf50 commit b50f447

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

openaev-api/src/main/java/io/openaev/config/security/SecurityService.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
import io.openaev.database.model.Tenant;
88
import io.openaev.database.model.User;
9+
import io.openaev.database.repository.TenantRepository;
910
import io.openaev.database.repository.UserRepository;
1011
import io.openaev.service.UserMappingService;
1112
import io.openaev.service.UserService;
12-
import io.openaev.service.tenants.TenantService;
1313
import io.openaev.service.user_events.UserEventService;
1414
import jakarta.persistence.EntityNotFoundException;
1515
import jakarta.validation.constraints.NotBlank;
@@ -40,7 +40,7 @@ public class SecurityService {
4040
private final UserMappingService userMappingService;
4141
private final Environment env;
4242
private final UserEventService userEventService;
43-
private final TenantService tenantService;
43+
private final TenantRepository tenantRepository;
4444

4545
public User userManagement(
4646
String emailAttribute,
@@ -114,7 +114,11 @@ private void attachTenant(String registrationId, User user) {
114114
return;
115115
}
116116
try {
117-
Tenant tenant = tenantService.findById(tenantId);
117+
Tenant tenant =
118+
tenantRepository
119+
.findById(tenantId)
120+
.orElseThrow(() -> new EntityNotFoundException("Tenant not found: " + tenantId));
121+
;
118122
user.getTenants().add(tenant);
119123
} catch (EntityNotFoundException e) {
120124
log.warn("SSO tenant ID '{}' configured but not found in database", tenantId);

0 commit comments

Comments
 (0)