diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-05-03 21:21:28 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-05-03 21:21:28 +0200 |
commit | 382ffb2d48e0ee3322d326242d916e10a6d0f7b0 (patch) | |
tree | 6319ed95c32eeef1f057789b31bc09ef41b6f520 /talerbank/app/schemas.py | |
parent | ee81ebaf1233a5f82ea22927515b4f56c9ea670d (diff) | |
download | bank-382ffb2d48e0ee3322d326242d916e10a6d0f7b0.tar.gz bank-382ffb2d48e0ee3322d326242d916e10a6d0f7b0.tar.bz2 bank-382ffb2d48e0ee3322d326242d916e10a6d0f7b0.zip |
implementing auth type basic
Diffstat (limited to 'talerbank/app/schemas.py')
-rw-r--r-- | talerbank/app/schemas.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/talerbank/app/schemas.py b/talerbank/app/schemas.py index 2e252e0..a116a21 100644 --- a/talerbank/app/schemas.py +++ b/talerbank/app/schemas.py @@ -22,6 +22,14 @@ definitions of JSON schemas for validating data import validictory from django.core.exceptions import ValidationError +auth_basic_schema = { + "type": "object", + "properties": { + "username": {"type": "string"}, + "password": {"type": "string"} + } +} + wiredetails_schema = { "type": "object", "properties": { @@ -37,11 +45,18 @@ wiredetails_schema = { } } +auth_schema = { + "type": "object", + "properties": { + "type": {"type": "string"}, + "data": {"type": "object"} + } +} + history_schema = { "type": "object", "properties" : { - "username": {"type": "string"}, - "password": {"type": "string"}, + "auth": auth_schema, "start": {"type": "integer", "required": False}, "delta": {"type": "integer", "required": False} } @@ -63,8 +78,7 @@ incoming_request_schema = { "wtid": {"type": "string"}, "exchange_url": {"type": "string"}, "credit_account": {"type": "integer"}, - "username": {"type": "string"}, - "password": {"type": "string"} + "auth": auth_schema } } @@ -79,3 +93,6 @@ def validate_wiredetails(wiredetails): def validate_incoming_request(incoming_request): validictory.validate(incoming_request, incoming_request_schema) + +def validate_auth_basic(auth_basic): + validictory.validate(auth_basic, auth_basic_schema) |