Create user
Motivation
Create(register) new user
Functional design
POST /api/v2/apps/{owner}/{app}/users
Headers
| Key | Value |
|---|---|
| Content-Type | application/json |
Body
JSON object:
{
"verifiedEmailToken": "{verified-email-token}",
"password": "{password}",
"displayName": "{display-name}"
}
Parameters
| Parameter | Type | Description |
|---|---|---|
| Path | ||
| owner | string | name of a user who owns the application |
| app | string | name of an application |
| Body | ||
| verified-email-token | string | verified value token for the email |
| password | string | password for the new user |
| display-name | string | display name for the new user |
Result
| Code | Description | Body |
|---|---|---|
| 201 | Created | |
| 400 | Bad Request | error object |
| 401 | Unauthorized | error object |
| 429 | Too may requests, rate limiting | error object |
| 500+ | Server errors / service unavailable | error object |
Technical design
Components
pkg/registry
CreateEmailLoginfunction:
TYPE CreateEmailLoginParams (
Email varchar VERIFIABLE,
AppName text NOT NULL,
SubjectKind int32 NOT NULL,
WSKindInitializationData text(1024) NOT NULL,
ProfileCluster int32 NOT NULL
);
COMMAND CreateEmailLogin (CreateEmailLoginParams, UNLOGGED CreateLoginUnloggedParams);
GRANT EXECUTE ON COMMAND CreateEmailLogin TO sys.Anonymous;
- declaration in VSQL:
~cmp.registry.CreateEmailLogin.vsql~covrd1✅ - the extension code:
~cmp.registry.CreateEmailLogin.go~covrd2✅
CreateLoginmust only be allowed to system~cmp.registry.CreateLogin.vsql~uncvrd3❓
pkg/router
- URL path handler
~cmp.router.UsersCreatePathHandler~covrd4✅:- parses the request Body; calculates pseudo-wsid;
- sends v2 request
c.registry.CreateLoginto Command Processor
pkg/sys/it
- integration test for /users
~it.TestUsersCreate~covrd5✅