Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
34b3462
storage: introduce find_active_for_session for PATs
reivilibre Oct 16, 2025
98c765c
storage: include PATs alongside personal sessions
reivilibre Oct 20, 2025
353d234
When revoking a personal session, also revoke its PAT
reivilibre Oct 20, 2025
01c89cd
Delete owned PATs & personal sessions when pruning OAuth2 clients
reivilibre Oct 20, 2025
2e5b386
Add personal session data models to admin API
reivilibre Oct 20, 2025
1030ec9
Add personal sessions admin API
reivilibre Oct 20, 2025
4e70f83
Add Admin API to regenerate a personal session (getting a new PAT)
reivilibre Oct 20, 2025
1fc8145
drive-by clippy fixes
reivilibre Oct 20, 2025
30abb7c
drive-by formatting fixes
reivilibre Oct 20, 2025
4863026
drive-by update.sh chmod +x
reivilibre Oct 20, 2025
78b010d
find_active_by_session: take &PersonalSession
reivilibre Oct 21, 2025
52c04c1
Add `expires` filter to personal sessions list
reivilibre Oct 21, 2025
ba9fc35
Make `expires_in` u32 and (on regenerate) not default to the same as …
reivilibre Oct 21, 2025
6102a4b
Use Option<Ulid> in schemars
reivilibre Oct 21, 2025
cc57e33
axum_extra: enable `query` feature flag
reivilibre Oct 21, 2025
d516b3d
Add `scope` filter to personal sessions list
reivilibre Oct 21, 2025
a0c5583
fixup! Make `expires_in` u32 and (on regenerate) not default to the s…
reivilibre Oct 21, 2025
db3dcce
use axum_extract's version of Query everywhere
reivilibre Oct 21, 2025
8fb0caf
fixup! Add `expires` filter to personal sessions list
reivilibre Oct 21, 2025
dda3a49
(update JSONSchema)
reivilibre Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions crates/storage-pg/src/oauth2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,49 @@ impl OAuth2ClientRepository for PgOAuth2ClientRepository<'_> {
.await?;
}

// Delete any personal access tokens & sessions owned
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat.

// by the client
{
let span = info_span!(
"db.oauth2_client.delete_by_id.personal_access_tokens",
{ DB_QUERY_TEXT } = tracing::field::Empty,
);

sqlx::query!(
r#"
DELETE FROM personal_access_tokens
WHERE personal_session_id IN (
SELECT personal_session_id
FROM personal_sessions
WHERE owner_oauth2_client_id = $1
)
"#,
Uuid::from(id),
)
.record(&span)
.execute(&mut *self.conn)
.instrument(span)
.await?;
}
{
let span = info_span!(
"db.oauth2_client.delete_by_id.personal_sessions",
{ DB_QUERY_TEXT } = tracing::field::Empty,
);

sqlx::query!(
r#"
DELETE FROM personal_sessions
WHERE owner_oauth2_client_id = $1
"#,
Uuid::from(id),
)
.record(&span)
.execute(&mut *self.conn)
.instrument(span)
.await?;
}

// Now delete the client itself
let res = sqlx::query!(
r#"
Expand Down