Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mozilla-iam/dino-park-gate

DinoPark Gate (controlling Dinos since 2019)
https://github.com/mozilla-iam/dino-park-gate

Last synced: about 1 month ago
JSON representation

DinoPark Gate (controlling Dinos since 2019)

Awesome Lists containing this project

README

        

# DinoPark Gate (controlling Dinos since 2019)
[![Build Status](https://travis-ci.org/mozilla-iam/dino-park-gate.svg?branch=master)](https://travis-ci.org/mozilla-iam/dino-park-gate)

## A basic authentication middleware for [actix-web](https://actix.rs/)

```rust
use actix_web::{web, App, HttpRequest, HttpServer, Responder};
use dino_park_gate::provider::Provider;
use dino_park_gate::simple::SimpleAuth;

async fn root(_: HttpRequest) -> impl Responder {
"Authorized!"
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
let provider = Provider::from_issuer("https://auth.mozilla.auth0.com/")
.await
.unwrap();
HttpServer::new(move || {
let auth = SimpleAuth {
checker: provider.clone(),
validation_options: Default::default(),
};
App::new().wrap(auth).service(web::resource("/").to(root))
})
.workers(1)
.bind("127.0.0.1:8000")?
.run()
.await
}
```