Only protect inbox with digest&sig verification

This commit is contained in:
asonix 2020-03-15 23:26:31 -05:00
parent 9fdd3bec18
commit 954e8968db

View file

@ -89,17 +89,20 @@ async fn main() -> Result<(), anyhow::Error> {
let client = Client::default(); let client = Client::default();
App::new() App::new()
.wrap(VerifyDigest::new(Sha256::new()))
.wrap(VerifySignature::new(
MyVerify(state.clone(), client.clone()),
Default::default(),
))
.wrap(Logger::default()) .wrap(Logger::default())
.data(actor) .data(actor)
.data(state.clone()) .data(state.clone())
.data(client) .data(client.clone())
.service(web::resource("/").route(web::get().to(index))) .service(web::resource("/").route(web::get().to(index)))
.service(web::resource("/inbox").route(web::post().to(inbox::inbox))) .service(
web::resource("/inbox")
.wrap(VerifyDigest::new(Sha256::new()))
.wrap(VerifySignature::new(
MyVerify(state.clone(), client),
Default::default(),
))
.route(web::post().to(inbox::inbox)),
)
.service(web::resource("/actor").route(web::get().to(actor_route))) .service(web::resource("/actor").route(web::get().to(actor_route)))
.service(actix_webfinger::resource::<_, RelayResolver>()) .service(actix_webfinger::resource::<_, RelayResolver>())
}) })