Add new properties in ReadMe and deploy service. Change ZombieRepository to Ldap

This commit is contained in:
Konstantinos Triantafyllou 2024-10-15 19:25:26 +03:00
parent 8e8cf4a583
commit 0987c08b5c
3 changed files with 13 additions and 5 deletions

View File

@ -11,7 +11,7 @@ Check first [authorization-library](https://code-repo.d4science.org/MaDgIK/autho
user-management.developers= # Required - URL of Developers portal (Deprecated) user-management.developers= # Required - URL of Developers portal (Deprecated)
user-management.developers-api= # Required - URL of Developers API (Deprecated) user-management.developers-api= # Required - URL of Developers API (Deprecated)
user-management.loginURL= # Required - URL for Login Action user-management.login-url= # Required - URL for Login Action
user-management.role-management= # Required - URL of Role Management API user-management.role-management= # Required - URL of Role Management API

View File

@ -1,15 +1,13 @@
package eu.dnetlib.uoausermanagment.dao; package eu.dnetlib.uoausermanagment.dao;
import eu.dnetlib.uoausermanagment.entities.User;
import eu.dnetlib.uoausermanagment.entities.ZombieUser; import eu.dnetlib.uoausermanagment.entities.ZombieUser;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.ldap.repository.LdapRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.naming.Name;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface ZombieUserRepository extends CrudRepository<ZombieUser, Name> { public interface ZombieUserRepository extends LdapRepository<ZombieUser> {
Optional<ZombieUser> findByUsername(String username); Optional<ZombieUser> findByUsername(String username);
Optional<ZombieUser> findByEmail(String email); Optional<ZombieUser> findByEmail(String email);
} }

View File

@ -15,6 +15,8 @@ import java.util.Map;
public class DeployService { public class DeployService {
private final Datasource datasource; private final Datasource datasource;
private final String roleManagement; private final String roleManagement;
private final String developers;
private final String developersApi;
private final Mail mail; private final Mail mail;
private final GlobalVars globalVars; private final GlobalVars globalVars;
@ -22,6 +24,8 @@ public class DeployService {
public DeployService(Properties properties, GlobalVars globalVars) { public DeployService(Properties properties, GlobalVars globalVars) {
this.datasource = properties.getDatasource(); this.datasource = properties.getDatasource();
this.roleManagement = properties.getRoleManagement(); this.roleManagement = properties.getRoleManagement();
this.developers = properties.getDevelopers();
this.developersApi = properties.getDevelopersApi();
this.mail = properties.getMail(); this.mail = properties.getMail();
this.globalVars = globalVars; this.globalVars = globalVars;
} }
@ -34,6 +38,10 @@ public class DeployService {
throw new RuntimeException("user-management.datasource.url is missing!"); throw new RuntimeException("user-management.datasource.url is missing!");
} else if (roleManagement == null || roleManagement.isEmpty()) { } else if (roleManagement == null || roleManagement.isEmpty()) {
throw new RuntimeException("user-management.role-management is missing!"); throw new RuntimeException("user-management.role-management is missing!");
} else if (developers == null || developers.isEmpty()) {
throw new RuntimeException("user-management.developers is missing!");
} else if (developersApi == null || developersApi.isEmpty()) {
throw new RuntimeException("user-management.developers-api is missing!");
} }
} }
@ -44,6 +52,8 @@ public class DeployService {
response.put("user-management.datasource.username", datasource.getUsername()); response.put("user-management.datasource.username", datasource.getUsername());
response.put("user-management.datasource.password", datasource.getPassword()); response.put("user-management.datasource.password", datasource.getPassword());
response.put("user-management.role-management", roleManagement); response.put("user-management.role-management", roleManagement);
response.put("user-management.developers", developers);
response.put("user-management.developers-api", developersApi);
response.put("user-management.mail.auth", mail.getAuth()); response.put("user-management.mail.auth", mail.getAuth());
response.put("user-management.mail.sslProtocols", mail.getSslProtocols()); response.put("user-management.mail.sslProtocols", mail.getSslProtocols());
response.put("user-management.mail.from", mail.getFrom()); response.put("user-management.mail.from", mail.getFrom());