diff options
author | Yigit Sever | 2021-04-14 03:27:27 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-14 19:11:49 +0300 |
commit | edfab6ae2f97a7288ff456265050c01ff397ea8c (patch) | |
tree | e98ce8b12c1ef4d61c70944f47d87d74297a8ed3 /src/custom_filters.rs | |
parent | a5d5ab88d3f73d0b6f5fa847df6dace90810313d (diff) | |
download | gradecoin-edfab6ae2f97a7288ff456265050c01ff397ea8c.tar.gz gradecoin-edfab6ae2f97a7288ff456265050c01ff397ea8c.tar.bz2 gradecoin-edfab6ae2f97a7288ff456265050c01ff397ea8c.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 | ||