Fix auth for 1.0.0: add logout endpoint, fix JWT claims consistency, add session revocation

This commit is contained in:
Leon Bösche
2026-01-09 19:53:09 +01:00
parent 2ab0786e30
commit 9daccbae82
3 changed files with 96 additions and 3 deletions

View File

@@ -132,6 +132,15 @@ func (db *DB) GetSession(ctx context.Context, sessionID uuid.UUID) (*Session, er
return &session, nil
}
func (db *DB) RevokeSession(ctx context.Context, sessionID uuid.UUID) error {
_, err := db.ExecContext(ctx, `
UPDATE sessions
SET revoked_at = NOW()
WHERE id = $1 AND revoked_at IS NULL
`, sessionID)
return err
}
func (db *DB) GetUserOrganizations(ctx context.Context, userID uuid.UUID) ([]Organization, error) {
rows, err := db.QueryContext(ctx, `
SELECT o.id, o.name, o.slug, o.created_at