shockrah
2400b89b12
added result return types to invites module functions
...
this lets us cut down on worrying about mysql errors
Mysql error responsibility is now the route dispatchers problem
Route dispatcher itself can easily dispatch to another handler
2020-06-02 17:05:14 -07:00
shockrah
20f6273ad7
Fixed compile issue regardign :: vs . typo
2020-06-02 03:45:54 -07:00
shockrah
dd3bbeabd8
InviteRow structure has some methods listed below:
...
+ new() -> create a new ready to insert invite
+ from_tuple -> helps us translate db responses into a struct
+ as_json_str -> String which we can use as a json payload(jank but whatever it works with proper headers)
FUnctions:
get_invite_by_code: as the name implies grabs an invite assuming its in our db otherwise None
record_invite_usage: blindly modifies the row in the schema, assumes that if we get to this point we're ok to ignore erroneous possibilities
join_invite_code: main dispatcher for joining using the /invite/join route
create_invite: meant to the be the route handler for creating invites later on
Needed: test module since we've basically reworked the whole auth/invite system in one day
2020-06-02 03:44:33 -07:00
shockrah
43a122b855
Removing old unused files from project
2020-06-02 03:39:39 -07:00
shockrah
d1cfc4284c
child calls from main_responder (see route_dipatcher + route handlers) now borrow a connection for the sql db
2020-06-02 03:25:11 -07:00
shockrah
19ad0eee9f
OpenAuth + Good both have the same kind of dispatcher response
...
route dispatcher work begins with dispatching to invites::join_invite_code
Fixed the non mutable ref borrowing in funcs that required mutable references like most that get called by route_dispatcher
2020-06-02 01:32:43 -07:00
shockrah
68aeb50175
checking for open routes which require no aut in wall_entry
2020-06-02 01:29:05 -07:00
shockrah
d02f2d9eb7
conatiner module for routes
2020-06-02 01:28:40 -07:00
shockrah
c7c6f530a0
handling ctrl-c
2020-06-02 00:50:09 -07:00
shockrah
9033c80369
Exhaustive response to various authentication failures
...
response route_dispatcher now guaranteed to fire on proper authentication only
2020-06-02 00:47:28 -07:00
shockrah
e2abc49087
added counter to keys table
...
this lets us increment uses when a key is going to be used
2020-06-02 00:44:53 -07:00
shockrah
8360efced5
auth::wall_entry now verifies keys upon request
...
We can now decide what kind of authorization result triggers what kind of responses to the users
Further more error handling has to happen closer to application logic which is the main trade-off of our architecture
2020-06-02 00:32:15 -07:00
shockrah
5ad23eed8c
adding mysql_async to dependancy list
2020-06-01 23:05:06 -07:00
shockrah
125a728674
new keys table to let auth::wall_entry check for api access
2020-06-01 23:02:53 -07:00
shockrah
83576f1126
basic query string parser function used to generate hashmaps of parameters
...
This hashmap is then borrowed by child functions down to the route handlers themselves if they need it
2020-06-01 22:50:58 -07:00
shockrah
e48720d6ac
removing basically everything since almost nothing is going to translate over very easily from the auth module
...
for now we're only going to use two methods to
auth::wall_entry is what allows to impose rate on a per user basic, not per route, although this feature can be configured later
2020-06-01 22:28:06 -07:00
shockrah
c1f8ebee1d
slight typo in parameters fixed
2020-06-01 22:25:21 -07:00
shockrah
b3289ca9bd
Basic router skeleton for freechat's new auth/dispatch model
2020-06-01 22:25:01 -07:00
shockrah
c98d6dc503
Dependancies moving to full asynchronous libraries
2020-06-01 22:19:06 -07:00
shockrah
5a2a87fff7
/channels/list/voice + text now implemted and ready for testing
2020-05-27 21:29:57 -07:00
shockrah
e99e30b45c
Moved VOICE_CHANNEL & TEXT_CHANNEL const's to channels module
2020-05-27 21:29:27 -07:00
shockrah
4e61ddbe11
New smol note regarding state of API server
2020-05-27 20:59:17 -07:00
shockrah
cc22a56538
Removed used Generic error response
2020-05-27 19:59:01 -07:00
shockrah
db901010b0
prefixed route uri for get_voice_channels and get_text_channels with /list to be more specific to their behavior
2020-05-25 13:48:16 -07:00
shockrah
d9ac6c08a2
experimental generic error handler
2020-05-25 13:46:57 -07:00
shockrah
a14b7dd677
removed old web files which are no longer used
2020-05-22 16:26:22 -07:00
shockrah
13ab387a93
new test for encode params
2020-05-20 02:05:43 -07:00
shockrah
97e6b026cc
utils::new_key now has a larger entropy pool + is generally smaller/quicker
...
encode params takes a &[u8] as parameter now instead of &str
utils::decode_params removed for now as it has not real use atm
2020-05-20 02:05:06 -07:00
shockrah
4f64fc3a13
utils::decode_params now uses the same config as utils::encode_params
2020-05-20 01:21:01 -07:00
shockrah
40d4720977
Helper function in test::auth to quickly build fake users
...
New test to verify correct behavior of '/auth/login' route
2020-05-20 00:50:46 -07:00
shockrah
ab4fe70081
test::auth::mysql_conn helper function for mysql connections
...
test::auth::feed_n_leave added form header and cleaned up post parameters
test::auth::dummy_leave standalone test for route => /auth/leave
2020-05-19 21:48:13 -07:00
shockrah
f12048b49b
utils::encode_param now encodes data without padding
2020-05-19 21:46:17 -07:00
shockrah
84ccfff2aa
auth::login now emites a url safe api session key
...
models::_USER_ONLINE updated to suppress unused var warnings
2020-05-19 20:15:53 -07:00
shockrah
895d7246f0
auth::create_new_session_key => impl not tested
...
auth::login now generates a 500 on db insertion failure
auth::login returning single json value instead of full struct
2020-05-19 20:13:56 -07:00
shockrah
87fc6700a4
models::InsertableSession added for session creation
2020-05-19 20:10:39 -07:00
shockrah
ec4f9b5302
using secret as primary key
2020-05-19 20:08:26 -07:00
shockrah
b007f57dfe
priv auth::blind_remove_session => impl not tested
...
pub auth::login => impl not tested
2020-05-19 19:36:29 -07:00
shockrah
dcb9e9641e
Skeleton code for login route handler
...
Helper functions to be written in next commits
2020-05-17 16:15:53 -07:00
shockrah
2b9635a2b1
removed auto_increment
from session key id
...
Keys are to be generated by rust safely
2020-05-17 16:15:27 -07:00
shockrah
9e59d8200d
added generated code from diesel migration run
for sessions
2020-05-17 16:05:45 -07:00
shockrah
883a007371
mod::rand_utils no longer exists
2020-05-17 16:05:21 -07:00
shockrah
f30a8abfc5
Removed old irrelevant comment
2020-05-17 16:05:01 -07:00
shockrah
9c03207489
Basic sessions schema which is used as a api key cache
2020-05-17 16:04:43 -07:00
shockrah
0340204141
moved rand_utils::new_key to utils crate
2020-05-10 13:06:54 -07:00
shockrah
bd45508584
base64 encode/decode functions added for sake of usage simplicity
...
URL_SAFE encoding is used
Both functions seem to pass the tests as well
2020-05-10 13:02:59 -07:00
shockrah
11669840b2
Adding base64
2020-05-10 12:56:55 -07:00
shockrah
68d864710a
Finished a test for using an invite via the /invite/join/<code> route
2020-05-10 12:56:38 -07:00
shockrah
52119d3ea7
Adding base64 to send/receive api_keys
...
Keys can contain special chars so we're preserving our entropy pool by encoding to url_safe chars before sending
2020-05-10 12:55:42 -07:00
shockrah
4703116e32
Verified that the join function is working as intended
2020-05-07 22:14:44 -07:00
shockrah
cd41dc64c3
create_new_user
no longer checks id column when comparing against unix timestamps
2020-05-07 22:14:26 -07:00