Skip to content
Roman-Akopov edited this page Jul 12, 2018 · 7 revisions

Data Transfer Objects


Identity Directory DTO

GET

{
    "id": <UUID>,
    "type": "basic",
    "code": <string>,
    "name": <string>
}

Credential Directory DTO

GET

{
    "id": <UUID>,
    "type": "basic" | "one-time-password" | "token" | "subnet",
    "code": <string>,
    "name": <string>
}

Basic Identity DTO

GET

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>,
    "username": <string>
}

POST/PUT/PATCH

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>,
    "username": <string>
}

Basic Credential DTO

GET

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>
}

POST/PUT/PATCH

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>,
    "old_password": <string>,
    "password": <string>
}

One Time Password Credential DTO

GET

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>,
    "type": "online-none" | "offline-qr",
    "binding-data": <string>
}

POST/PUT/PATCH

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "principal_id": <UUID>
}

Token Credential DTO

Subnet Credential DTO

One Time Password Message DTO

GET

{
    "id": <UUID>,
    "credential_id": <UUID>
}

POST/PUT/PATCH

{
    "credential_id": <UUID>,
    "purpose": 
        "email_validate" |
        "email_change" |
        "email_reset" |
        "phone_validate" |
        "phone_change" |
        "phone_reset" |
        "basic_credential_validate" |
        "basic_credential_change" |
        "basic_credential_reset" |
        "otp_credential_validate" |
        "otp_credential_change" |
        "otp_credential_reset"
}

Principal DTO

GET

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "email": <string>,
    "phone": <string>,
    "brief_name": <string>,
    "full_name": <string>,

    "identities": {
        "basic": [
            <BasicIdentity>, <BasicIdentity>
        ]
    },

    "credentials": {
        "basic": [
            <BasicCredential>, <BasicCredential>
        ],
        "one-time-password": [
            <OneTimePasswordCredential>, <OneTimePasswordCredential>
        ],
        "token": [
            <TokenCredential>, <TokenCredential>
        ],
        "subnet": [
            <SubnetCredential>, <SubnetCredential>
        ]
    },

    // shortcuts
    "_basic_username_text": <string>,
    "_has_basic_password": <boolean>,
    "_has_phone_sms_one_time_password": <boolean>
    "_has_google_authenticator_one_time_password": <boolean>
}

POST/PUT/PATCH

{
    "_is_saved": <boolean>,
    "id": <UUID>,
    "email": <string>,
    "phone": <string>,
    "brief_name": <string>,
    "full_name": <string>,

    "identities": {
        "basic": [
            <BasicIdentity>, <BasicIdentity>
        ]
    },

    "credentials": {
        "basic": [
            <BasicCredential>, <BasicCredential>
        ],
        "one-time-password": [
            <OneTimePasswordCredential>, <OneTimePasswordCredential>
        ],
        "token": [
            <TokenCredential>, <TokenCredential>
        ],
        "subnet": [
            <SubnetCredential>, <SubnetCredential>
        ]
    },

    // shortcuts
    "_basic_username_text": <string>,
    "_basic_password_text": <string>,
    "_has_phone_sms_one_time_password": <boolean>
    "_has_google_authenticator_one_time_password": <boolean>
}

Session DTO

GET

{
    "id": <UUID>,
    "principal": <Principal>,
    "evidences": [
        "authenticated",
        "knowledge_factor",
        "knowledge_factor_password"
    ]
}

POST/PUT/PATCH

{
    "identities": {
        "basic": [
            <BasicIdentity>, <BasicIdentity>
        ]
    },
    "credentials": {
        "basic": [
            <BasicCredential>, <BasicCredential>
        ],
        "one-time-password": [
            <OneTimePasswordCredential>, <OneTimePasswordCredential>
        ],
        "token": [
            <TokenCredential>, <TokenCredential>
        ]
    },

    // shortcuts
    "_basic_username_text": <string>,
    "_basic_password_text": <string>,
    "_has_phone_sms_one_time_password": <boolean>
    "_has_google_authenticator_one_time_password": <boolean>
}

Endpoints


Identity Directory Endpoint

GET

Request

GET /directory/identity/

Response

200 OK

{
    "status": 200,
    "data": [
        <IdentityDirectory>
    ]
}

Credential Directory Endpoint

GET

Request

GET /directory/credential/

Response

200 OK

{
    "status": 200,
    "data": [
        <CredentialDirectory>
    ]
}

Session Endpoint

GET

Request

GET /session/current

Response

200 OK

{
    "status": 200,
    "data": <Session>
}

PUT

Request

PUT /session/current

{
    "data": <Session>
}

Response

200 OK
Location: /session/current

{
    "status": 200,
    "data": <Session>
}

PATCH

Request

PATCH /session/current
X-OTP-Message: <UUID> Text

{
    "data": <Session>
}

Response

200 OK
Location: /session/current

{
    "status": 200,
    "data": <Session>
}

DELETE

Request

DELETE /session/current

{
}

Response

204 OK

Principal Endpoint

GET

Request

GET /principal/<UUID or me>

Response

{
    "status": 200,
    "data": <Principal>
}

POST

Request

POST /principal/
Content-Location: /session/principal/<UUID>
X-OTP-Message: <UUID> Text
X-OTP-Message: <UUID> Text

{
    "data": <Principal>
}

Response

201 Created
Location: /principal/<UUID>

{
    "status": 201,
    "data": <Principal>
}

PATCH

Request

PATCH /principal/<UUID or me>
X-OTP-Message: <UUID> Text

{
    "data": <Principal>
}

Response

200 OK
Location: /principal/<UUID>

{
    "status": 200,
    "data": <Principal>
}

Basic Identity Endpoint

POST

Request

POST /identity/basic/

{
    "data": <BasicIdentity>
}

Response

201 Created
Location: /identity/basic/<UUID>

{
    "status": 201,
    "data": <BasicIdentity>
}

PATCH

Request

PATCH /identity/basic/<UUID>
X-OTP-Message: <UUID> Text

{
    "data": <BasicIdentity>
}

Response

200 OK

{
    "status": 200,
    "data": <BasicIdentity>
}

Basic Credential Endpoint

POST

Request

POST /credential/basic/

{
    "data": <BasicCredential>
}

Response

201 Created
Location: /credential/basic/<UUID>

{
    "status": 201,
    "data": <BasicCredential>
}

PATCH

Request

PATCH /credential/basic/<UUID>
X-OTP-Message: <UUID> Text

{
    "data": <BasicCredential>
}

Response

200 OK

{
    "status": 200,
    "data": <BasicCredential>
}

One Time Password Credential

GET

Request

Response

POST

Request

POST /credential/one-time-password/
Content-Location: /session/credential/one-time-password/<UUID>
X-OTP-Message: <UUID> Text

{
    "data": <OneTimePasswordCredential>
}

Response

201 Created
Location: /credential/one-time-password/<UUID>

{
    "status": 201,
    "data": <OneTimePasswordCredential>
}

One Time Password Credential Message Endpoint

POST

Request

POST /credential/one-time-password/<UUID>/message

{
    "data": <OneTimePasswordCredentialMessage>
}

Response

201 Created
Location: /credential/one-time-password/<UUID>/message/<UUID>

{
    "status": 201,
    "data": <OneTimePasswordCredentialMessage>
}