Skip to content

actix - not found in this scope #581

@danieldevalois

Description

@danieldevalois

use actix_web::{get, App, HttpResponse, HttpServer, Responder};

#[cfg(feature = "actix")]
use zitadel::actix::introspection::{IntrospectedUser, IntrospectionConfigBuilder};

#[get("/unauthed")]
async fn unauthed() -> impl Responder {
println!("Hello Unauthorized User!");
HttpResponse::Ok().body("Hello Unauthorized User!")
}

#[get("/authed")]
async fn authed(user: IntrospectedUser) -> impl Responder {
println!("Hello Authorized User!");
format!(
"Hello Authorized {:?} with id {}",
user.username, user.user_id
)
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
println!("Starting server.");
#[cfg(feature = "actix")]
let auth = IntrospectionConfigBuilder::new("https://zitadel-libraries-l8boqa.zitadel.cloud")
.with_basic_auth(
"194339055499018497@zitadel_rust_test",
"Ip56oGzxKL1rJ8JaleUVKL7qUlpZ1tqHQYRSd6JE1mTlTJ3pDkDzoObHdZsOg88B",
)
.build()
.await
.unwrap();
HttpServer::new(move || {
App::new()
.app_data(auth.clone())
.service(unauthed)
.service(authed)
})
.bind(("0.0.0.0", 8080))?
.run()
.await
}

.app_data(auth.clone())
| ^^^^^^^^ not found in this scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions