diff --git a/src/app/args.rs b/src/app/args.rs
index 5deb639699e514f77384732bb7d6fa87ce8ac32a..8bd54ee2aa9c580a3c01c3c6a81668f7112a8530 100644
--- a/src/app/args.rs
+++ b/src/app/args.rs
@@ -23,4 +23,10 @@ pub struct AppArgs {
 
     #[structopt(long = "certs_dir", default_value = "/etc/letsencrypt/live")]
     pub ssl_certs_dir: PathBuf,
+
+    #[structopt(short = "u", long = "username", default_value = "admin")]
+    pub admin_id: String,
+
+    #[structopt(short = "p", long = "password", default_value = "password")]
+    pub admin_pwd: String,
 }
diff --git a/src/app/config.rs b/src/app/config.rs
index 97e519bbb7d41bc2c1b359209d8897cfd97647ca..f4c026d066beaa3a65cf32c14651ff7b6364141d 100644
--- a/src/app/config.rs
+++ b/src/app/config.rs
@@ -18,6 +18,8 @@ pub struct AppConfig {
     pub port_tls: u16,
     pub load: Option<PathBuf>,
     pub ssl_certs_dir: PathBuf,
+    pub admin_id: String,
+    pub admin_pwd: String,
 }
 
 impl AppConfig {
@@ -57,6 +59,8 @@ impl AppConfig {
             port_tls: app_args.port_tls,
             load: app_args.load,
             ssl_certs_dir,
+            admin_id: app_args.admin_id,
+            admin_pwd: app_args.admin_pwd,
         }
     }
     pub fn get_log_level(&self) -> String {
diff --git a/src/main.rs b/src/main.rs
index ab89dc2bbdf8c047349775375ad5069303748815..b1c536e401f3d4819fd914e238c0008f1a0a5af8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,4 +1,5 @@
 mod app;
+mod middleware;
 mod service;
 mod static_files;
 mod testing;
diff --git a/src/middleware/authentication.rs b/src/middleware/authentication.rs
new file mode 100644
index 0000000000000000000000000000000000000000..b5516b36e3a6c719d2cb0b4b21b3db690f4bb596
--- /dev/null
+++ b/src/middleware/authentication.rs
@@ -0,0 +1,52 @@
+use actix_web::{
+    dev::{forward_ready, Service, ServiceRequest, ServiceResponse, Transform},
+    Error,
+};
+use futures::prelude::future::LocalBoxFuture;
+use std::future::{ready, Ready};
+
+pub struct AuthData;
+
+impl<S, B> Transform<S, ServiceRequest> for AuthData
+where
+    S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
+    S::Future: 'static,
+    B: 'static,
+{
+    type Response = ServiceResponse<B>;
+    type Error = Error;
+    type InitError = ();
+    type Transform = AuthenticatedMiddleware<S>;
+    type Future = Ready<Result<Self::Transform, Self::InitError>>;
+
+    fn new_transform(&self, service: S) -> Self::Future {
+        ready(Ok(AuthenticatedMiddleware { service }))
+    }
+}
+
+pub struct AuthenticatedMiddleware<S> {
+    service: S,
+}
+
+impl<S, B> Service<ServiceRequest> for AuthenticatedMiddleware<S>
+where
+    S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
+    S::Future: 'static,
+    B: 'static,
+{
+    type Response = ServiceResponse<B>;
+    type Error = Error;
+    type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
+
+    forward_ready!(service);
+
+    fn call(&self, req: ServiceRequest) -> Self::Future {
+        println!("AUTH MW");
+        let fut = self.service.call(req);
+        Box::pin(async move {
+            let res = fut.await?;
+            println!("RESP");
+            Ok(res)
+        })
+    }
+}
diff --git a/src/middleware/mod.rs b/src/middleware/mod.rs
new file mode 100644
index 0000000000000000000000000000000000000000..dcdaf33c20222ae9f29f18dcf3a8ea31344571c5
--- /dev/null
+++ b/src/middleware/mod.rs
@@ -0,0 +1,2 @@
+mod authentication;
+pub use authentication::*;