diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index fac6b36e..ce0f3867 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -18,9 +18,9 @@ jobs: Package-test: runs-on: ubuntu-latest steps: - - - name: Checkout code - uses: actions/checkout@v2 + + - name: Checkout code + uses: actions/checkout@v3 - name: Setup JDK 8 uses: actions/setup-java@v2 @@ -33,9 +33,10 @@ jobs: - name: Build WAR file run: mvn -B package --file pom.xml - + - name: Upload WAR file as artifact uses: actions/upload-artifact@v2 with: name: Common-API path: target/commonapi-v1.0.war + diff --git a/.github/workflows/sast-and-package.yml b/.github/workflows/sast-and-package.yml new file mode 100644 index 00000000..4ac6bca8 --- /dev/null +++ b/.github/workflows/sast-and-package.yml @@ -0,0 +1,49 @@ +name: Package + +on: + push: + branches: [ "develop"] + paths-ignore: + - target/** + + pull_request: + branches: [ "develop" ] + paths-ignore: + - target/** + +env: + ENV_VAR: test + +jobs: + Package-test: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup JDK 8 + uses: actions/setup-java@v2 + with: + java-version: 8 + distribution: 'adopt' + + - name: Build with Maven + run: mvn clean install -DENV_VAR=${{ env.ENV_VAR }} + + - name: Build WAR file + run: mvn -B package --file pom.xml + + - name: Upload WAR file as artifact + uses: actions/upload-artifact@v2 + with: + name: Common-API + path: target/commonapi-v1.0.war + diff --git a/.gitignore b/.gitignore index a7d733a1..a0ab8f9d 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,5 @@ replay_pid89928.log hs_err_pid89928.log # Properties -src/main/environment/common_local.properties \ No newline at end of file +src/main/environment/common_local.properties + diff --git a/README.md b/README.md index fca2ad4e..82984715 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # AMRIT - Common Service [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![branch parameter](https://github.com/PSMRI/Common-API/actions/workflows/sast-and-package.yml/badge.svg) + Common API is a microservice whch acts as a gateway for AMRIT. There are many APIs that are exposed by Common-API. It contains APIs of common integrators like c-Zentrix, Everwell, Openkm and some master APIs like location master, alerts, notification,language and location messages. ### Primary Features * Beneficiary Registration diff --git a/pom.xml b/pom.xml index 131f6f11..fa77295b 100644 --- a/pom.xml +++ b/pom.xml @@ -321,7 +321,9 @@ org.springframework.boot spring-boot-devtools - + + + org.apache.poi poi-ooxml diff --git a/src/main/environment/common_dev.properties b/src/main/environment/common_dev.properties index 516f6156..a306e9b2 100644 --- a/src/main/environment/common_dev.properties +++ b/src/main/environment/common_dev.properties @@ -3,6 +3,7 @@ spring.jpa.database=default ## Primary db +<<<<<<< HEAD spring.datasource.url= spring.datasource.username= spring.datasource.password= @@ -12,6 +13,17 @@ spring.datasource.driver-class-name=com.mysql.jdbc.Driver secondary.datasource.username= secondary.datasource.password= secondary.datasource.url= +======= +encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +spring.datasource.url=jdbc:mysql://10.208.122.32:3306/db_iemr?autoReconnect=true&useSSL=false +spring.datasource.driver-class-name=com.mysql.jdbc.Driver + +## Secondary db +encDbUserNameSec=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPassSec=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +secondary.datasource.url=jdbc:mysql://10.208.122.32:3306/db_reporting?autoReconnect=true&useSSL=false +>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db secondary.datasource.driver-class-name=com.mysql.jdbc.Driver # KM config diff --git a/src/main/environment/common_local.properties b/src/main/environment/common_local.properties index 1e444d04..fa714013 100644 --- a/src/main/environment/common_local.properties +++ b/src/main/environment/common_local.properties @@ -1,8 +1,14 @@ # local env # DB Connections +<<<<<<< HEAD spring.datasource.url= spring.datasource.username= spring.datasource.password= +======= +spring.datasource.url=jdbc:mysql://localhost:3306/db_iemr?autoReconnect=true&useSSL=false +encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db spring.datasource.driver-class-name=com.mysql.jdbc.Driver secondary.datasource.username= diff --git a/src/main/environment/common_test.properties b/src/main/environment/common_test.properties index 255e63cb..d69feebb 100644 --- a/src/main/environment/common_test.properties +++ b/src/main/environment/common_test.properties @@ -5,16 +5,28 @@ spring.jpa.database=default ##--------------------------------------------## Primary db------------------------------------------------------------------- +<<<<<<< HEAD spring.datasource.url= spring.datasource.username= spring.datasource.password= +======= +encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +spring.datasource.url=jdbc:mysql://10.208.122.38:3306/db_iemr?autoReconnect=true&useSSL=false +>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db spring.datasource.driver-class-name=com.mysql.jdbc.Driver +<<<<<<< HEAD secondary.datasource.username= secondary.datasource.password= secondary.datasource.url= +======= +encDbUserNameSec=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPassSec=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +secondary.datasource.url=jdbc:mysql://10.208.122.38:3306/db_reporting?autoReconnect=true&useSSL=false +>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db secondary.datasource.driver-class-name=com.mysql.jdbc.Driver ##-------------------------------------------------------------# KM config-------------------------------------------------- diff --git a/src/main/environment/common_uat.properties b/src/main/environment/common_uat.properties index a04ee909..2249d9d7 100644 --- a/src/main/environment/common_uat.properties +++ b/src/main/environment/common_uat.properties @@ -1,9 +1,15 @@ # UAT env # DB Connections +<<<<<<< HEAD spring.datasource.url= spring.datasource.username= spring.datasource.password= +======= +spring.datasource.url=jdbc:mysql://172.16.19.43:3306/db_iemr?autoReconnect=true&useSSL=false +encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k= +encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k= +>>>>>>> 2c9c4f37f670158e36f1413a3817860f795b13db spring.datasource.driver-class-name=com.mysql.jdbc.Driver secondary.datasource.username= diff --git a/src/main/java/com/iemr/common/config/PrimaryDBConfig.java b/src/main/java/com/iemr/common/config/PrimaryDBConfig.java index 773a66fd..19998bea 100644 --- a/src/main/java/com/iemr/common/config/PrimaryDBConfig.java +++ b/src/main/java/com/iemr/common/config/PrimaryDBConfig.java @@ -28,6 +28,7 @@ import org.apache.tomcat.jdbc.pool.PoolProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; @@ -48,6 +49,7 @@ "com.iemr.common.repo", "com.iemr.common.notification.agent", "com.iemr.common.covidVaccination" }) public class PrimaryDBConfig { + Logger logger = LoggerFactory.getLogger(this.getClass().getName()); @Primary diff --git a/src/main/java/com/iemr/common/config/SecondaryDBConfig.java b/src/main/java/com/iemr/common/config/SecondaryDBConfig.java index c481fab1..3fab13e8 100644 --- a/src/main/java/com/iemr/common/config/SecondaryDBConfig.java +++ b/src/main/java/com/iemr/common/config/SecondaryDBConfig.java @@ -85,4 +85,5 @@ public PlatformTransactionManager barTransactionManager( @Qualifier("secondaryEntityManagerFactory") EntityManagerFactory secondaryEntityManagerFactory) { return new JpaTransactionManager(secondaryEntityManagerFactory); } -} + +} \ No newline at end of file diff --git a/src/main/java/com/iemr/common/controller/users/IEMRAdminController.java b/src/main/java/com/iemr/common/controller/users/IEMRAdminController.java index 6986eb86..373dab1b 100644 --- a/src/main/java/com/iemr/common/controller/users/IEMRAdminController.java +++ b/src/main/java/com/iemr/common/controller/users/IEMRAdminController.java @@ -78,14 +78,15 @@ public class IEMRAdminController { private InputMapper inputMapper = new InputMapper(); private IEMRAdminUserService iemrAdminUserServiceImpl; - + private AESUtil aesUtil; @Autowired public void setAesUtil(AESUtil aesUtil) { - this.aesUtil = aesUtil; + this.aesUtil = aesUtil; } + @Autowired public void setIemrAdminUserService(IEMRAdminUserService iemrAdminUserService) { this.iemrAdminUserServiceImpl = iemrAdminUserService; diff --git a/src/main/java/com/iemr/common/service/door_to_door_app/DoorToDoorServiceImpl.java b/src/main/java/com/iemr/common/service/door_to_door_app/DoorToDoorServiceImpl.java index 8835c78e..b03c39ec 100644 --- a/src/main/java/com/iemr/common/service/door_to_door_app/DoorToDoorServiceImpl.java +++ b/src/main/java/com/iemr/common/service/door_to_door_app/DoorToDoorServiceImpl.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -52,6 +51,7 @@ @Service @PropertySource("classpath:application.properties") public class DoorToDoorServiceImpl implements DoorToDoorService { + @Value("${avniRegistrationLimit}") private String avniRegistrationLimit; diff --git a/src/main/java/com/iemr/common/service/email/EmailServiceImpl.java b/src/main/java/com/iemr/common/service/email/EmailServiceImpl.java index 0251d88b..35016ce7 100644 --- a/src/main/java/com/iemr/common/service/email/EmailServiceImpl.java +++ b/src/main/java/com/iemr/common/service/email/EmailServiceImpl.java @@ -62,7 +62,8 @@ @Service public class EmailServiceImpl implements EmailService { - + + private InputMapper inputMapper = new InputMapper(); @Autowired private JavaMailSender javaMailSender; diff --git a/src/main/java/com/iemr/common/service/everwell/EverwellRegistrationServiceImpl.java b/src/main/java/com/iemr/common/service/everwell/EverwellRegistrationServiceImpl.java index 4d5b6aaa..77be19bb 100644 --- a/src/main/java/com/iemr/common/service/everwell/EverwellRegistrationServiceImpl.java +++ b/src/main/java/com/iemr/common/service/everwell/EverwellRegistrationServiceImpl.java @@ -144,7 +144,6 @@ public void registerBeneficiary() { try { // 1097 user authentication - String amritUser = amritUserName; String amritPass = amritPassword; LoginRequestModel loginCredentials1097 = new LoginRequestModel(amritUser, amritPass); diff --git a/src/main/java/com/iemr/common/service/otp/OTPHandlerImpl.java b/src/main/java/com/iemr/common/service/otp/OTPHandlerImpl.java index 9782aba2..27e8a32e 100644 --- a/src/main/java/com/iemr/common/service/otp/OTPHandlerImpl.java +++ b/src/main/java/com/iemr/common/service/otp/OTPHandlerImpl.java @@ -52,7 +52,8 @@ @Service public class OTPHandlerImpl implements OTPHandler { - + + @Autowired HttpUtils httpUtils; @Autowired diff --git a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java index 08b790ed..a5cb0721 100644 --- a/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java +++ b/src/main/java/com/iemr/common/service/sms/SMSServiceImpl.java @@ -113,7 +113,7 @@ public class SMSServiceImpl implements SMSService { private String prescription; @Autowired SMSMapper smsMapper; - + @Autowired SMSTemplateRepository smsTemplateRepository; diff --git a/src/main/java/com/iemr/common/utils/encryption/AESUtil.java b/src/main/java/com/iemr/common/utils/encryption/AESUtil.java index e9d7b895..43a9bacd 100644 --- a/src/main/java/com/iemr/common/utils/encryption/AESUtil.java +++ b/src/main/java/com/iemr/common/utils/encryption/AESUtil.java @@ -19,6 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ + package com.iemr.common.utils.encryption; import java.nio.charset.StandardCharsets; import java.security.InvalidAlgorithmParameterException; @@ -53,7 +54,6 @@ public enum DataType { private static final Logger logger = LoggerFactory.getLogger(AESUtil.class); - private static final String CIPHER_ALGORITHM = "AES/CBC/ISO10126Padding"; private static final String SECRET_KEY_ALGORITHM = "PBKDF2WithHmacSHA512"; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b81232d4..b623c8c7 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -167,7 +167,6 @@ source-address=AIDSHL sms-message-type=SERVICE_EXPLICIT sms-entityid=1201161708885589464 - ### Email Gateway URL details email-gateway-url= @@ -192,6 +191,7 @@ everwellUserName = everwellPassword = amritUserName = amritPassword = + everwellVanID = 1 everwellProviderServiceMapID = 1761 everwellgovtIdentityNo = 2 @@ -210,16 +210,31 @@ everwell1097userAuthenticate = http://10.208.122.38:8080/commonapi-v1.0/user/us everwelluserAuthenticate = https://beta-hub.everwell.org/token everwellRegisterBenficiary = http://10.208.122.38:8080/commonapi-v1.0/beneficiary/create + ## LungAssessment credentials lungAssessmentEmail = lungAssessmentPassword = + ## SWASSA APIs lungAssessmentAdminLogin = http://swaasa.sandbox.swaasa.ai/api/adminLogin lungAssessmentValidateCough = http://swaasa.sandbox.swaasa.ai/api/verifycough lungAssessmentStartAssesment = http://swaasa.sandbox.swaasa.ai/api/assessment lungAssessmentGetAssesment = http://swaasa.sandbox.swaasa.ai/api/getAssessment +#E- Sanjeevani user authenticate creds +eSanjeevani.url: https://preprod.esanjeevaniopd.xyz/uat/aus/api/ThirdPartyAuth/providerLogin +eSanjeevani.userName: +eSanjeevani.password: +eSanjeevani.salt: 123456 +eSanjeevani.source: 11001 +eSanjeevani.registerPatient: https://preprod.esanjeevaniopd.xyz/uat/ps/api/v1/Patient +eSanjeevani.routeUrl: https://uat.esanjeevani.in/user/signin + +biometric.discover.url = http://127.0.0.1:port/ +biometric.deviceInfo.url = http://127.0.0.1:port/rd/info +biometric.capture.url = http://127.0.0.1:port/rd/capture + quality-Audit-PageSize=5 ## max no of failed login attempt