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

Manage more than one client connections

Key features

  1. During Legal Entity creation process - create new separated configuration for each consumer (MIS)

  2. Manage different configurations for different consumers via API

  3. Secure Client Secret - do not share Client Secret between different consumers

  4. Handle more than one redirect_uri for each consumer

Overview

DB Objects

connections

Attribute

Type

M/O

Description

Attribute

Type

M/O

Description

id

Uuid

M

Unique record identifier

client_id

Uuid

M

id od client that provides connection. FK clients.id

consumer_id

Uuid

M

id of client that will consume connection. FK clients.id

secret

String

M



redirect_uri

String

M



inserted_at

Timestamp

M



updated_at

Timestamp

M



clients

Some fields must be removed from clients table

Attribute

Type

M/O

Description

Attribute

Type

M/O

Description

secret

String

M



redirect_uri

String

M



Process changes

Create/Update legal entity

Added new API call to create client connection

See IL.Create/Update Legal Entity

Authorize approval

  1. redirect_uri must be validated against all connections related to client and must matches with connections.redirect_uri

Exchange code grant to access token

  1. Validate that there is a connection related to a specified client with this secret

  2. Validate that redirect_uri matches with redirect_uri for found connection

API

Get clients

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope client:read in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service must return list of clients filtered by context depending on client type

  1. Extract client_type from token

  2. Filter response:

    1. Mithril Admin - receives all client records without context

    2. MSP, MIS, PHARMACY - receives only its own client

Prepare response

  1. Query data from mithril.clients using context

Get client details

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope client:read in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service must returns client details for specified ID and is restricted by context

  1. Extract client_type from token

  2. Validate specified ID according to context:

    1. Mithril Admin - receives all client records

    2. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Prepare response

  1. Query data from mithril.clients using specified ID

Get client connections

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope connection:read in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service must return list of clients connections for specified client ID. Client connections are restricted by Client ID and its context

  1. Extract client_type from token

  2. Validate specified Client ID according to context:

    1. Mithril Admin - receives all client records

    2. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Prepare response

  1. Query data from mithril.connections for specified Client ID

  2. Hide secret from response

Get client connection details

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope connection:read in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service must return connections details for specified client ID and connection ID. Client connections are restricted by Client ID and its context

  1. Extract client_type from token

  2. Validate specified Client ID according to context:

    1. Mithril Admin - receives all client records

    2. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Prepare response

  1. Query data from mithril.connections for specified Client ID and Connection ID

  2. Hide secret from response

Private. Put client connection

This method is only for internal use. There is no public API to create connection (at the moment)

Logic

  1. Generate new secret value

  2. UpSet record in mithril.connections for specified Client ID and Consumer ID

Update client connection

Only redirect uri can be updated using this method

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope connection:write in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service manages connections restricted by Client ID and context

  1. Extract client_type from token

  2. Validate specified Client ID according to context:

    1. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Request validation

  1. Validate according JSON Schema

    1. Return 422 with list of validation errors in case validation fails 

Logic

  1. Update mithril.connections for specified Connection ID and replace redirect_uri with the value from request

  2. Hide secret from response

Delete client connection

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope connection:delete in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service manages connections restricted by Client ID and context

  1. Extract client_type from token

  2. Validate specified Client ID according to context:

    1. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Logic

  1. Delete record from mithril.connections for specified Connection ID

Refresh client secret

Specification

Apiary spec

Validation

Authorization

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope connection:delete in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Context

This service manages connections restricted by Client ID and context

  1. Extract client_type from token

  2. Validate specified Client ID according to context:

    1. MSP, MIS, PHARMACY - receives only its own client

      1. in case of error generate 403 response ('forbidden')

Logic

  1. Generate new secret for specified Connection ID and update it in mithril.connections for specified Connection ID

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