forked from trustification/trustification
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: carlosthe19916 <[email protected]>
- Loading branch information
1 parent
fcac5dc
commit bcc8dfa
Showing
13 changed files
with
326 additions
and
10 deletions.
There are no files selected for viewing
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,35 @@ | ||
use actix_web::{web, HttpResponse}; | ||
use actix_web_httpauth::extractors::bearer::BearerAuth; | ||
use bytes::Bytes; | ||
use tracing::instrument; | ||
use uuid::Uuid; | ||
|
||
use crate::app_state::AppState; | ||
|
||
#[derive(Debug, serde::Deserialize, utoipa::IntoParams)] | ||
pub struct PostParams { | ||
/// Access token to use for authentication | ||
pub token: Option<String>, | ||
} | ||
|
||
#[utoipa::path( | ||
post, | ||
path = "/api/v1/sbom/upload", | ||
responses( | ||
(status = OK, description = "SBOM was uploaded"), | ||
), | ||
params(PostParams) | ||
)] | ||
#[instrument(skip(state, access_token))] | ||
pub async fn post( | ||
data: Bytes, | ||
state: web::Data<AppState>, | ||
web::Query(PostParams { token }): web::Query<PostParams>, | ||
access_token: Option<BearerAuth>, | ||
) -> actix_web::Result<HttpResponse> { | ||
let id = Uuid::new_v4().to_string(); | ||
|
||
let token = token.or_else(|| access_token.map(|s| s.token().to_string())); | ||
state.post_sbom(&id, &token, data).await?; | ||
Ok(HttpResponse::Ok().body(id)) | ||
} |
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ pub enum AppRoute { | |
}, | ||
Advisory(View), | ||
Scanner, | ||
Uploader, | ||
Search { | ||
terms: String, | ||
}, | ||
|
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
Oops, something went wrong.