Compare commits
No commits in common. "3cb7293c365e5ed531a11cf7d61938d6c631aeb6" and "296e57b7eb9fb3c7ced35f56aced3c9d3273d2c7" have entirely different histories.
3cb7293c36
...
296e57b7eb
4 changed files with 19 additions and 21 deletions
|
@ -11,8 +11,8 @@ can correlate user information across services.
|
||||||
|
|
||||||
1. build binary with `cargo`
|
1. build binary with `cargo`
|
||||||
|
|
||||||
2. fill out `config.yml.sample`. The server expects a file called
|
2. fill out `config.toml.sample`. The server expects a file called
|
||||||
`config.yml` in its working directory.
|
`config.toml` in its working directory.
|
||||||
|
|
||||||
3. Generate the keypair for signing JWT tokens with:
|
3. Generate the keypair for signing JWT tokens with:
|
||||||
```bash
|
```bash
|
||||||
|
|
13
config.sample.toml
Normal file
13
config.sample.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
host = "0.0.0.0"
|
||||||
|
port = 8000
|
||||||
|
issuer_uri = "http://localhost:8000/"
|
||||||
|
issuer_name = "My Issuer"
|
||||||
|
salt = "SOMETHING SOMETHING"
|
||||||
|
rsa_key_file = "rsa-key.pk8"
|
||||||
|
|
||||||
|
[clients]
|
||||||
|
|
||||||
|
[clients.a1]
|
||||||
|
name = "a1.example.com"
|
||||||
|
client_secret = "SECRET"
|
||||||
|
redirect_uris = ["https://a1.example.com/cb"]
|
|
@ -1,17 +0,0 @@
|
||||||
host: "0.0.0.0"
|
|
||||||
port: 8000
|
|
||||||
issuer_uri: "https://anon.my-org.invalid"
|
|
||||||
issuer_name: "My Org"
|
|
||||||
salt: "longhexstringdeadbeefsomething"
|
|
||||||
rsa_key_file: "rsa-key.pk8"
|
|
||||||
|
|
||||||
clients:
|
|
||||||
service1:
|
|
||||||
name: "Service 1"
|
|
||||||
client_secret: "abcd"
|
|
||||||
redirect_uris: ["https://service1/redirect"]
|
|
||||||
|
|
||||||
service2:
|
|
||||||
name: "Service 2"
|
|
||||||
client_secret: "2222"
|
|
||||||
redirect_uris: ["http://service2/redirect"]
|
|
|
@ -518,6 +518,7 @@ pub struct AppStateRaw {
|
||||||
pub total_logins: AtomicUsize,
|
pub total_logins: AtomicUsize,
|
||||||
pub successful_logins: AtomicUsize,
|
pub successful_logins: AtomicUsize,
|
||||||
pub expired_logins: AtomicUsize,
|
pub expired_logins: AtomicUsize,
|
||||||
|
pub server_errors: AtomicUsize,
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppState = Arc<AppStateRaw>;
|
type AppState = Arc<AppStateRaw>;
|
||||||
|
@ -538,7 +539,7 @@ pub struct Authorization {
|
||||||
|
|
||||||
#[async_std::main]
|
#[async_std::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
log::with_level(log::LevelFilter::Error);
|
log::with_level(log::LevelFilter::Debug);
|
||||||
|
|
||||||
let mut conf_file =
|
let mut conf_file =
|
||||||
File::open(env::var("CONFIG_FILE").unwrap_or("config.yml".to_owned())).await?;
|
File::open(env::var("CONFIG_FILE").unwrap_or("config.yml".to_owned())).await?;
|
||||||
|
@ -558,6 +559,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
total_logins: AtomicUsize::new(0),
|
total_logins: AtomicUsize::new(0),
|
||||||
successful_logins: AtomicUsize::new(0),
|
successful_logins: AtomicUsize::new(0),
|
||||||
expired_logins: AtomicUsize::new(0),
|
expired_logins: AtomicUsize::new(0),
|
||||||
|
server_errors: AtomicUsize::new(0),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
app.with(tide::utils::After(error_handler));
|
app.with(tide::utils::After(error_handler));
|
||||||
|
@ -573,7 +575,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
app.at("/new-account").get(create_account_endpoint);
|
app.at("/new-account").get(create_account_endpoint);
|
||||||
app.at("/metrics").get(metrics_endpoint);
|
app.at("/metrics").get(metrics_endpoint);
|
||||||
|
|
||||||
auto_serve_dir!(app, "/static", "static", 51200);
|
auto_serve_dir!(app, "/static", "static");
|
||||||
|
|
||||||
println!("Server started at {}", &bind_address);
|
println!("Server started at {}", &bind_address);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue