Skip to content

Commit

Permalink
Merge branch 'develop' into patch-16
Browse files Browse the repository at this point in the history
Signed-off-by: Balaji Alluru <[email protected]>
  • Loading branch information
balaji-alluru authored Jan 23, 2024
2 parents ee8de8f + 902c938 commit c8f269c
Show file tree
Hide file tree
Showing 12 changed files with 1,914 additions and 42 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/db-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: PostgreSQL Test

on:
release:
types: [published]
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
message:
description: 'Message for manually triggering'
required: false
default: 'Triggered for Updates'
type: string
push:
branches:
- '!release-branch'
- release*
- master
- 1.*
- develop*
- MOSIP*
paths:
- 'db_scripts/**'

jobs:
build-db-test:
strategy:
matrix:
include:
- DB_LOCATION: 'db_scripts/mosip_pms'
DB_NAME: 'mosip_pms'
fail-fast: false
name: ${{ matrix.DB_NAME }}
uses: mosip/kattu/.github/workflows/db-test.yml@master
with:
DB_LOCATION: ${{ matrix.DB_LOCATION}}
8 changes: 5 additions & 3 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
release:
types: [published]
pull_request:
types: [opened]
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
message:
Expand Down Expand Up @@ -35,7 +35,8 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"

needs: build-maven-partner
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
with:
Expand Down Expand Up @@ -85,4 +86,5 @@ jobs:
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

2 changes: 1 addition & 1 deletion db_scripts/mosip_pms/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

## Properties file
set -e
properties_file="$1"
Expand Down
42 changes: 21 additions & 21 deletions db_scripts/mosip_pms/dml/pms-partner_policy_bioextract.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
id,part_id,policy_id,attribute_name,extractor_provider,extractor_provider_version,biometric_modality,biometric_sub_types,cr_by,cr_dtimes,upd_by,upd_dtimes
146098,mpartner-default-auth,mpolicy-default-auth,photo,mock,1.1,face,,admin,now(),admin,now()
146099,mpartner-default-auth,mpolicy-default-auth,iris,mock,1.1,iris,,admin,now(),admin,now()
146100,mpartner-default-auth,mpolicy-default-auth,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146101,mpartner-default-print,mpolicy-default-qrcode,photo,mock,1.1,face,,admin,now(),admin,now()
146102,mpartner-default-print,mpolicy-default-qrcode,iris,mock,1.1,iris,,admin,now(),admin,now()
146103,mpartner-default-print,mpolicy-default-qrcode,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146104,mpartner-default-print,mpolicy-default-euin,photo,mock,1.1,face,,admin,now(),admin,now()
146105,mpartner-default-print,mpolicy-default-euin,iris,mock,1.1,iris,,admin,now(),admin,now()
146106,mpartner-default-print,mpolicy-default-euin,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146107,mpartner-default-print,mpolicy-default-reprint,photo,mock,1.1,face,,admin,now(),admin,now()
146108,mpartner-default-print,mpolicy-default-reprint,iris,mock,1.1,iris,,admin,now(),admin,now()
146109,mpartner-default-print,mpolicy-default-reprint,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146110,mpartner-default-print,mpolicy-default-eUIN_with_QR,photo,mock,1.1,face,,admin,now(),admin,now()
146111,mpartner-default-print,mpolicy-default-eUIN_with_QR,iris,mock,1.1,iris,,admin,now(),admin,now()
146112,mpartner-default-print,mpolicy-default-eUIN_with_QR,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146113,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,photo,mock,1.1,face,,admin,now(),admin,now()
146114,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,iris,mock,1.1,iris,,admin,now(),admin,now()
146115,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146116,mpartner-default-digitalcard,mpolicy-default-PDFCard,photo,mock,1.1,face,,admin,now(),admin,now()
146117,mpartner-default-digitalcard,mpolicy-default-PDFCard,iris,mock,1.1,iris,,admin,now(),admin,now()
146118,mpartner-default-digitalcard,mpolicy-default-PDFCard,fingerprint,mock,1.1,finger,,admin,now(),admin,now()
146098,mpartner-default-auth,mpolicy-default-auth,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146099,mpartner-default-auth,mpolicy-default-auth,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146100,mpartner-default-auth,mpolicy-default-auth,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146101,mpartner-default-print,mpolicy-default-qrcode,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146102,mpartner-default-print,mpolicy-default-qrcode,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146103,mpartner-default-print,mpolicy-default-qrcode,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146104,mpartner-default-print,mpolicy-default-euin,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146105,mpartner-default-print,mpolicy-default-euin,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146106,mpartner-default-print,mpolicy-default-euin,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146107,mpartner-default-print,mpolicy-default-reprint,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146108,mpartner-default-print,mpolicy-default-reprint,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146109,mpartner-default-print,mpolicy-default-reprint,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146110,mpartner-default-print,mpolicy-default-eUIN_with_QR,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146111,mpartner-default-print,mpolicy-default-eUIN_with_QR,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146112,mpartner-default-print,mpolicy-default-eUIN_with_QR,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146113,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146114,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146115,mpartner-default-print,mpolicy-default-eUIN_with_faceQR,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
146116,mpartner-default-digitalcard,mpolicy-default-PDFCard,individualBiometrics,mock,1.1,face,,admin,now(),admin,now()
146117,mpartner-default-digitalcard,mpolicy-default-PDFCard,individualBiometrics,mock,1.1,iris,,admin,now(),admin,now()
146118,mpartner-default-digitalcard,mpolicy-default-PDFCard,individualBiometrics,mock,1.1,finger,,admin,now(),admin,now()
2 changes: 1 addition & 1 deletion db_scripts/mosip_pms/dml/pms-partner_type.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FTM_Provider,FTM Provider,TRUE,superadmin,now(),FALSE
Online_Verification_Partner,Online_Verification_Partner,TRUE,superadmin,now(),TRUE
ABIS_Partner,ABIS Partner,TRUE,superadmin,now(),TRUE
Manual_Adjudication,Manual Adjudication,TRUE,superadmin,now(),TRUE
MISP_Partner,MISP_Partner,TRUE,superadmin,now(),TRUE
MISP_Partner,MISP_Partner,TRUE,superadmin,now(),FALSE
Internal_Partner,Used internally to share certs,TRUE,superadmin,now(),TRUE
SDK_Partner,SDK Partner,TRUE,superadmin,now(),FALSE
Print_Partner,Print Partner,TRUE,superadmin,now(),TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import javax.annotation.PostConstruct;

import io.mosip.pms.oidc.client.contant.ClientServiceAuditEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -341,4 +342,43 @@ private void handlException(HttpStatusCodeException ex) {

}

public void setAuditRequestDto(ClientServiceAuditEnum clientServiceAuditEnum, String refId, String refIdType) {
AuditRequestDto auditRequestDto = new AuditRequestDto();
auditRequestDto.setHostIp(hostIpAddress);
auditRequestDto.setHostName(hostName);;
auditRequestDto.setApplicationId(clientServiceAuditEnum.getApplicationId());
auditRequestDto.setApplicationName(clientServiceAuditEnum.getApplicationName());
auditRequestDto.setSessionUserId(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setSessionUserName(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setCreatedBy(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setActionTimeStamp(DateUtils.getUTCCurrentDateTime());
auditRequestDto.setDescription(clientServiceAuditEnum.getDescription());
auditRequestDto.setEventType(clientServiceAuditEnum.getType());
auditRequestDto.setEventName(clientServiceAuditEnum.getName());
auditRequestDto.setModuleId(clientServiceAuditEnum.getModuleId());
auditRequestDto.setModuleName(clientServiceAuditEnum.getModuleName());
auditRequestDto.setEventId(clientServiceAuditEnum.getEventId());
auditRequestDto.setId(refId);
auditRequestDto.setIdType(refIdType);
callAuditManager(auditRequestDto);
}

public void setAuditRequestDto(ClientServiceAuditEnum clientServiceAuditEnum) {
AuditRequestDto auditRequestDto = new AuditRequestDto();
auditRequestDto.setHostIp(hostIpAddress);
auditRequestDto.setHostName(hostName);;
auditRequestDto.setApplicationId(clientServiceAuditEnum.getApplicationId());
auditRequestDto.setApplicationName(clientServiceAuditEnum.getApplicationName());
auditRequestDto.setSessionUserId(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setSessionUserName(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setCreatedBy(SecurityContextHolder.getContext().getAuthentication().getName());
auditRequestDto.setActionTimeStamp(DateUtils.getUTCCurrentDateTime());
auditRequestDto.setDescription(clientServiceAuditEnum.getDescription());
auditRequestDto.setEventType(clientServiceAuditEnum.getType());
auditRequestDto.setEventName(clientServiceAuditEnum.getName());
auditRequestDto.setModuleId(clientServiceAuditEnum.getModuleId());
auditRequestDto.setModuleName(clientServiceAuditEnum.getModuleName());
auditRequestDto.setEventId(clientServiceAuditEnum.getEventId());
callAuditManager(auditRequestDto);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package io.mosip.pms.oidc.client.contant;

import io.mosip.pms.partner.manager.constant.AuditConstant;

public enum ClientServiceAuditEnum {

CREATE_CLIENT("PMS_PRT_300", AuditConstant.AUDIT_SYSTEM, "POST CREATE OIDC CLIENT",
"Creating the OIDC Client", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID),
CREATE_CLIENT_SUCCESS("PMS_PRT_301", AuditConstant.AUDIT_SYSTEM, "POST CREATE OIDC CLIENT",
"Creating the OIDC Client Success", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID),
CREATE_CLIENT_FAILURE("PMS_PRT_302", AuditConstant.AUDIT_SYSTEM, "POST CREATE OIDC CLIENT",
"Creating the OIDC Client Failed", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID),
UPDATE_CLIENT("PMS_PRT_303", AuditConstant.AUDIT_SYSTEM, "PUT UPDATE OIDC CLIENT",
"Updating OIDC Client", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID),
UPDATE_CLIENT_SUCCESS("PMS_PRT_304", AuditConstant.AUDIT_SYSTEM, "PUT UPDATE OIDC CLIENT",
"Updating OIDC Client Success", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID),
UPDATE_CLIENT_FAILURE("PMS_PRT_305", AuditConstant.AUDIT_SYSTEM, "PUT UPDATE OIDC CLIENT",
"Updating OIDC Client Failed", AuditConstant.PARTNER_MODULE_ID, AuditConstant.PARTNER_MODULE_NAME, "NO_ID",
"NO_ID_TYPE", AuditConstant.APPLICATION_NAME, AuditConstant.APPLICATION_ID);

private final String eventId;

private final String type;

private String name;

private String description;

private String moduleId;

private String moduleName;

private String id;

private String idType;

private String applicationId;

private String applicationName;

public String getEventId() {
return eventId;
}

public String getType() {
return type;
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

public String getModuleId() {
return moduleId;
}

public String getModuleName() {
return moduleName;
}

public String getId() {
return id;
}

public String getIdType() {
return idType;
}

public String getApplicationId() {
return applicationId;
}

public String getApplicationName() {
return applicationName;
}

ClientServiceAuditEnum(String eventId, String type, String name, String description, String moduleId,
String moduleName, String id, String idType, String applicationId, String applicationName) {
this.eventId = eventId;
this.type = type;
this.name = name;
this.description = description;
this.moduleId = moduleId;
this.moduleName = moduleName;
this.id = id;
this.idType = idType;
this.applicationId = applicationId;
this.applicationName = applicationName;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package io.mosip.pms.oidc.client.controller;

import io.mosip.pms.device.util.AuditUtil;
import io.mosip.pms.oidc.client.contant.ClientServiceAuditEnum;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import io.mosip.pms.common.request.dto.RequestWrapper;
Expand All @@ -22,11 +26,16 @@ public class ClientManagementController {
@Autowired
ClientManagementService clientManagementService;

@Autowired
AuditUtil auditUtil;


@RequestMapping(value = "/oidc/client", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseWrapper<ClientDetailResponse> createClient(
@Valid @RequestBody RequestWrapper<ClientDetailCreateRequest> requestWrapper) throws Exception {
var clientRespDto = clientManagementService.createOIDCClient(requestWrapper.getRequest());
var response = new ResponseWrapper<ClientDetailResponse>();
auditUtil.setAuditRequestDto(ClientServiceAuditEnum.CREATE_CLIENT,requestWrapper.getRequest().getName(),"clientID");
response.setResponse(clientRespDto);
return response;
}
Expand All @@ -36,6 +45,7 @@ public ResponseWrapper<ClientDetailResponse> updateClient(@PathVariable("client_
@Valid @RequestBody RequestWrapper<ClientDetailUpdateRequest> requestWrapper) throws Exception {
var clientRespDto = clientManagementService.updateOIDCClient(clientId, requestWrapper.getRequest());
var response = new ResponseWrapper<ClientDetailResponse>();
auditUtil.setAuditRequestDto(ClientServiceAuditEnum.UPDATE_CLIENT, clientId, "clientID");
response.setResponse(clientRespDto);
return response;
}
Expand Down
Loading

0 comments on commit c8f269c

Please sign in to comment.