Browse Source
Merge pull request #107 from comit-network/authentication-logging
no-contract-setup-message
Philipp Hoenisch
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
2 deletions
-
daemon/src/auth.rs
-
daemon/src/maker.rs
|
|
@ -10,6 +10,8 @@ use std::str::FromStr; |
|
|
|
/// A request guard that can be included in handler definitions to enforce authentication.
|
|
|
|
pub struct Authenticated {} |
|
|
|
|
|
|
|
pub const MAKER_USERNAME: &str = "maker"; |
|
|
|
|
|
|
|
#[derive(Debug)] |
|
|
|
pub enum Error { |
|
|
|
UnknownUser(String), |
|
|
@ -62,7 +64,7 @@ impl<'r> FromRequest<'r> for Authenticated { |
|
|
|
.await |
|
|
|
.map_failure(|(status, _)| (status, Error::MissingPassword))); |
|
|
|
|
|
|
|
if basic_auth.username != "maker" { |
|
|
|
if basic_auth.username != MAKER_USERNAME { |
|
|
|
return Outcome::Failure(( |
|
|
|
Status::Unauthorized, |
|
|
|
Error::UnknownUser(basic_auth.username), |
|
|
|
|
|
@ -1,3 +1,4 @@ |
|
|
|
use crate::auth::MAKER_USERNAME; |
|
|
|
use crate::maker_cfd_actor::Command; |
|
|
|
use crate::seed::Seed; |
|
|
|
use crate::wallet::Wallet; |
|
|
@ -89,7 +90,11 @@ async fn main() -> Result<()> { |
|
|
|
|
|
|
|
let auth_password = seed.derive_auth_password::<auth::Password>(); |
|
|
|
|
|
|
|
println!("Auth password: {}", auth_password); |
|
|
|
tracing::info!( |
|
|
|
"Authentication details: username='{}' password='{}'", |
|
|
|
MAKER_USERNAME, |
|
|
|
auth_password |
|
|
|
); |
|
|
|
|
|
|
|
let oracle = schnorrsig::KeyPair::new(SECP256K1, &mut rand::thread_rng()); // TODO: Fetch oracle public key from oracle.
|
|
|
|
|
|
|
|