Skip to content

Commit

Permalink
taken latest changes from 1.2.0-rc2 (mosip#56)
Browse files Browse the repository at this point in the history
* Created 1.2.0-rc2 (mosip#23)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* MOSIP-15420: Upgraded swagger2.0 to openapi3.0 for packet manager service (mosip#31)

Resolved merge conflict

* Added logger and fixed test cases (mosip#32)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* MOSIP-15420: Generated openapi.json for packet manager service (mosip#34)

* MOSIP-15420: Upgraded swagger2.0 to openapi3.0 for packet manager service

Resolved merge conflict

* MOSIP-15420: Generated openapi.json for packet manager service

Resolved merge conflicts

* MOSIP-18453 : improved usage of caching (mosip#36)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* Added sonar_analysis

* MOSIP-18450 : added exception for objects not available in minio (mosip#37)

* MOSIP-18450 : added exception for objects not available in minio

* Added sonar_analysis

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* MOSIP-18450 : added exception for objects not available in minio

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* initial change

* MOSIP-18450 : added exception for objects not available in minio

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* initial change

* MOSIP-18793 :Added afterburner + fixes

Co-authored-by: Monobikash Das <M1045447@mindtree.com>
Co-authored-by: Rakshitha650 <76676196+Rakshitha650@users.noreply.github.com>
Co-authored-by: Mandeep Dhiman <46880392+mandeepdhiman123@users.noreply.github.com>
Co-authored-by: Admin <Admin@MONOBIKASH>

* Mosip:15286 Changed openapi.json name.

* updated the Sonar_analysis code and removed the Dskiptests

* updated the Sonar_analysis code and removed the Dskiptests

* added gpg keys

* changes for real bio

* Merged with 1.2.0-rc2

* changes for real bio

* Auth role issue fixed (mosip#46)

* MOR-147 : multithreading issue for create packet api (mosip#52)

Co-authored-by: Admin <Admin@MONOBIKASH>

* selfTokenRestTemplate fix for regclient

Co-authored-by: Monobikash Das <M1045447@mindtree.com>
Co-authored-by: kameshsr <47484458+kameshsr@users.noreply.github.com>
Co-authored-by: Rakshitha650 <76676196+Rakshitha650@users.noreply.github.com>
Co-authored-by: Mandeep Dhiman <46880392+mandeepdhiman123@users.noreply.github.com>
Co-authored-by: Admin <Admin@MONOBIKASH>
Co-authored-by: Rakshith650 <rakshitham38@gmail.com>
Co-authored-by: Sasikumar Ganesan <gsasikumar@gmail.com>
Signed-off-by: Sowmya Ujjappa Banakar <sowmya.61022006@ltimindtree.com>
  • Loading branch information
8 people authored and Sowmya Ujjappa Banakar committed Mar 6, 2024
1 parent ff8501f commit 9001948
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: failure() # Pick up events even if the job fails or is canceled.

sonar_analysis:
runs-on: ubuntu-latest
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class AuditLogEntry {

@Autowired
@Lazy
@Qualifier("selfTokenRestTemplate")
private RestTemplate restTemplate;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public enum PacketUtilityErrorCodes {
TAG_NOT_FOUND("KER-PUT-024", "Requested tag not present"),
SOURCE_NOT_PRESENT("KER-PUT-025", "Invalid source or process."),
DELETE_TAGGING_FAILED("KER-PUT-026", "Failed to delete tags."),
OBJECT_DOESNOT_EXISTS("KER-PUT-027", "Object doesnot exists."),;
OBJECT_DOESNOT_EXISTS("KER-PUT-027", "Object doesnot exists."),
UNKNOWN_EXCEPTION("KER-PUT-028", "Unknown Exception.");



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ public List<PacketInfo> createPacket(PacketDto packetDto) {
LOGGER.info(PacketManagerLogger.SESSIONID, PacketManagerLogger.REGISTRATIONID, packetDto.getId(),
ExceptionUtils.getStackTrace(e));
LOGGER.error(PacketManagerLogger.SESSIONID, PacketManagerLogger.REGISTRATIONID, packetDto.getId(), ExceptionUtils.getStackTrace(e));
} finally {
// remove object from registration packet hashmap
provider.removePacket(packetDto.getId());
}
return packetInfos;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -65,7 +66,8 @@ public class OnlinePacketCryptoServiceImpl implements IPacketCryptoService {
private boolean isPrependThumbprintEnabled;

@Autowired
private RestTemplate restTemplate;
private ApplicationContext applicationContext;
private RestTemplate restTemplate = null;

@Autowired
private ObjectMapper mapper;
Expand Down Expand Up @@ -96,7 +98,7 @@ public byte[] sign(byte[] packet) {
.parse(DateUtils.getUTCCurrentDateTimeString(DATETIME_PATTERN), format);
request.setRequesttime(localdatetime);
HttpEntity<RequestWrapper<TpmSignRequestDto>> httpEntity = new HttpEntity<>(request);
ResponseEntity<String> response = restTemplate.exchange(keymanagerCsSignUrl, HttpMethod.POST, httpEntity,
ResponseEntity<String> response = getRestTemplate().exchange(keymanagerCsSignUrl, HttpMethod.POST, httpEntity,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");
if (responseMap != null && responseMap.size() > 0)
Expand Down Expand Up @@ -142,7 +144,7 @@ public byte[] encrypt(String refId, byte[] packet) {
request.setVersion(APPLICATION_VERSION);
HttpEntity<RequestWrapper<CryptomanagerRequestDto>> httpEntity = new HttpEntity<>(request);

ResponseEntity<String> response = restTemplate.exchange(cryptomanagerEncryptUrl, HttpMethod.POST, httpEntity, String.class);
ResponseEntity<String> response = getRestTemplate().exchange(cryptomanagerEncryptUrl, HttpMethod.POST, httpEntity, String.class);
CryptomanagerResponseDto responseObject = mapper.readValue(response.getBody(), CryptomanagerResponseDto.class);
if (responseObject != null &&
responseObject.getErrors() != null && !responseObject.getErrors().isEmpty()) {
Expand Down Expand Up @@ -212,7 +214,7 @@ public byte[] decrypt(String refId, byte[] packet) {
request.setVersion(APPLICATION_VERSION);
HttpEntity<RequestWrapper<CryptomanagerRequestDto>> httpEntity = new HttpEntity<>(request);

ResponseEntity<String> response = restTemplate.exchange(cryptomanagerDecryptUrl, HttpMethod.POST, httpEntity, String.class);
ResponseEntity<String> response = getRestTemplate().exchange(cryptomanagerDecryptUrl, HttpMethod.POST, httpEntity, String.class);

CryptomanagerResponseDto responseObject = mapper.readValue(response.getBody(), CryptomanagerResponseDto.class);

Expand Down Expand Up @@ -269,7 +271,7 @@ public boolean verify(String refId, byte[] packet, byte[] signature) {
.parse(DateUtils.getUTCCurrentDateTimeString(DATETIME_PATTERN), format);
request.setRequesttime(localdatetime);
HttpEntity<RequestWrapper<TpmSignVerifyRequestDto>> httpEntity = new HttpEntity<>(request);
ResponseEntity<String> response = restTemplate.exchange(keymanagerCsverifysignUrl, HttpMethod.POST, httpEntity,
ResponseEntity<String> response = getRestTemplate().exchange(keymanagerCsverifysignUrl, HttpMethod.POST, httpEntity,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");//.get("signature");
if (responseMap != null && responseMap.size() > 0) {
Expand All @@ -296,7 +298,7 @@ public boolean verify(String refId, byte[] packet, byte[] signature) {

private String getPublicKey(String refId) throws IOException {
String machineId = refId.split("_")[1];
ResponseEntity<String> response = restTemplate.exchange(syncdataGetTpmKeyUrl+machineId, HttpMethod.GET, null,
ResponseEntity<String> response = getRestTemplate().exchange(syncdataGetTpmKeyUrl+machineId, HttpMethod.GET, null,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");//.get("signature");
if (responseMap != null && responseMap.size() > 0)
Expand All @@ -307,4 +309,12 @@ private String getPublicKey(String refId) throws IOException {
throw new SignatureException();
}
}

private RestTemplate getRestTemplate() {
if (this.restTemplate == null) {
this.restTemplate = (RestTemplate)this.applicationContext.getBean("selfTokenRestTemplate");
}

return this.restTemplate;
}
}
Loading

0 comments on commit 9001948

Please sign in to comment.