Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 878fe1f
Author: pvsaidurga <saidurgacsea@gmail.com>
Date:   Mon Jan 27 20:37:05 2025 +0530

    Added db upgrade script (mosip#330)

    Signed-off-by: pvsaidurga <saidurgacsea@gmail.com>

commit 5fca13c
Author: pvsaidurga <saidurgacsea@gmail.com>
Date:   Wed Jan 22 18:30:52 2025 +0530

    Added db upgrade and rollback scripts (mosip#325)

    Signed-off-by: pvsaidurga <saidurgacsea@gmail.com>

commit 8551a32
Merge: c55e1b9 d6be9c3
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Tue Jan 21 16:47:47 2025 +0530

    Merge pull request mosip#320 from kaifk468/release-0.10.1-temp

    modified schema

commit d6be9c3
Author: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
Date:   Tue Jan 21 14:51:26 2025 +0530

    modified signup-schema to handle empty full name

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit c55e1b9
Author: Sachin Rana <sacrana324@gmail.com>
Date:   Tue Jan 21 11:59:29 2025 +0530

    changed lazy loading to eagerly loading of schema [ES-2153, ES-2155] (mosip#321)

    * changed lazy loading to eagerly loading of schema

    Signed-off-by: Sachin Rana <sacrana324@gmail.com>

    * removed annotation which was not required

    Signed-off-by: Sachin Rana <sacrana324@gmail.com>

    ---------

    Signed-off-by: Sachin Rana <sacrana324@gmail.com>

commit 8c6b8ab
Author: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
Date:   Mon Jan 20 19:02:41 2025 +0530

    modified schema

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit 02fa4ca
Merge: 3732906 eda270a
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Mon Jan 20 18:02:27 2025 +0530

    Merge pull request mosip#318 from kaifk468/release-0.10.1-temp

    modified validation schama

commit eda270a
Author: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
Date:   Mon Jan 20 15:56:35 2025 +0530

    modified validation schama

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit 3732906
Merge: 3924627 9eeddb5
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Mon Jan 20 10:27:45 2025 +0530

    Merge pull request mosip#316 from pvsaidurga/patch-2

    Update mock-identity-signup-schema.json[ES-1911]

commit 9eeddb5
Author: pvsaidurga <saidurgacsea@gmail.com>
Date:   Sun Jan 19 22:30:23 2025 +0530

    Update mock-identity-signup-schema.json[ES-1911]

    Signed-off-by: pvsaidurga <saidurgacsea@gmail.com>

commit 3924627
Merge: eeb6ab1 6dced2c
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Fri Jan 17 09:41:49 2025 +0530

    Merge pull request mosip#315 from ase-101/release-0.10.1-temp

    updating vulnerable libraries (mosip#304)

commit 6dced2c
Author: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
Date:   Mon Jan 6 17:37:50 2025 +0530

    updating vulnerable libraries (mosip#304)

    * fix: mock-identity-system/pom.xml to reduce vulnerabilities

    The following vulnerabilities are fixed with an upgrade:
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORK-2436751
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3152153
    - https://snyk.io/vuln/SNYK-JAVA-ORGHIBERNATE-1041788
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORKBOOT-5441321
    - https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-3038424
    - https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-3038426
    - https://snyk.io/vuln/SNYK-JAVA-ORGAPACHETOMCATEMBED-6435950
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-2806360
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-6056527
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORKSECURITY-2833360
    - https://snyk.io/vuln/SNYK-JAVA-ORGGLASSFISH-1297098
    - https://snyk.io/vuln/SNYK-JAVA-COMGOOGLECODEGSON-1730327
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORK-5422217
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3016891
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORKSECURITY-8399273
    - https://snyk.io/vuln/SNYK-JAVA-ORGHIBERNATEVALIDATOR-6247635
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3016888
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORK-2434828
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORK-2823313
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORK-3369749
    - https://snyk.io/vuln/SNYK-JAVA-ORGSPRINGFRAMEWORKBOOT-6226862
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3016889
    - https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3113851

    Signed-off-by: rajapandi.m <rajapandi.m@technoforte.co.in>

    * fix: mock-relying-party-ui/package.json & mock-relying-party-ui/package-lock.json to reduce vulnerabilities

    The following vulnerabilities are fixed with an upgrade:
    - https://snyk.io/vuln/SNYK-JS-FOLLOWREDIRECTS-6141137
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6032459
    - https://snyk.io/vuln/SNYK-JS-FOLLOWREDIRECTS-6444610
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6124857
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6671926

    Signed-off-by: rajapandi.m <rajapandi.m@technoforte.co.in>

    * fix: mock-relying-party-service/package.json & mock-relying-party-service/package-lock.json to reduce vulnerabilities

    The following vulnerabilities are fixed with an upgrade:
    - https://snyk.io/vuln/SNYK-JS-PATHTOREGEXP-8482416
    - https://snyk.io/vuln/SNYK-JS-SEMVER-3247795
    - https://snyk.io/vuln/SNYK-JS-FOLLOWREDIRECTS-6141137
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6032459
    - https://snyk.io/vuln/SNYK-JS-PATHTOREGEXP-7925106
    - https://snyk.io/vuln/SNYK-JS-FOLLOWREDIRECTS-6444610
    - https://snyk.io/vuln/SNYK-JS-BODYPARSER-7926860
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6144788
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6124857
    - https://snyk.io/vuln/SNYK-JS-COOKIE-8163060
    - https://snyk.io/vuln/SNYK-JS-EXPRESS-6474509
    - https://snyk.io/vuln/SNYK-JS-SIDEWAYFORMULA-3317169
    - https://snyk.io/vuln/SNYK-JS-AXIOS-6671926
    - https://snyk.io/vuln/SNYK-JS-JOSE-6419224
    - https://snyk.io/vuln/SNYK-JS-EXPRESS-7926867
    - https://snyk.io/vuln/SNYK-JS-SEND-7926862
    - https://snyk.io/vuln/SNYK-JS-SERVESTATIC-7926865

    Signed-off-by: rajapandi.m <rajapandi.m@technoforte.co.in>

    * Update pom.xml

    Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>

    ---------

    Signed-off-by: rajapandi.m <rajapandi.m@technoforte.co.in>
    Signed-off-by: rajapandi1234 <138785181+rajapandi1234@users.noreply.github.com>
    Co-authored-by: snyk-bot <snyk-bot@snyk.io>

commit eeb6ab1
Author: Md Humair Kankudti <mdhumair.kankudti@gmail.com>
Date:   Fri Jan 17 00:08:54 2025 +0530

    pom version changes (mosip#314)

    Signed-off-by: Md-Humair-KK <mdhumair.kankudti@gmail.com>

commit 3342eb7
Merge: 8793bb8 f17d4e9
Author: ase-101 <sunkadaeanusha@gmail.com>
Date:   Fri Jan 17 00:05:35 2025 +0530

    Merge pull request mosip#310 from kaifk468/release-0.10.1-temp

    Release 0.10.1 temp

commit f17d4e9
Author: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
Date:   Thu Jan 16 15:31:48 2025 +0530

    remove kba field

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit e408ceb
Author: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
Date:   Thu Jan 16 12:11:11 2025 +0530

    added mock-identity-signup-schema.json for validation

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit 8793bb8
Merge: 6b30341 cc64d1b
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Thu Jan 16 11:11:18 2025 +0530

    Merge pull request mosip#313 from gk-4VII/collab_bug_release151

    [ES-1918] responsive userprofile screen.

commit cc64d1b
Author: GurukiranP <talk2gurukiran@gmail.com>
Date:   Thu Jan 16 11:06:16 2025 +0530

    [ES-1918] responsive userprofile screen.

    Signed-off-by: GurukiranP <talk2gurukiran@gmail.com>

commit 6b30341
Merge: 311dabe 7e4d4de
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Thu Jan 16 09:42:05 2025 +0530

    Merge pull request mosip#311 from Infosys/release-0.10.1-temp

    [ES-1976] Added error codes

commit 7e4d4de
Author: pvsaidurga <saidurgacsea@gmail.com>
Date:   Mon Jan 13 17:43:18 2025 +0530

    [ES-1976] Added error codes

    Signed-off-by: pvsaidurga <saidurgacsea@gmail.com>

commit be79efa
Author: Kaif Siddique <74772315+kaifk468@users.noreply.github.com>
Date:   Sat Dec 28 21:29:05 2024 +0530

    Added identity schema validation details in readme fileDevelop readme (mosip#306)

    * added identiyt schema validation in readme file

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

    * update default properites

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

    ---------

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
    Co-authored-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit edaa0ed
Author: Kaif Siddique <74772315+kaifk468@users.noreply.github.com>
Date:   Mon Dec 23 21:51:22 2024 +0530

    added schema url in properties (mosip#305)

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>
    Co-authored-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit 7ce06cd
Author: Kaif Siddique <74772315+kaifk468@users.noreply.github.com>
Date:   Sun Dec 22 16:13:27 2024 +0530

    resolve conflict in properties file

    Signed-off-by: Mohd Kaif Siddique <mohdkaif.siddique@ad.infosys.com>

commit 311dabe
Merge: 0c1fd63 cf0156f
Author: Aravindhan Alagesan <aravindh2090@gmail.com>
Date:   Wed Jan 15 16:55:18 2025 +0530

    Merge pull request mosip#309 from gk-4VII/bugs_release151

    merge of all 1.5.1 related bug fixes.

commit cf0156f
Author: Zeeshan Mehboob <zeeshan.mehboob@infosys.com>
Date:   Thu Dec 19 20:41:15 2024 +0530

    merge of all 1.5.1 related bug fixes.

    Signed-off-by: GurukiranP <talk2gurukiran@gmail.com>

Signed-off-by: Zeeshan Mehboob <zeeshan.mehboob@infosys.com>
  • Loading branch information
zesu22 committed Jan 30, 2025
1 parent 851d773 commit 2802a2b
Show file tree
Hide file tree
Showing 38 changed files with 1,893 additions and 718 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Rollback Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Alter the `identity_json` column to be of type `VARCHAR` without a length limit
ALTER TABLE mockidentitysystem.mock_identity
ALTER COLUMN identity_json TYPE VARCHAR;
17 changes: 17 additions & 0 deletions mock-identity-system/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,20 @@ Refer to [SQL scripts](../db_scripts)
## License
This project is licensed under the terms of [Mozilla Public License 2.0](../LICENSE).
## Identity Schema Validation
Mock-identity-system implements a JSON schema validation system for identity data.
This validation ensures that the provided Identity data adhere to the defined schema.
````
mosip.mock.ida.identity.schema.url=classpath:/mock-identity-schema.json
mosip.mock.ida.update-identity.non-mandatory.fields={"givenName","familyName","middleName","nickName","preferredUsername","gender","streetAddress","locality","region","country","pin","preferredLang","dateOfBirth","postalCode","encodedPhoto","email","phone","zoneInfo","locale","password"}
````
How It Works
* For create operations:
1. The system validates all fields present in the identity data against the schema defined in mock-identity-schema.json.
2. All fields, including non-mandatory ones, are required.
* For update operations:
1. The system first validates all mandatory fields against the main schema.
2. Non-mandatory fields specified in mosip.mock.ida.update-identity.non-mandatory.fields are ignored during validation.
3. If the non-mandatory fields are present, they are validated against the schema.
43 changes: 39 additions & 4 deletions mock-identity-system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>io.mosip.esignet.mock</groupId>
<artifactId>esignet-mock-parent</artifactId>
<version>0.10.0</version>
<version>0.10.1-SNAPSHOT</version>
</parent>

<artifactId>mock-identity-system</artifactId>
<version>0.10.0</version>
<version>0.10.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>mock-identity-system</name>
Expand All @@ -36,7 +36,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<swagger.version>2.9.2</swagger.version>
<springdoc.version>1.5.10</springdoc.version>
<springdoc.version>1.8.0</springdoc.version>
<doclint>none</doclint>

<!-- Maven -->
Expand All @@ -62,7 +62,7 @@
<logback.version>1.2.3</logback.version>
<h2-database-engine.version>1.4.200</h2-database-engine.version>

<springdoc.version>1.6.9</springdoc.version>
<springdoc.version>1.8.0</springdoc.version>
<spring.boot.version>2.0.2.RELEASE</spring.boot.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -138,6 +138,41 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.12.1</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@
*/
package io.mosip.esignet.mock.identitysystem.controller;

import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Valid;

import io.mosip.esignet.mock.identitysystem.dto.*;
import io.mosip.esignet.mock.identitysystem.dto.Error;
import io.mosip.esignet.mock.identitysystem.validator.IdentitySchema;
import io.mosip.kernel.core.exception.ErrorResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import io.mosip.esignet.mock.identitysystem.exception.MockIdentityException;
import io.mosip.esignet.mock.identitysystem.service.IdentityService;
import io.mosip.esignet.mock.identitysystem.util.HelperUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;


@RestController
Expand All @@ -29,7 +39,7 @@ public class IdentityController {
@PostMapping(value = "identity", consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
MediaType.APPLICATION_JSON_VALUE })
public ResponseWrapper<IdentityStatus> createIdentity
(@Valid @RequestBody RequestWrapper<CreateIdentity> requestWrapper) throws MockIdentityException {
(@RequestBody @Valid RequestWrapper<CreateIdentity> requestWrapper) throws MockIdentityException {

ResponseWrapper response = new ResponseWrapper<IdentityStatus>();
IdentityStatus identityStatus = new IdentityStatus();
Expand All @@ -43,7 +53,7 @@ public class IdentityController {
@PutMapping(value = "identity", consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
MediaType.APPLICATION_JSON_VALUE })
public ResponseWrapper<IdentityStatus> updateIdentity
(@Valid @RequestBody RequestWrapper<UpdateIdentity> requestWrapper) throws MockIdentityException {
(@RequestBody @Valid RequestWrapper<UpdateIdentity> requestWrapper) throws MockIdentityException {

ResponseWrapper response = new ResponseWrapper<IdentityStatus>();
IdentityStatus identityStatus = new IdentityStatus();
Expand Down Expand Up @@ -74,4 +84,25 @@ public ResponseWrapper<VerifiedClaimStatus> createVerifiedClaim(@Valid @RequestB
return response;

}

@ExceptionHandler(ConstraintViolationException.class)
public ResponseEntity handleMethodArgumentNotValidException(ConstraintViolationException ex) {
List<Error> errors = new ArrayList<>();
if(ex != null) {
Set<ConstraintViolation<?>> violations = ((ConstraintViolationException) ex).getConstraintViolations();
for(ConstraintViolation<?> cv : violations) {
errors.add(new Error(cv.getMessage(), cv.getPropertyPath().toString() + ": " + cv.getMessage()));
}
return new ResponseEntity<ResponseWrapper>(getResponseWrapper(errors), HttpStatus.OK);
}
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(errors);
}

private ResponseWrapper getResponseWrapper(List<Error> errors) {
ResponseWrapper responseWrapper = new ResponseWrapper<>();
responseWrapper.setResponseTime(HelperUtil.getCurrentUTCDateTime());
responseWrapper.setErrors(errors);
return responseWrapper;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
package io.mosip.esignet.mock.identitysystem.dto;

import io.mosip.esignet.mock.identitysystem.validator.IdData;
import io.mosip.esignet.mock.identitysystem.validator.IdentitySchema;

@IdData(action = "CREATE")
@IdentitySchema(action = "CREATE")
public class CreateIdentity extends IdentityData {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@

import java.util.List;

import javax.validation.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.mosip.esignet.mock.identitysystem.util.ErrorConstants;
import io.mosip.esignet.mock.identitysystem.validator.IdData;
import lombok.Data;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class IdentityData {

@NotBlank(message = ErrorConstants.INVALID_INDIVIDUAL_ID)

String individualId;

String pin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
package io.mosip.esignet.mock.identitysystem.dto;

import io.mosip.esignet.mock.identitysystem.validator.IdData;
import io.mosip.esignet.mock.identitysystem.validator.IdentitySchema;

@IdData(action = "UPDATE")
@IdentitySchema(action = "UPDATE")
public class UpdateIdentity extends IdentityData {
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ public class ErrorConstants {
public static final String INVALID_TRUST_FRAMEWORK = "invalid_trust_framework";
public static final String INVALID_VERIFIED_DATE = "invalid_verified_date";
public static final String CLAIM_ALREADY_EXISTS="Claim already exists";
public static final String INVALID_IDENTITY_DATA= "invalid_identity_data";
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.mosip.esignet.mock.identitysystem.validator;


import io.mosip.esignet.mock.identitysystem.util.ErrorConstants;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE_USE, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = IdentitySchemaValidator.class)
public @interface IdentitySchema {

String message() default ErrorConstants.INVALID_IDENTITY_DATA;
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};

String action();
}
Loading

0 comments on commit 2802a2b

Please sign in to comment.