summaryrefslogtreecommitdiff
path: root/server/src/auth.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-11-25 14:09:09 -0500
committerKjetil Orbekk <kj@orbekk.com>2022-11-25 14:09:09 -0500
commit2f35026022827cd86615135c6397f03b74fe1b46 (patch)
tree17c96f91330003aace047ae6b84aabd876d0ee5a /server/src/auth.rs
parent9d191019757eae3bba45e8e1a021fefdc69a9fae (diff)
Hook up fake authenticator backend for testing
Diffstat (limited to 'server/src/auth.rs')
-rw-r--r--server/src/auth.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/src/auth.rs b/server/src/auth.rs
index 7222199..fc0de62 100644
--- a/server/src/auth.rs
+++ b/server/src/auth.rs
@@ -42,6 +42,24 @@ pub struct AuthenticatedSession {
refresh_token: RefreshToken,
}
+impl AuthenticatedSession {
+ pub fn new(
+ player_id: String,
+ session_id: SessionId,
+ expiration: DateTime<Utc>,
+ access_token: AccessToken,
+ refresh_token: RefreshToken,
+ ) -> Self {
+ Self {
+ player_id,
+ session_id,
+ expiration,
+ access_token,
+ refresh_token,
+ }
+ }
+}
+
#[async_trait]
pub trait Authenticator {
async fn user_info(&self, session: &mut AuthenticatedSession) -> Result<String, BridgeError>;
@@ -273,7 +291,7 @@ impl Authenticator for OauthAuthenticator {
}
}
-async fn store_authenticated_session(
+pub async fn store_authenticated_session(
pool: &PgPool,
session: &mut AuthenticatedSession,
) -> Result<(), BridgeError> {