Browse Source

Log username and password

no-contract-setup-message
Philipp Hoenisch 3 years ago
parent
commit
88554de160
No known key found for this signature in database GPG Key ID: E5F8E74C672BC666
  1. 4
      daemon/src/auth.rs
  2. 7
      daemon/src/maker.rs

4
daemon/src/auth.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),

7
daemon/src/maker.rs

@ -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.

Loading…
Cancel
Save