summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-06-18 13:40:31 -0400
committermrw1593 <botahamec@outlook.com>2023-06-18 13:40:31 -0400
commit3feb8911aeff353238f6fdb8f71d4b970625b28d (patch)
tree3450e35ce38921259839d57d570fc19b1c906751 /src/services
parentac7317226405fc90e8439a0c1bef91cecd539d02 (diff)
Implement the client credentials flow
Diffstat (limited to 'src/services')
-rw-r--r--src/services/db/jwt.rs4
-rw-r--r--src/services/jwt.rs6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/services/db/jwt.rs b/src/services/db/jwt.rs
index a3edef2..b2f1367 100644
--- a/src/services/db/jwt.rs
+++ b/src/services/db/jwt.rs
@@ -81,7 +81,7 @@ pub async fn create_auth_code<'c>(
pub async fn create_access_token<'c>(
executor: impl Executor<'c, Database = MySql>,
jti: Uuid,
- auth_code: Uuid,
+ auth_code: Option<Uuid>,
exp: DateTime<Utc>,
) -> Result<(), sqlx::Error> {
query!(
@@ -100,7 +100,7 @@ pub async fn create_access_token<'c>(
pub async fn create_refresh_token<'c>(
executor: impl Executor<'c, Database = MySql>,
jti: Uuid,
- auth_code: Uuid,
+ auth_code: Option<Uuid>,
exp: DateTime<Utc>,
) -> Result<(), sqlx::Error> {
query!(
diff --git a/src/services/jwt.rs b/src/services/jwt.rs
index 822101f..c86fb01 100644
--- a/src/services/jwt.rs
+++ b/src/services/jwt.rs
@@ -30,8 +30,8 @@ pub struct Claims {
jti: Uuid,
scope: Box<str>,
client_id: Uuid,
- auth_code_id: Uuid,
token_type: TokenType,
+ auth_code_id: Option<Uuid>,
redirect_uri: Option<Url>,
}
@@ -67,7 +67,7 @@ impl Claims {
jti: id,
scope: scopes.into(),
client_id,
- auth_code_id: id,
+ auth_code_id: Some(id),
token_type: TokenType::Authorization,
redirect_uri: Some(redirect_uri.clone()),
})
@@ -75,7 +75,7 @@ impl Claims {
pub async fn access_token<'c>(
db: &MySqlPool,
- auth_code_id: Uuid,
+ auth_code_id: Option<Uuid>,
self_id: Url,
client_id: Uuid,
duration: Duration,