Create new 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

401

Unauthorized

429

Too may requests, rate limiting

500+

Server errors / service unavailable

Technical design

Components

pkg/registry

  1. CreateEmailLogin function:

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~

  • the extension code: ~cmp.registry.CreateEmailLogin.go~

  1. CreateLogin must only be allowed to system ~cmp.registry.CreateLogin.vsql~

pkg/router

  • URL path handler ~cmp.router.UsersCreatePathHandler~✅:

    • parses the request Body; calculates pseudo-wsid;

    • sends v2 request c.registry.CreateLogin to Command Processor

pkg/sys/it

  • integration test for /users

    • ~it.TestUsersCreate~

Last updated

Was this helpful?