Fixes!
parent: tbd commit: 398622e
1 | use Error; |
2 | use Error; |
3 | |
4 | use crate |
5 | AuthenticationTokenRequest, RegisterAccountRequest, TokenExtensionRequest, |
6 | ; |
7 | use crate; |
8 | use crate; |
9 | |
10 | use ConnectionState; |
11 | use HandlerUnhandled; |
12 | |
13 | pub async |
14 | message_type: &str, |
15 | message: &NetworkMessage, |
16 | state: &ConnectionState, |
17 | |
18 | match message_type |
19 | "&giterated_daemon::messages::authentication::RegisterAccountRequest" => |
20 | register_account_request |
21 | .handle_message |
22 | .await |
23 | |
24 | "&giterated_daemon::messages::authentication::AuthenticationTokenRequest" => |
25 | authentication_token_request |
26 | .handle_message |
27 | .await |
28 | |
29 | "&giterated_daemon::messages::authentication::TokenExtensionRequest" => |
30 | token_extension_request |
31 | .handle_message |
32 | .await |
33 | |
34 | _ => Err, |
35 | |
36 | |
37 | |
38 | async |
39 | State | : ,
40 | Message | : ,
41 | instance: AuthenticatedInstance, |
42 | |
43 | if *instance.inner != connection_state.instance |
44 | return Err; |
45 | |
46 | |
47 | let mut user_backend = connection_state.user_backend.lock .await; |
48 | |
49 | let response = user_backend |
50 | .register |
51 | .await |
52 | .map_err?; |
53 | drop; |
54 | |
55 | connection_state |
56 | .send |
57 | .await |
58 | .map_err?; |
59 | |
60 | Ok |
61 | |
62 | |
63 | async |
64 | State | : ,
65 | Message | : ,
66 | instance: AuthenticatedInstance, |
67 | |
68 | let issued_for = instance.inner .clone; |
69 | |
70 | let mut token_granter = connection_state.auth_granter.lock .await; |
71 | |
72 | let response = token_granter |
73 | .token_request |
74 | .await |
75 | .map_err?; |
76 | |
77 | connection_state |
78 | .send |
79 | .await |
80 | .map_err?; |
81 | |
82 | Ok |
83 | |
84 | |
85 | async |
86 | State | : ,
87 | Message | : ,
88 | instance: AuthenticatedInstance, |
89 | |
90 | let issued_for = instance.inner .clone; |
91 | |
92 | let mut token_granter = connection_state.auth_granter.lock .await; |
93 | |
94 | let response = token_granter |
95 | .extension_request |
96 | .await |
97 | .map_err?; |
98 | |
99 | connection_state |
100 | .send |
101 | .await |
102 | .map_err?; |
103 | |
104 | Ok |
105 | |
106 | |
107 | |
108 | |
109 | |
110 | InvalidRequest, |
111 | |
112 | SameInstance, |
113 | |
114 | Registration, |
115 | |
116 | Sending, |
117 | |
118 | TokenIssuance, |
119 | |
120 |