Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/java/com/iemr/common/service/cti/CTIServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.iemr.common.repository.callhandling.BeneficiaryCallRepository;
import com.iemr.common.repository.callhandling.IEMRCalltypeRepositoryImplCustom;
import com.iemr.common.utils.config.ConfigProperties;
import com.iemr.common.utils.encryption.AESUtil;
import com.iemr.common.utils.exception.IEMRException;
import com.iemr.common.utils.http.HttpUtils;
import com.iemr.common.utils.mapper.InputMapper;
Expand All @@ -81,6 +82,10 @@ public class CTIServiceImpl implements CTIService {
private static final String CUSTOM_API_FAILURE = "0";

private static final String DEFAULT_IP = "0.0.0.0";

@Autowired
private AESUtil aesUtil;


@Autowired
private BeneficiaryCallRepository beneficiaryCallRepository;
Expand Down Expand Up @@ -290,9 +295,16 @@ public OutputResponse getLoginKey(String request, String ipAddress) throws IEMRE
String serverURL = ConfigProperties.getPropertyByName("cti-server-ip");
AgentLoginKey agentState = objectMapper.readValue(request, AgentLoginKey.class);

String decryptPassword = null;

String passphrase = ConfigProperties.getPropertyByName("encryption.passphrase");

decryptPassword = aesUtil.decrypt(passphrase, agentState.getPassword());


ctiURI = ctiURI.replace("CTI_SERVER", serverURL);
ctiURI = ctiURI.replace("USERNAME", (agentState.getUsername() != null) ? agentState.getUsername() : "");
ctiURI = ctiURI.replace("PASSWORD", (agentState.getPassword() != null) ? agentState.getPassword() : "");
ctiURI = ctiURI.replace("PASSWORD", (decryptPassword != null) ? decryptPassword : "");
logger.info("calling URL " + ctiURI);
ctiURI = ctiURI.replace("AGENT_IP", ipAddress);
String response = this.callUrl(ctiURI);// httpUtils.get(ctiURI);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ cti-server-ip=10.208.122.99
cti-logger_base_url=http://10.208.122.99/logger
sms-gateway-url =

#Encryption passphrase used by AESUtil for decrypting CTI passwords.
encryption.passphrase=Piramal12Piramal

# Identity Config
identity-api-url = http://localhost:8094/
#Verify whether 1097 and identity are same?
Expand Down
Loading