OpenID routes

Co-Authored-By: Matthias Ahouansou <matthias@ahouansou.cz>
This commit is contained in:
mikoto
2024-05-28 00:22:11 +02:00
committed by Matthias Ahouansou
parent 47aadcea1d
commit a888c7cb16
10 changed files with 127 additions and 4 deletions

View File

@@ -598,6 +598,16 @@ impl Service {
) -> Result<Option<FilterDefinition>> {
self.db.get_filter(user_id, filter_id)
}
// Creates an OpenID token, which can be used to prove that a user has access to an account (primarily for integrations)
pub fn create_openid_token(&self, user_id: &UserId) -> Result<(String, u64)> {
self.db.create_openid_token(user_id)
}
/// Find out which user an OpenID access token belongs to.
pub fn find_from_openid_token(&self, token: &str) -> Result<Option<OwnedUserId>> {
self.db.find_from_openid_token(token)
}
}
/// Ensure that a user only sees signatures from themselves and the target user