Skip to content

Commit

Permalink
ES-601 (mosip#61)
Browse files Browse the repository at this point in the history
Signed-off-by: ase-101 <[email protected]>
Signed-off-by: Sreang Rathanak <[email protected]>
  • Loading branch information
ase-101 authored and Sreang Rathanak committed Jan 15, 2024
1 parent 3a432ad commit 26eda5e
Show file tree
Hide file tree
Showing 2 changed files with 264 additions and 0 deletions.
228 changes: 228 additions & 0 deletions docs/postman-collections/signup_001.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"info": {
"_postman_id": "578adb06-0d30-4990-b5d7-cf9b9b0330cd",
"name": "signup-001",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "20579541"
},
"item": [
{
"name": "generate CSRF token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var token = pm.cookies.get(\"XSRF-TOKEN\")",
"pm.environment.set(\"csrf_token\", token);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/csrf/token",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"csrf",
"token"
]
}
},
"response": []
},
{
"name": "settings",
"request": {
"method": "GET",
"header": [
{
"key": "X-XSRF-TOKEN",
"value": "{{csrf_token}}",
"type": "text"
}
],
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/settings",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"settings"
]
}
},
"response": []
},
{
"name": "generate-challenge",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"const randomNumber = _.random(10000000,99999999)",
"pm.environment.set('randomPhoneNumber', randomNumber)"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "X-XSRF-TOKEN",
"value": "{{csrf_token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"requestTime\": \"{{$isoTimestamp}}\",\n \"request\": {\n \"identifier\": \"+855{{randomPhoneNumber}}\",\n \"captchaToken\": \"<captcha-token>\",\n \"regenerate\" : false,\n \"purpose\" : \"REGISTRATION\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/registration/generate-challenge",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"registration",
"generate-challenge"
]
}
},
"response": []
},
{
"name": "verify-challenge",
"request": {
"method": "POST",
"header": [
{
"key": "X-XSRF-TOKEN",
"value": "{{csrf_token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"requestTime\": \"{{$isoTimestamp}}\",\n \"request\": {\n \"identifier\": \"+855{{randomPhoneNumber}}\",\n \"challengeInfo\": {\n \"challenge\": \"111111\",\n \"format\": \"alpha-numeric\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/registration/verify-challenge",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"registration",
"verify-challenge"
]
}
},
"response": []
},
{
"name": "register",
"request": {
"method": "POST",
"header": [
{
"key": "X-XSRF-TOKEN",
"value": "{{csrf_token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"requestTime\": \"{{$isoTimestamp}}\",\n \"request\": {\n \"username\": \"+855{{randomPhoneNumber}}\",\n \"password\": \"A1234567890\",\n \"consent\": \"AGREE\",\n \"userInfo\": {\n \"fullName\": [\n {\n \"language\": \"eng\",\n \"value\": \"{{$randomFullName}}\"\n }\n ],\n \"phone\": \"+855{{randomPhoneNumber}}\",\n \"preferredLang\": \"khm\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/registration/register",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"registration",
"register"
]
}
},
"response": []
},
{
"name": "Registration Status",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://api-internal.camdgc-dev.mosip.net/v1/signup/registration/status",
"protocol": "https",
"host": [
"api-internal",
"camdgc-dev",
"mosip",
"net"
],
"path": [
"v1",
"signup",
"registration",
"status"
]
}
},
"response": []
}
]
}
36 changes: 36 additions & 0 deletions signup-service/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
## SignUp Service

Signup service is a spring boot application with endpoints to

1. Generate Challenge (Only OTP supported)
2. Verify Challenge
3. Register user with verified transaction
4. Check registration status
5. Reset the password of the registered user

Signup service connects to MOSIP IDRepo Identity service to register the verified user as an identity record.
ID Repo identity service publishes the registered identity to MOSIP IDA. This enables authentication with the registered
username and password with eSignet.

Publishing registered/updated identity to MOSIP IDA is an async process. Hence, status endpoint is configured to check
the latest status from server after every configured interval from signup UI.

### Signup service uses spring cache to store the transaction details.

Registration flow:

| Endpoint | Cache | Evict |
|-------------------|----------------------------------------------------------------------|-----------------------------------------------------|
| generateChallenge | challenge-generated (k: transactionId, v: SignupTransaction) | |
| verifyChallenge | challenge-verified (k: verified-transactionId, v: SignupTransaction) | challenge-generated (k: transactionId, v: SignupTransaction) |
| register | status-check (k: verified-transactionId, v: SignupTransaction) | challenge-verified (k: verified-transactionId, v: SignupTransaction) |
| status | status-check (k: verified-transactionId, v: SignupTransaction) | |

Reset Password flow:

| Endpoint | Cache | Evict |
|-------------------|----------------------------------------------------------------------------|-----------------------------------------------------|
| generateChallenge | challenge-generated (k: transactionId, v: SignupTransaction) | |
| verifyChallenge | challenge-verified (k: verified-transactionId, v: SignupTransaction) | challenge-generated (k: transactionId, v: SignupTransaction) |
| resetPassword | status-check (k: verified-transactionId, v: SignupTransaction) | challenge-verified (k: verified-transactionId, v: SignupTransaction) |
| status | status-check (k: verified-transactionId, v: SignupTransaction) | |


## Build & run (for developers)
The project requires JDK 11.
1. Build and install:
Expand Down

0 comments on commit 26eda5e

Please sign in to comment.