summaryrefslogtreecommitdiff
path: root/server/src/fake_auth.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-11-25 12:35:35 -0500
committerKjetil Orbekk <kj@orbekk.com>2022-11-25 12:35:35 -0500
commit9d191019757eae3bba45e8e1a021fefdc69a9fae (patch)
treedcb6d7d6e7a3aa726650e401b92e8484e049ff32 /server/src/fake_auth.rs
parentf4713b1ccf508c0ec1192ce8d800f21111e655e1 (diff)
Add fake authenticator
Diffstat (limited to 'server/src/fake_auth.rs')
-rw-r--r--server/src/fake_auth.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/fake_auth.rs b/server/src/fake_auth.rs
new file mode 100644
index 0000000..5ef9cc8
--- /dev/null
+++ b/server/src/fake_auth.rs
@@ -0,0 +1,33 @@
+use std::collections::HashMap;
+
+use async_trait::async_trait;
+
+use crate::{
+ auth::{AuthenticatedSession, Authenticator, SessionId},
+ error::{self, BridgeError},
+};
+
+pub struct FakeAuthenticator {}
+
+#[async_trait]
+impl Authenticator for FakeAuthenticator {
+ async fn user_info(
+ &self,
+ session: &mut AuthenticatedSession,
+ ) -> Result<String, error::BridgeError> {
+ Err(BridgeError::NotLoggedIn)
+ }
+
+ async fn authenticate(
+ &self,
+ pool: &sqlx::PgPool,
+ session_id: SessionId,
+ auth_params: HashMap<String, String>,
+ ) -> Result<AuthenticatedSession, error::BridgeError> {
+ Err(BridgeError::Internal("not implemented".to_string()))
+ }
+
+ async fn get_login_url(&self) -> (SessionId, reqwest::Url) {
+ todo!()
+ }
+}