feat: with authorization

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-05-27 13:12:29 +02:00
parent 1d4cda7c48
commit e991caef73
21 changed files with 2073 additions and 1186 deletions

View File

@@ -10,9 +10,9 @@ como_core = { path = "../como_core" }
como_domain = { path = "../como_domain" }
como_infrastructure = { path = "../como_infrastructure" }
async-graphql = "4.0.6"
async-graphql-axum = "*"
axum = "0.5.13"
async-graphql = "5.0.9"
async-graphql-axum = "5.0.9"
axum.workspace = true
axum-extra = { version = "*", features = ["cookie", "cookie-private"] }
axum-sessions = { version = "*" }
serde = { version = "1.0", features = ["derive"] }

View File

@@ -4,8 +4,6 @@ use como_domain::{
item::{
queries::{GetItemQuery, GetItemsQuery},
requests::CreateItemDto,
responses::CreatedItemDto,
ItemDto,
},
projects::{
queries::{GetProjectQuery, GetProjectsQuery},

View File

@@ -21,6 +21,14 @@ pub async fn graphql_handler(
Ok(schema.execute(req).await.into())
}
//fn get_token_from_headers(headers: &HeaderMap) -> Option<Token> {
// headers.get("Authorization").and_then(|value| {
// let value = value.to_str().ok()?;
// let value = value.strip_prefix("Bearer ")?;
// Some(Token(value.to_string()))
// })
//}
pub async fn graphql_playground() -> impl IntoResponse {
Html(playground_source(GraphQLPlaygroundConfig::new("/graphql")))
}