/
Create User

ЕСОЗ - публічна документація

Create User

Specification

Apiary
POSTmithril/api/users
Scope

Purpose

Modification  existing WS: Create a user:

  • Add `is_blocked`, `block_reason` column in user entity
  • Add new fields into `priv_settings`
  • Add new attribute `2fa_enable` to WS request 
  • Add logic for create 2FA item for new user 

Request parameters 

Add new parameters:

  • 2fa_enable (boolean, optional

Logic WS

  1. Create user with this structure in `users.priv_settings`:

    {
        "login_error_counter": 0,
        "otp_error_counter": 0
    }

    and this values for new columns:

    1. is_blocked = FALSE
    2. block_reason = NULL
  2. After insert new user in `users`
  3. Analyze $.2fa_enable 
    1. If $.2fa_enable = FALSE - break 
    2. If $.2fa_enable = TRUE 
      1. Insert new record in `authentication_factors` with logical status = RESET
        1. user_id = $.user_id
        2. type = `SMS`
        3. factor = NULL
        4. is_active = TRUE
        5. update_at = now()
    3. If $.2fa_enable = NULL or empty
      1. Get config-param `USER_2FA_ENABLED`
      2. If `USER_2FA_ENABLED` = TRUE
        1. Insert new record in `authentication_factors` with logical status = RESET
          1. user_id = $.user_id
          2. type = `SMS`
          3. factor = NULL
          4. is_active = TRUE
          5. update_at = now()

Response

  • 201 if user successful unblock  + user_object_view
  • 4xx in other case


Related content

Auth.Basic Login
Auth.Basic Login
Read with this
Create User 2FA
Create User 2FA
More like this
Use Refresh Token for Access Token extension
Use Refresh Token for Access Token extension
Read with this
Init User Factor
Init User Factor
More like this
Auth. Authorize scopes (Deprecated)
Auth. Authorize scopes (Deprecated)
Read with this
2FA Data model
2FA Data model
More like this

ЕСОЗ - публічна документація