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