From 10fbaaddb876ebe1bc2ece6eb13a1e25ea6d2126 Mon Sep 17 00:00:00 2001 From: Alex Wright Date: Sun, 23 Feb 2020 20:18:00 +0100 Subject: [PATCH] Little clean up --- src/main.rs | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/main.rs b/src/main.rs index a6ca2a4..48ce23c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,15 +6,11 @@ extern crate ldap3; extern crate tokio; #[macro_use] extern crate log; -use log::Level; -#[macro_use] extern crate serde_derive; use std::env; -use std::io; use std::fs; -use std::fs::File; use std::path::Path; use std::str::{ FromStr, @@ -28,13 +24,8 @@ use hyper::header::{AUTHORIZATION}; use hyper_router::{Route, RouterBuilder, RouterService}; use base64::decode; -use ring::signature::RsaKeyPair; use biscuit::{ - ClaimsSet, Empty, - JWT, - RegisteredClaims, - SingleOrMultiple, }; use biscuit::jwa::{ SignatureAlgorithm, @@ -47,14 +38,8 @@ use biscuit::jwk::{ JWK, JWKSet, }; -use biscuit::jws::{ - Secret, - RegisteredHeader, -}; use num::BigUint; -use openssl::bn::BigNum; use openssl::rsa::Rsa; -use openssl::rsa::RsaPrivateKeyBuilder; use ldap3::{ LdapConn, Scope, SearchEntry }; @@ -210,10 +195,6 @@ fn get_keys(_req: Request) -> Response { let jwks: Vec> = fs::read_dir("./").unwrap() .filter_map(|dir_entry| { let path = dir_entry.unwrap().path(); - let filename = match path.file_name() { - Some(filename) => filename.to_str().unwrap().to_owned(), - None => return None, - }; let ext = match path.extension() { Some(ext) => ext.to_str().unwrap().to_owned(), None => return None, @@ -242,9 +223,9 @@ fn hello(_req: Request) -> Response { fn router_service() -> Result { let router = RouterBuilder::new() - .add(Route::get("/hello").using(hello)) + .add(Route::get("/").using(hello)) .add(Route::post("/auth").using(auth_handler)) - .add(Route::get("/oauth2/certs").using(get_keys)) + .add(Route::get("/oauth2/keys").using(get_keys)) .build(); Ok(RouterService::new(router)) } @@ -261,6 +242,6 @@ fn main() { .serve(router_service) .map_err(|e| eprintln!("server error: {}", e)); - println!("Listening on http://{}", addr); + info!("Listening on http://{}", addr); tokio::run(server); }