diff --git a/mds-test-ui/README.md b/mds-test-ui/README.md
index 6222a1d..3c846d4 100644
--- a/mds-test-ui/README.md
+++ b/mds-test-ui/README.md
@@ -1,29 +1,45 @@
-# MdsTestUi
-
-This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.1.
-
-Change url to point to spring boot server in environments/environment.ts file. Currently it is set to base_url: 'http://localhost:8080/'
-
-## Development server
-
-Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
-
-## Code scaffolding
-
-Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
-
-## Build
-
-Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
-
-## Running unit tests
-
-Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
-
-## Running end-to-end tests
-
-Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
-
-## Further help
-
-To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
+# SBITestUi
+
+This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.1.
+
+Change url to point to spring boot server in environments/environment.ts file. Currently it is set to base_url: 'http://localhost:8081/'
+
+NodeJs is prerequisite
+
+## Local Set up one time
+
+Run `npm install` to download all the required configuration. `node_modules` will be created.
+
+## Development server
+
+Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+
+## Code scaffolding
+
+Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
+
+## Build
+
+Since it is added inside java project and deployed together as one build, follow below step.
+
+In 'environment.prod.ts' make below changes and revert after build is done.
+base_url: 'http://test.mosip.io/phase2/',
+
+In 'index.html' make below changes and revert after build is done.
+
+
+Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
+Run `ng build --prod`
+Files inside `dist/` should be trasfered to mosip device service
+
+## Running unit tests
+
+Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
+
+## Running end-to-end tests
+
+Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
+
+## Further help
+
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/mds-test-ui/src/app/app.module.ts b/mds-test-ui/src/app/app.module.ts
index 6201078..06bbb79 100644
--- a/mds-test-ui/src/app/app.module.ts
+++ b/mds-test-ui/src/app/app.module.ts
@@ -19,6 +19,7 @@ import { FooterComponent } from './components/footer/footer.component';
import { MatVideoModule } from 'mat-video';
import { ModalComponent } from './modal/modal.component';
import { DialogOverviewExampleDialog} from './auth/auth.component'
+import { DialogOverviewCaptureDialog} from './capture/capture.component'
@NgModule({
declarations: [
@@ -31,7 +32,8 @@ import { DialogOverviewExampleDialog} from './auth/auth.component'
HeaderComponent,
FooterComponent,
ModalComponent,
- DialogOverviewExampleDialog
+ DialogOverviewExampleDialog,
+ DialogOverviewCaptureDialog
],
imports: [
BrowserModule,
diff --git a/mds-test-ui/src/app/auth/auth.compnent.html b/mds-test-ui/src/app/auth/auth.compnent.html
index be10600..e81ff8b 100644
--- a/mds-test-ui/src/app/auth/auth.compnent.html
+++ b/mds-test-ui/src/app/auth/auth.compnent.html
@@ -7,7 +7,7 @@
Authentication
Enter UIN
-
* Default UIN is 6027349120, Provide your UIN to authenticate
+
* Default UIN is {{data.uin}}, Provide your UIN to authenticate
+ 1) Check with Valid certificate.
+ 2) Wait for certificate to expire.Then test with expired certificate.
+ 3) Key Rotate and then test after key rotation.
+
+
+
+
-
-
+
-
-
+
-
-
+
+
-
+
-
- Start Streaming
+
+ Start Streaming
{{getButtonName(testReportObject.testReport[key].requestData)}}
- Enter UIN & Authenticate
-
+ Enter UIN &
+ Authenticate
- check With valid certificate
- check with expired certificate
- check after key rotation
-
-
-
+
Download
diff --git a/mds-test-ui/src/app/components/run/run.component.ts b/mds-test-ui/src/app/components/run/run.component.ts
index 0245695..7cbdde5 100644
--- a/mds-test-ui/src/app/components/run/run.component.ts
+++ b/mds-test-ui/src/app/components/run/run.component.ts
@@ -10,7 +10,9 @@ import { DomSanitizer } from '@angular/platform-browser';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ModalComponent } from '../../modal/modal.component';
-import { DialogOverviewExampleDialog } from '../../auth/auth.component'
+import { DialogOverviewExampleDialog } from '../../auth/auth.component';
+import { DialogOverviewCaptureDialog } from '../../capture/capture.component'
+
declare const start_streaming: any;
declare const stop_streaming: any;
@@ -25,10 +27,12 @@ export class RunComponent implements OnInit {
uin: string;
testId: string;
testReportObject1: any;
+ timeOut:any;
+ requestScore:any;
+ previousHash:any;
+ keyRotatOrderIdList = [3011, 3012, 3013];
- keyRotatOrderIdList = [11, 12, 13];
-
- keyRotatOrderIdListRcapture = [14];
+ keyRotatOrderIdListRcapture = [3014];
successErrorCodeOfAuth = "IDA-BIA-001";
succesAuth = "authStatus=true";
failErrorCodeOfAuth = "IDA-MPA-002";
@@ -138,8 +142,7 @@ export class RunComponent implements OnInit {
getMDSResponse(request, runId, testId, status) {
- this.loading = true;
- this.statusButton = true;
+ this.statusButton = true;
if (status == 'Ready') {
this.readyButton = true;
} else if (status == 'Not Ready') {
@@ -158,6 +161,17 @@ export class RunComponent implements OnInit {
let mdmResponse = this.testReportObject.testReport[testId].responseData;
+ let method = JSON.parse(request).verb;
+
+ if((method === "CAPTURE" || method==="RCAPTURE") && status == null)
+ this.openCaptureDataDialog(this.testReportObject,testId,request);
+ else
+ this.otherInitate(testId, request, runId, status);
+ }
+
+ private otherInitate(testId: any, request: any, runId: any, status: any) {
+ this.loading = true;
+
if (this.mdmInitiated === true) {
console.log("MDM request is currently going on .....");
}
@@ -495,6 +509,26 @@ export class RunComponent implements OnInit {
});
}
+
+
+ openCaptureDataDialog(testReportObject1: any, key: any,request:any): void {
+ this.testReportObject1 = testReportObject1;
+ this.testId = key;
+ const dialogRef = this.dialog.open(DialogOverviewCaptureDialog, {
+ width: '300px',
+ data: { timeOut: this.timeOut,
+ requestScore:this.requestScore,
+ previousHash:this.previousHash,
+ testReportObject1:this.testReportObject1,
+ testId: this.testId ,
+ request:request}
+ });
+ dialogRef.afterClosed().subscribe(result => {
+ console.log('The dialog was closed');
+ this.uin = result;
+ });
+ }
+
download(runId, testId) {
this.loading = true;
diff --git a/mds-test-ui/src/environments/environment.prod.ts b/mds-test-ui/src/environments/environment.prod.ts
index 2baf8d7..62350b7 100644
--- a/mds-test-ui/src/environments/environment.prod.ts
+++ b/mds-test-ui/src/environments/environment.prod.ts
@@ -1,5 +1,5 @@
export const environment = {
production: true,
- base_url: 'http://test.mosip.io/phase2',
- mds_url: 'http://test.mosip.io:'
+ base_url: 'https://test.mosip.io/phase2',
+ mds_url: 'https://test.mosip.io:'
};
diff --git a/mosip-device-service/README.md b/mosip-device-service/README.md
new file mode 100644
index 0000000..4d1ae3d
--- /dev/null
+++ b/mosip-device-service/README.md
@@ -0,0 +1,34 @@
+# SBI Testing Kit
+
+This module contains SBI Testing Kit. Which will validate response from MOSIP Device service implementation as per defined [SPEC](https://docs.mosip.io/platform/biometrics/mosip-device-service-specification)
+
+Device specification can be found in /data/config/masterdata.json
+
+Test case details can be found in /data/config/test-definitions.json
+Any new Test cases needed should be updated in above file in json format.
+
+MISP license,partner Id and partner API key should be updated in application.properties for Auth validations
+
+Java 11 is a prerequisite
+
+### Supported SPEC versions
+
+0.9.5
+
+### Defaults
+
+server.port=8081
+
+### Build and run
+
+If any updates in the UI place the build files in the /src/main/resources/static/
+
+Execute the below command to build module
+
+> mvn clean install
+
+Deployable jar file will be created inside target folder. 'test-definitions.json' should be updated in the server
+
+otherwise, we could simply run Main class
+
+> io.mosip.mds.MosipDeviceSpecificationApplication
\ No newline at end of file
diff --git a/mosip-device-service/data/config/test-definitions.json b/mosip-device-service/data/config/test-definitions.json
index 6fbebab..3840727 100644
--- a/mosip-device-service/data/config/test-definitions.json
+++ b/mosip-device-service/data/config/test-definitions.json
@@ -892,7 +892,7 @@
,
{
"testId": "Registration capture -Key Rotation - Left Slab",
- "testOrderId":14,
+ "testOrderId":3014,
"method": "rcapture",
"testDescription": "Key Rotation Registration capture Request for Slap scanner",
"requestGenerator": null,
@@ -921,7 +921,7 @@
},
{
"testId": "Auth capture -Key Rotation - Single Iris - Left Iris",
- "testOrderId":12,
+ "testOrderId":3012,
"method": "capture",
"testDescription": "Valid Auth capture Key Rotation Request for Left iris",
"requestGenerator": null,
@@ -949,7 +949,7 @@
]
}, {
"testId": "Auth capture -Key Rotation - LeftIndex Finger",
- "testOrderId":11,
+ "testOrderId":3011,
"method": "capture",
"testDescription": "Key Rotation Auth capture Request for LeftIndex Finger",
"requestGenerator": null,
@@ -977,8 +977,8 @@
]
},
{
- "testId": "Auth capture - Face",
- "testOrderId":13,
+ "testId": "Auth capture -Key Rotation - Face",
+ "testOrderId":3013,
"method": "capture",
"testDescription": "Valid Auth capture Request only for Face",
"requestGenerator": null,
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest.java b/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest.java
index 9caf617..b1c75f1 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest.java
@@ -19,7 +19,7 @@ public static class RegistrationCaptureBioRequest
public String env; //target environment
public String purpose;
public String specVersion; //expected MDS spec version
- public int timeout; //timeout for registration capture
+ public String timeout; //timeout for registration capture
public String captureTime; //time of capture request in ISO format including timezone
public String transactionId; //registration Id for the current capture
public RegistrationCaptureBioRequest[] bio;
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest_0_9_2.java b/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest_0_9_2.java
index 97ac91d..19d53ec 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest_0_9_2.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/dto/RegistrationCaptureRequest_0_9_2.java
@@ -17,7 +17,7 @@ public class RegistrationCaptureBioRequest_0_9_2
public String env; //target environment
public String specVersion; //expected MDS spec version
- public Integer timeout; //timeout for registration capture
+ public String timeout; //timeout for registration capture
public String captureTime; //time of capture request in ISO format including timezone
public String registrationId; //registration Id for the current capture
public RegistrationCaptureBioRequest_0_9_2[] bio;
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_2_RequestBuilder.java b/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_2_RequestBuilder.java
index 5212007..f6aecc5 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_2_RequestBuilder.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_2_RequestBuilder.java
@@ -130,7 +130,7 @@ private String registrationCapture(TestDefinition test, DeviceDto device) throws
requestBody.env = "test";
//requestBody.purpose = "AUTHENTICATION";
requestBody.specVersion = "0.9.2";
- requestBody.timeout = 30;
+ requestBody.timeout = "30";
requestBody.registrationId = "" + System.currentTimeMillis();
RegistrationCaptureRequest_0_9_2.RegistrationCaptureBioRequest_0_9_2 bio = requestBody.new RegistrationCaptureBioRequest_0_9_2();
bio.count = 1;
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_5_RequestBuilder.java b/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_5_RequestBuilder.java
index 7fe3135..b4512a0 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_5_RequestBuilder.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/service/MDS_0_9_5_RequestBuilder.java
@@ -192,7 +192,7 @@ private String getRegistrationCaptureRequest(TestManagerDto targetProfile, TestD
requestBody.env = "Developer";
requestBody.purpose = "Registration";
requestBody.specVersion = "0.9.5";
- requestBody.timeout = 10000;
+ requestBody.timeout = "10000";
requestBody.transactionId = "" + System.currentTimeMillis();
requestBody.bio = new RegistrationCaptureRequest.RegistrationCaptureBioRequest[1];
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/util/BioAuthRequestUtil.java b/mosip-device-service/src/main/java/io/mosip/mds/util/BioAuthRequestUtil.java
index 83b4ec1..2a5cabe 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/util/BioAuthRequestUtil.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/util/BioAuthRequestUtil.java
@@ -79,27 +79,9 @@
@Component
public class BioAuthRequestUtil {
- @Autowired
- private ObjectMapper objMapper;
-
private static final Logger logger = LoggerFactory.getLogger(BioAuthRequestUtil.class);
private static String AUTH_REQ_TEMPLATE = "{ \"id\": \"string\",\"metadata\": {},\"request\": { \"appId\": \"%s\", \"clientId\": \"%s\", \"secretKey\": \"%s\" }, \"requesttime\": \"%s\", \"version\": \"string\"}";
- private static String SIGN_REQ_TEMPLATE = "{\r\n" +
- " \"id\": \"string\",\r\n" +
- " \"metadata\": {},\r\n" +
- " \"request\": {\r\n" +
- " \"applicationId\": \"IDA\",\r\n" +
- " \"dataToSign\": \"%s\",\r\n" +
- " \"includeCertHash\": true,\r\n" +
- " \"includeCertificate\": true,\r\n" +
- " \"includePayload\": false,\r\n" +
- " \"referenceId\": \"SIGN\"\r\n" +
- " },\r\n" +
- " \"requesttime\": \"%s\",\r\n" +
- " \"version\": \"string\"\r\n" +
- "}";
-
private static final String VERSION = "1.0";
private static final String UIN = "UIN";
private static final String TRANSACTION_ID = "1234567890";
@@ -250,30 +232,6 @@ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttp
return restTemplate;
}
- private String doAuthRequest(String authToken, Map authRequestMap) throws Exception {
- try {
- String reqBodyJson = mapper.writeValueAsString(authRequestMap);
- OkHttpClient client = new OkHttpClient();
- MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
- RequestBody body = RequestBody.create(mediaType, reqBodyJson);
- Request request = new Request.Builder()
- //curl -X POST "https://dev.mosip.net/v1/keymanager/sign" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"id\": \"string\", \"metadata\": {}, \"request\": { \"data\": \"string\" }, \"requesttime\": \"2018-12-10T06:12:52.994Z\", \"version\": \"string\"}"
- .header("signature", sign(CryptoUtil.encodeBase64(reqBodyJson.getBytes("UTF-8"))
- ))
- .header( "Authorization" , authToken)
- .url(String.format(env.getProperty("ida.auth.url"), env.getProperty("auth.request.misplicense.key"),
- env.getProperty("auth.request.partnerid"), env.getProperty("auth.request.partnerapi.key")))
- .post(body)
- .build();
- Response idaResponse = client.newCall(request).execute();
- return idaResponse.body().string();
-
- } catch (IOException | JSONException e) {
- logger.error("Failed to fetch cert from IDA auth server", e);
- }
- return "Failed to get auth response !";
- }
-
private EncryptionResponseDto kernelEncrypt(EncryptionRequestDto encryptionRequestDto, X509Certificate certificate)
throws Exception {
EncryptionResponseDto encryptionResponseDto = new EncryptionResponseDto();
@@ -295,22 +253,6 @@ private EncryptionResponseDto kernelEncrypt(EncryptionRequestDto encryptionReque
return encryptionResponseDto;
}
- private EncryptionResponseDto kernelEncrypt1(EncryptionRequestDto encryptionRequestDto, X509Certificate x509Cert) throws Exception {
- String identityBlock = objMapper.writeValueAsString(encryptionRequestDto.getIdentityRequest());
- SecretKey secretKey = cryptoUtil.genSecKey();
- EncryptionResponseDto encryptionResponseDto = new EncryptionResponseDto();
- byte[] encryptedIdentityBlock = cryptoUtil.symmetricEncrypt(identityBlock.getBytes(StandardCharsets.UTF_8),
- secretKey);
- encryptionResponseDto.setEncryptedIdentity(Base64.encodeBase64URLSafeString(encryptedIdentityBlock));
- PublicKey publicKey = x509Cert.getPublicKey();
- byte[] encryptedSessionKeyByte = cryptoUtil.asymmetricEncrypt((secretKey.getEncoded()), publicKey);
- encryptionResponseDto.setEncryptedSessionKey(Base64.encodeBase64URLSafeString(encryptedSessionKeyByte));
- byte[] byteArr = cryptoUtil.symmetricEncrypt(digestAsPlainText(HMACUtils2.generateHash(identityBlock.getBytes(StandardCharsets.UTF_8))).getBytes(),
- secretKey);
- encryptionResponseDto.setRequestHMAC(Base64.encodeBase64URLSafeString(byteArr));
- return encryptionResponseDto;
- }
-
public static String digestAsPlainText(byte[] data) {
return DatatypeConverter.printHexBinary(data).toUpperCase();
}
@@ -323,28 +265,6 @@ private X509Certificate getCertificateFull(String authToken, String role) throws
return x509Certificate;
}
- //Depriciated
- private String getJWTSignedData(String data, String authToken) throws IOException, JSONException {
- OkHttpClient client = new OkHttpClient();
- String requestBody = String.format(SIGN_REQ_TEMPLATE,
- data, DateUtils.getUTCCurrentDateTime());
-
- MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
- RequestBody body = RequestBody.create(mediaType, requestBody);
- Request request = new Request.Builder()
- .header("cookie", "Authorization="+authToken)
- .url(env.getProperty("internal.auth.jwtSign.url"))
- .post(body)
- .build();
- Response response = client.newCall(request).execute();
- if(response.isSuccessful()) {
- JSONObject jsonObject = new JSONObject(response.body().string());
- jsonObject = jsonObject.getJSONObject("response");
- return jsonObject.getString("jwtSignedData");
- }
- return "";
- }
-
public String getAuthToken() throws IOException {
OkHttpClient client = new OkHttpClient();
String requestBody = String.format(AUTH_REQ_TEMPLATE,
diff --git a/mosip-device-service/src/main/java/io/mosip/mds/validator/ValidValueRCaptureResponseValidator.java b/mosip-device-service/src/main/java/io/mosip/mds/validator/ValidValueRCaptureResponseValidator.java
index dca3978..4683797 100644
--- a/mosip-device-service/src/main/java/io/mosip/mds/validator/ValidValueRCaptureResponseValidator.java
+++ b/mosip-device-service/src/main/java/io/mosip/mds/validator/ValidValueRCaptureResponseValidator.java
@@ -325,16 +325,16 @@ else if(biometrics[bioIndex].dataDecoded.bioType.equals(CommonConstant.FACE)) {
validations.add(validation);
bioIndex++;
}
- if(biometrics[bioIndex].dataDecoded.bioType.equals(CommonConstant.IRIS)) {
-
- validation = commonValidator.setFieldExpected("dataDecoded.bioSubType",subType,biometrics[bioIndex].dataDecoded.bioSubType);
- if(!biometrics[bioIndex].dataDecoded.bioSubType.equals(subType)
- && !bioSubTypeIrisList.contains(biometrics[bioIndex].dataDecoded.bioSubType)) {
- commonValidator.setFoundMessageStatus(validation,biometrics[bioIndex].dataDecoded.bioSubType,"invalid biometrics SubType returned",CommonConstant.FAILED);
- }
- validations.add(validation);
- bioIndex++;
- }
+// if(biometrics[bioIndex].dataDecoded.bioType.equals(CommonConstant.IRIS)) {
+//
+// validation = commonValidator.setFieldExpected("dataDecoded.bioSubType",subType,biometrics[bioIndex].dataDecoded.bioSubType);
+// if(!biometrics[bioIndex].dataDecoded.bioSubType.equals(subType)
+// && !bioSubTypeIrisList.contains(biometrics[bioIndex].dataDecoded.bioSubType)) {
+// commonValidator.setFoundMessageStatus(validation,biometrics[bioIndex].dataDecoded.bioSubType,"invalid biometrics SubType returned",CommonConstant.FAILED);
+// }
+// validations.add(validation);
+// bioIndex++;
+// }
}
}