Major post-refactor cleanup
parent: tbd commit: f90d7fb
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: &NetworkMessage, |
15 | state: &ConnectionState, |
16 | |
17 | if register_account_request |
18 | .handle_message |
19 | .await |
20 | .is_ok |
21 | |
22 | Ok |
23 | else if authentication_token_request |
24 | .handle_message |
25 | .await |
26 | .is_ok |
27 | |
28 | Ok |
29 | else if token_extension_request |
30 | .handle_message |
31 | .await |
32 | .is_ok |
33 | |
34 | Ok |
35 | else |
36 | Err |
37 | |
38 | |
39 | |
40 | async |
41 | State | : ,
42 | Message | : ,
43 | instance: AuthenticatedInstance, |
44 | |
45 | if *instance.inner != connection_state.instance |
46 | return Err; |
47 | |
48 | |
49 | let mut user_backend = connection_state.user_backend.lock .await; |
50 | |
51 | let response = user_backend |
52 | .register |
53 | .await |
54 | .map_err?; |
55 | drop; |
56 | |
57 | connection_state |
58 | .send |
59 | .await |
60 | .map_err?; |
61 | |
62 | Ok |
63 | |
64 | |
65 | async |
66 | State | : ,
67 | Message | : ,
68 | instance: AuthenticatedInstance, |
69 | |
70 | let issued_for = instance.inner .clone; |
71 | |
72 | let mut token_granter = connection_state.auth_granter.lock .await; |
73 | |
74 | let response = token_granter |
75 | .token_request |
76 | .await |
77 | .map_err?; |
78 | |
79 | connection_state |
80 | .send |
81 | .await |
82 | .map_err?; |
83 | |
84 | Ok |
85 | |
86 | |
87 | async |
88 | State | : ,
89 | Message | : ,
90 | instance: AuthenticatedInstance, |
91 | |
92 | let issued_for = instance.inner .clone; |
93 | |
94 | let mut token_granter = connection_state.auth_granter.lock .await; |
95 | |
96 | let response = token_granter |
97 | .extension_request |
98 | .await |
99 | .map_err?; |
100 | |
101 | connection_state |
102 | .send |
103 | .await |
104 | .map_err?; |
105 | |
106 | Ok |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | InvalidRequest, |
113 | |
114 | SameInstance, |
115 | |
116 | Registration, |
117 | |
118 | Sending, |
119 | |
120 | TokenIssuance, |
121 | |
122 |