-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add a stub handler for the registration endpoint * Add extractors for registration endpoints Also we now use the `Bytes` and `Json` extractors to read the payload. The payload size limit is configured through the respective extractor config objects. * Increment ua.command.register metric * Implement router registration * Store the user in the database during registration * Add the channel to the database and accept more data in the request body * Move make_endpoint to the common code and use in user registration * Generate a secret for future requests and return the registration data * Fix an incorrect expression value and missing current_month value * Support compiling with OpenSSL 1.0 The `sign_oneshot_to_vec` method is only available with OpenSSL >=1.1.1. * Add logging to register_uaid_route * Use hyphenated UUIDs in the message table "chids" column * Fix errors after rebase * Simplify endpoint creation * Use the lowercase hyphenated formatter (default) when returning UUIDs Closes #176 Co-authored-by: JR Conlin <[email protected]>
- Loading branch information
1 parent
e55b977
commit 6df3e36
Showing
21 changed files
with
438 additions
and
89 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::error::{ApiError, ApiErrorKind}; | ||
use crate::extractors::routers::RouterType; | ||
use actix_web::dev::{Payload, PayloadStream}; | ||
use actix_web::{FromRequest, HttpRequest}; | ||
use futures::future; | ||
|
||
/// Extracts and validates the `router_type` and `app_id` path arguments | ||
pub struct RegistrationPathArgs { | ||
pub router_type: RouterType, | ||
pub app_id: String, | ||
} | ||
|
||
impl FromRequest for RegistrationPathArgs { | ||
type Error = ApiError; | ||
type Future = future::Ready<Result<Self, Self::Error>>; | ||
type Config = (); | ||
|
||
fn from_request(req: &HttpRequest, _: &mut Payload<PayloadStream>) -> Self::Future { | ||
let match_info = req.match_info(); | ||
let router_type = match match_info | ||
.get("router_type") | ||
.expect("{router_type} must be part of the path") | ||
.parse::<RouterType>() | ||
{ | ||
Ok(router_type) => router_type, | ||
Err(_) => return future::err(ApiErrorKind::InvalidRouterType.into()), | ||
}; | ||
let app_id = match_info | ||
.get("app_id") | ||
.expect("{app_id} must be part of the path") | ||
.to_string(); | ||
|
||
future::ok(Self { | ||
router_type, | ||
app_id, | ||
}) | ||
} | ||
} |
Oops, something went wrong.