diff options
author | Yigit Sever | 2021-04-14 03:27:27 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-14 19:11:49 +0300 |
commit | e466f25ecfa356137523ee597b9fc6ab0da5df22 (patch) | |
tree | 06946f8811f90cf89ddc0afe685f15e9b3cf6cda /src/custom_filters.rs | |
parent | db5a025bae30bfb6044e87eb196cc6bb63eb68d3 (diff) | |
download | gradecoin-e466f25ecfa356137523ee597b9fc6ab0da5df22.tar.gz gradecoin-e466f25ecfa356137523ee597b9fc6ab0da5df22.tar.bz2 gradecoin-e466f25ecfa356137523ee597b9fc6ab0da5df22.zip |
[WIP] Initial implementation of user auth
There is a dance involved and everything
Write down specs for RSA and AES, padding scheme, ugh.
Diffstat (limited to 'src/custom_filters.rs')
-rw-r--r-- | src/custom_filters.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/custom_filters.rs b/src/custom_filters.rs index ae8a56c..299cd8d 100644 --- a/src/custom_filters.rs +++ b/src/custom_filters.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | /// Functions that extracts Structs to be used in warp routines | 1 | /// Functions that extracts Structs to be used in warp routines |
2 | use crate::schema::{AuthRequest, Block, Db, Transaction}; | 2 | use crate::schema::{Block, Db, InitialAuthRequest, Transaction}; |
3 | use std::convert::Infallible; | 3 | use std::convert::Infallible; |
4 | use warp::{Filter, Rejection}; | 4 | use warp::{Filter, Rejection}; |
5 | 5 | ||
@@ -8,12 +8,12 @@ pub fn with_db(db: Db) -> impl Filter<Extract = (Db,), Error = Infallible> + Clo | |||
8 | warp::any().map(move || db.clone()) | 8 | warp::any().map(move || db.clone()) |
9 | } | 9 | } |
10 | 10 | ||
11 | /// Extracts an `AuthRequest` JSON body from the request | 11 | /// Extracts an `InitialAuthRequest` JSON body from the request |
12 | /// Accepts only JSON encoded `AuthRequest` body and rejects big payloads | 12 | /// Accepts only JSON encoded `AuthRequest` body and rejects big payloads |
13 | /// | 13 | /// |
14 | // TODO: find a good limit for this, (=e2482057; 8 char String + rsa pem) <11-04-21, yigit> // | 14 | // TODO: find a good limit for this, (=e2482057; 8 char String + rsa pem) <11-04-21, yigit> // |
15 | pub fn auth_request_json_body() -> impl Filter<Extract = (AuthRequest,), Error = Rejection> + Clone | 15 | pub fn auth_request_json_body( |
16 | { | 16 | ) -> impl Filter<Extract = (InitialAuthRequest,), Error = Rejection> + Clone { |
17 | warp::body::content_length_limit(1024 * 32).and(warp::body::json()) | 17 | warp::body::content_length_limit(1024 * 32).and(warp::body::json()) |
18 | } | 18 | } |
19 | 19 | ||