im
Clone
https://git.tahinli.com/Tahinli/im.git
0 watching0 forksRustAGPL-3.0542.8 KiBb9f0726Tahinli27 days ago34 commits
| 1 | //! The machine API of `im` (`docs/contracts.md` sections 3 and 4): the people directory and its change |
| 2 | //! stream, the profile photos, and the service switcher list. |
| 3 | //! |
| 4 | //! Every route here needs a client-credentials token that `im` issued to a family service, with the |
| 5 | //! audience `im` and the scope the route needs (`machine_auth.rs`). Errors are JSON with a real status |
| 6 | //! (contracts section 7): `{"error": ..., "message": ...}`. |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | use WWW_AUTHENTICATE; |
| 17 | use json; |
| 18 | use Response; |
| 19 | use ; |
| 20 | |
| 21 | use cratejson_response; |
| 22 | |
| 23 | /// The `WWW-Authenticate` challenge of a token that is missing or not valid for this service. |
| 24 | pub const TOKEN_CHALLENGE: &str = "Bearer error=\"invalid_token\""; |
| 25 | |
| 26 | /// The `WWW-Authenticate` challenge of a valid token that lacks the scope a route needs. |
| 27 | pub const SCOPE_CHALLENGE: &str = "Bearer error=\"insufficient_scope\""; |
| 28 | |
| 29 | /// A machine error: the status, the stable word, a message for logs, and the challenge of a 401 or 403. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | /// `404 not_found` for a route that has no such thing. |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 |