forked from mosip/esignet-signup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* config spring security and create endpoint to get csrf token * add unit-test for new endpoint * fix coding style * register feature. connect to camdgc env * update application-default reperty * connect to uin, hashing password and add identity service. and write unit test * remove git ignore and remove .idea * resolve comment * resolve comment * remove hard code assign L1 to registrationType in Identity * remove mock set transaction * change RegistrationService dependency to private * add validation on UserInfoMap field * add validator on password in register request * add exception message * rename validator, remove consentType validator, change registrationId base on applicationID om RegistrationTrasaction * ES-429 Signed-off-by: ase-101 <[email protected]> --------- Signed-off-by: ase-101 <[email protected]> Co-authored-by: Mengleang <[email protected]> Signed-off-by: Sreang Rathanak <[email protected]>
- Loading branch information
1 parent
a32a30c
commit 79317d1
Showing
35 changed files
with
1,646 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
signup-service/src/main/java/io/mosip/signup/controllers/CsrfController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.mosip.signup.controllers; | ||
|
||
import org.springframework.security.web.csrf.CsrfToken; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/csrf") | ||
public class CsrfController { | ||
|
||
@GetMapping("/token") | ||
public CsrfToken getCsrfToken(CsrfToken csrfToken) { | ||
return csrfToken; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
signup-service/src/main/java/io/mosip/signup/dto/AddIdentityRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import lombok.Data; | ||
|
||
import javax.validation.constraints.Max; | ||
import javax.validation.constraints.Size; | ||
import java.io.Serializable; | ||
|
||
@Data | ||
public class AddIdentityRequest implements Serializable { | ||
|
||
private String registrationId; | ||
private Identity identity; | ||
} |
12 changes: 12 additions & 0 deletions
12
signup-service/src/main/java/io/mosip/signup/dto/AddIdentityResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class AddIdentityResponse { | ||
|
||
private String status; | ||
private String identity; | ||
private String documents; | ||
private String verifiedAttributes; | ||
} |
23 changes: 23 additions & 0 deletions
23
signup-service/src/main/java/io/mosip/signup/dto/Identity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
@Data | ||
public class Identity implements Serializable { | ||
|
||
@JsonProperty("UIN") | ||
private String UIN; | ||
|
||
@JsonProperty("IDSchemaVersion") | ||
private float IDSchemaVersion; | ||
|
||
private List<LanguageTaggedValue> fullName; | ||
private String phone; | ||
private String preferredLang; | ||
private Password password; | ||
private String registrationType; | ||
} |
19 changes: 19 additions & 0 deletions
19
signup-service/src/main/java/io/mosip/signup/dto/LanguageTaggedValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import io.mosip.signup.util.ErrorConstants; | ||
import io.mosip.signup.validator.Language; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class LanguageTaggedValue { | ||
|
||
@Language | ||
private String language; | ||
|
||
@NotBlank(message = ErrorConstants.INVALID_VALUE) | ||
private String value; | ||
} |
28 changes: 28 additions & 0 deletions
28
signup-service/src/main/java/io/mosip/signup/dto/Password.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.io.Serializable; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Password { | ||
|
||
private String hash; | ||
private String salt; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public static class PasswordPlaintext{ | ||
private String inputData; | ||
} | ||
|
||
@Data | ||
public static class PasswordHash { | ||
private String hashValue; | ||
private String salt; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
signup-service/src/main/java/io/mosip/signup/dto/RegisterRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import io.mosip.signup.util.ErrorConstants; | ||
import io.mosip.signup.validator.Password; | ||
import io.mosip.signup.validator.Username; | ||
import lombok.Data; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Pattern; | ||
|
||
@Data | ||
public class RegisterRequest { | ||
|
||
@Username | ||
private String username; | ||
|
||
@Password | ||
private String password; | ||
|
||
@NotBlank(message = ErrorConstants.INVALID_CONSENT) | ||
@Pattern(message = ErrorConstants.INVALID_CONSENT, regexp = "^(DISAGREE)|(AGREE)$") | ||
private String consent; | ||
|
||
@NotNull(message = ErrorConstants.INVALID_USERINFO) | ||
private @Valid UserInfoMap userInfo; | ||
} |
9 changes: 9 additions & 0 deletions
9
signup-service/src/main/java/io/mosip/signup/dto/RegisterResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class RegisterResponse { | ||
|
||
private String status; | ||
} |
13 changes: 13 additions & 0 deletions
13
signup-service/src/main/java/io/mosip/signup/dto/RestError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class RestError { | ||
|
||
private String errorCode; | ||
private String message; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
signup-service/src/main/java/io/mosip/signup/dto/UINResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
import java.io.Serializable; | ||
|
||
@Data | ||
public class UINResponse implements Serializable { | ||
|
||
@JsonProperty("uin") | ||
private String UIN; | ||
} |
24 changes: 24 additions & 0 deletions
24
signup-service/src/main/java/io/mosip/signup/dto/UserInfoMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.mosip.signup.dto; | ||
|
||
import io.mosip.signup.util.ErrorConstants; | ||
import io.mosip.signup.validator.PhoneNumber; | ||
import io.mosip.signup.validator.Language; | ||
import lombok.Data; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
import java.util.List; | ||
|
||
@Data | ||
public class UserInfoMap { | ||
|
||
@PhoneNumber | ||
private String phone; | ||
|
||
@NotEmpty(message = ErrorConstants.INVALID_FULLNAME) | ||
private List<@Valid LanguageTaggedValue> fullName; | ||
|
||
@Language | ||
private String preferredLang; | ||
} |
3 changes: 3 additions & 0 deletions
3
signup-service/src/main/java/io/mosip/signup/exception/SignUpException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.