-
Notifications
You must be signed in to change notification settings - Fork 49
Release 3.6.0 #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 3.6.0 #317
Changes from all commits
45399c2
e305d5d
b9fd226
84a75fa
0695327
6b3d22e
355eafe
c1caeae
ff53e66
9df0542
c2b1a44
eccc116
abfc4e4
ace7340
86042b9
555e274
17bad73
9f2ebd6
edb6137
3dd6522
3aa039e
16194a1
aaf41c9
4771ce6
6f1cc9a
089035d
f75892e
fa648d2
79cc8b1
ab64879
88b042a
50416d6
afdf9f0
0d22d68
ad11e10
2f281b0
f8d2784
d113d36
acd9ee1
77b823f
2ab86e1
3551a00
bddf0dc
affd611
13031c4
433ffec
af65376
d4d6cbf
1441f99
4376a8a
807f043
2f728d3
2c8277f
157a6e6
c88d2c1
1e900a3
845c138
d6abd65
9a743da
6c1417d
cd9417a
8bf6d0c
52660af
7d21b14
1a07e56
272db98
78531fa
a66ac6f
534665d
d176d64
634b9e2
c25aa3f
697ba36
e2dab17
d3c6f2f
e6e992b
1b5b9b9
15b7055
61ae6af
8680ecb
e7c6b04
376e704
795c427
ebd595e
3e9d00e
82434e1
34bd50d
dff88e6
5441939
616dbfc
bae3a68
ad459c2
e84e28f
2b806a7
d2d8fb6
7a5e8cd
3a14f56
00197a2
df1c324
d61a2dc
bbbb623
1237757
254a9a0
e1cf6bd
5bc5445
0aed4f0
1b2e7a0
2802fb3
7030151
7a280b6
b92d7d7
4ed6798
ae5bc54
9d05db2
9ebd258
100245b
3379b71
36a177e
2f7b7d3
4e65a33
dd0957d
300659b
6112a78
7531f30
268642e
ff5dc76
e9c9dea
a1ec0ee
f69fab4
717148c
59e7a85
acb2ff2
d5fdbd7
9aebcc7
aabe287
91ef53d
aaf013c
cf526ce
8938dd1
5f0d92b
0cb6287
c584be7
8fbf9f1
f928523
3adda88
1753021
c504ef9
7dbc8ee
e4717c8
c32fb6b
e73d1cc
50e2313
bf2c62d
c181b2a
5e39ca1
d2f44b1
54acf48
4149b14
1fca232
896012c
067cc02
ac39698
ce7fa31
e5d4234
c4603b0
13aa4ba
b14952b
eba0f45
0dfad08
19ade96
8635a02
d0dc555
dddc108
0505d4e
ffdc20d
a97d332
3686d5c
70695b7
ae474a9
53376cd
9ffee16
aa94a5a
6c00a6b
f93e2f4
e5789f4
ca036e6
7f6f4dc
3336300
435fb88
8fd476b
18a3151
7ec95be
942ae41
c822bbb
75d6fa0
cf2c838
57bdd89
3c3541d
7bc8d71
c072918
eafd705
09000bd
772a9e0
b1fccb9
d7fefd6
c581bf3
4604845
4b7cb37
c668610
9324652
168291a
1121b75
de6f6b2
19239f8
a38c33d
cca9524
8f4efa0
ddee5bd
e41a47e
4081825
6112133
106515c
8a95694
a51d441
f453611
1d12209
c6929cf
ba4da8f
ca7bc2e
5b195cf
e7828c2
543b022
19a5291
cb2ac7f
a49f09b
948d72c
be6843f
65d5b3b
03ee687
50e2180
44b8e84
e614249
1f63a40
289d6ca
df3f76d
deb6a33
565015c
0fb2ea5
b4d7cb0
2b23cd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package com.iemr.common.config.firebase; | ||
|
|
||
| import com.google.auth.oauth2.GoogleCredentials; | ||
| import com.google.firebase.FirebaseApp; | ||
| import com.google.firebase.FirebaseOptions; | ||
| import com.google.firebase.messaging.FirebaseMessaging; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.core.io.ClassPathResource; | ||
|
|
||
| import java.io.ByteArrayInputStream; | ||
| import java.io.FileInputStream; | ||
| import java.io.IOException; | ||
| import java.util.Base64; | ||
|
|
||
| @Configuration | ||
| public class FirebaseMessagingConfig { | ||
| private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); | ||
|
|
||
| @Value("${firebase.enabled:false}") | ||
| private boolean firebaseEnabled; | ||
|
|
||
| @Value("${firebase.credential-file:}") | ||
| private String firebaseCredentialFile; | ||
|
|
||
|
|
||
| @Bean | ||
| @ConditionalOnProperty(name = "firebase.enabled", havingValue = "true") | ||
| public FirebaseMessaging firebaseMessaging() throws IOException { | ||
| if (!firebaseEnabled) { | ||
| logger.error("⚠️ Firebase disabled by config"); | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| if (firebaseCredentialFile == null || firebaseCredentialFile.isBlank()) { | ||
| logger.error("⚠️ No Firebase credentials path provided"); | ||
| return null; // don't throw, app will still start | ||
| } | ||
|
|
||
| GoogleCredentials credentials = GoogleCredentials.fromStream( | ||
| new ClassPathResource(firebaseCredentialFile).getInputStream() | ||
| ); | ||
| FirebaseOptions options = FirebaseOptions.builder() | ||
| .setCredentials(credentials) | ||
| .build(); | ||
|
|
||
| FirebaseApp firebaseApp = FirebaseApp.getApps().isEmpty() | ||
| ? FirebaseApp.initializeApp(options) | ||
| : FirebaseApp.getInstance(); | ||
|
|
||
| return FirebaseMessaging.getInstance(firebaseApp); | ||
|
|
||
| } catch (Exception e) { | ||
| logger.error("⚠️ Firebase init failed: " + e.getMessage()); | ||
| return null; // keep app running | ||
| } | ||
|
Comment on lines
+31
to
+61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Cause
How to fix (pick one)
References
🌐 Web query:
💡 Result: Summary — how @ConditionalOnProperty works and when beans are created:
Sources: Spring Boot API and reference docs for ConditionalOnProperty; community explanation. [1][2][3] 🏁 Script executed: # First, let's examine the actual file to understand the context better
cat -n src/main/java/com/iemr/common/config/firebase/FirebaseMessagingConfig.javaRepository: PSMRI/Common-API Length of output: 2803 Remove Spring does not accept Additionally, the Replace
This ensures deterministic startup behaviour: either a valid bean is created, or startup fails with a clear error message pointing to the actual misconfiguration. 🤖 Prompt for AI Agents |
||
|
|
||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,3 +37,4 @@ public void execute() { | |
| } | ||
|
|
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * AMRIT – Accessible Medical Records via Integrated Technology | ||
| * Integrated EHR (Electronic Health Records) Solution | ||
| * | ||
| * Copyright (C) "Piramal Swasthya Management and Research Institute" | ||
| * | ||
| * This file is part of AMRIT. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * 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.controller.beneficiaryConsent; | ||
|
|
||
| import com.iemr.common.data.beneficiaryConsent.BeneficiaryConsentRequest; | ||
| import com.iemr.common.service.beneficiaryOTPHandler.BeneficiaryOTPHandler; | ||
| import com.iemr.common.utils.mapper.InputMapper; | ||
| import com.iemr.common.utils.response.OutputResponse; | ||
| import io.lettuce.core.dynamic.annotation.Param; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import jakarta.ws.rs.core.MediaType; | ||
| import org.json.JSONObject; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RequestMethod; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RequestMapping(value = { "/beneficiaryConsent" }) | ||
| @RestController | ||
| public class BeneficiaryConsentController { | ||
| final Logger logger = LoggerFactory.getLogger(this.getClass().getName()); | ||
|
|
||
| @Autowired | ||
| private BeneficiaryOTPHandler beneficiaryOTPHandler; | ||
|
|
||
| @Operation(summary = "Send Consent") | ||
| @RequestMapping(value = "/sendConsent", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON) | ||
| public String sendConsent(@Param(value = "{\"mobNo\":\"String\"}") @RequestBody String requestOBJ) { | ||
|
|
||
| OutputResponse response = new OutputResponse(); | ||
|
|
||
| try { | ||
| BeneficiaryConsentRequest obj = InputMapper.gson().fromJson(requestOBJ, BeneficiaryConsentRequest.class); | ||
|
|
||
| String success = beneficiaryOTPHandler.sendOTP(obj); // method name unchanged if internal logic still uses 'OTP' | ||
| logger.info(success.toString()); | ||
| response.setResponse(success); | ||
|
|
||
|
|
||
| } catch (Exception e) { | ||
| response.setError(500, "error : " + e); | ||
| } | ||
| return response.toString(); | ||
| } | ||
|
|
||
| @Operation(summary = "Validate Consent") | ||
| @RequestMapping(value = "/validateConsent", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON) | ||
| public String validateConsent(@Param(value = "{\"mobNo\":\"String\",\"otp\":\"Integer\"}") @RequestBody String requestOBJ) { | ||
|
|
||
| OutputResponse response = new OutputResponse(); | ||
|
|
||
| try { | ||
| BeneficiaryConsentRequest obj = InputMapper.gson().fromJson(requestOBJ, BeneficiaryConsentRequest.class); | ||
|
|
||
| JSONObject responseOBJ = beneficiaryOTPHandler.validateOTP(obj); | ||
| if (responseOBJ != null) | ||
| response.setResponse(responseOBJ.toString()); | ||
| else | ||
| response.setError(500, "failure"); | ||
|
|
||
| } catch (Exception e) { | ||
| logger.error("error in validating Consent : " + e); | ||
| response.setError(500, "error : " + e); | ||
| } | ||
| return response.toString(); | ||
| } | ||
|
|
||
| @Operation(summary = "Resend Consent") | ||
| @RequestMapping(value = "/resendConsent", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON) | ||
| public String resendConsent(@Param(value = "{\"mobNo\":\"String\"}") @RequestBody String requestOBJ) { | ||
| logger.info(requestOBJ.toString()); | ||
Check noticeCode scanning / SonarCloud Logging should not be vulnerable to injection attacks Low
Change this code to not log user-controlled data. See more on SonarQube Cloud
|
||
|
|
||
| OutputResponse response = new OutputResponse(); | ||
|
|
||
| try { | ||
| BeneficiaryConsentRequest obj = InputMapper.gson().fromJson(requestOBJ, BeneficiaryConsentRequest.class); | ||
|
|
||
| String success = beneficiaryOTPHandler.resendOTP(obj); | ||
| logger.info(success.toString()); | ||
|
|
||
| if (success.contains("otp")) | ||
| response.setResponse(success); | ||
| else | ||
| response.setError(500, "failure"); | ||
|
|
||
| } catch (Exception e) { | ||
| logger.error("error in re-sending Consent : " + e); | ||
| response.setError(500, "error : " + e); | ||
| } | ||
| return response.toString(); | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 105
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 1352
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 127
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 5657
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 147
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 112
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 219
🏁 Script executed:
Repository: PSMRI/Common-API
Length of output: 1311
Fix placeholder syntax for video paths and
generateBeneficiaryIDs-api-urlThree properties incorrectly use
{VAR}instead of${VAR}at lines 196, 197, and 209:Spring Boot properties require
${VAR}syntax for environment variable resolution. The{...}pattern will be treated as literal strings and not resolved, breaking Jibri video recording paths and the beneficiary ID generation API URL at runtime. All other environment-driven values in this file correctly use${VAR}.Update to:
🤖 Prompt for AI Agents