feat(auth): refactor authentication routes and enhance JWT handling
Build and Push Auth Portal Docker Image / build-and-push (push) Successful in 1m49s
Build and Push Auth Portal Docker Image / create-release (push) Skipped

- Removed unused permission and app retrieval logic from the login process.
- Introduced a new endpoint for reissuing access tokens to handle role changes and account switches.
- Updated JWT payload handling to improve clarity and maintainability.
- Enhanced the readJwtPayload function for better decoding of JWT claims.
This commit is contained in:
Denozordec committed 2026-07-19 02:22:23 +07:00
1 parent ed1699503a
commit 09ed7f4dc4
9 files changed
+206 -84

No files matched your search

+5 -2
View File
@@ -6,7 +6,7 @@ import {
type UserRow,
} from '@authportal/db'
import type { AppId, MeResponse } from '@authportal/shared'
import { APP_IDS, normalizePermissionKeys } from '@authportal/shared'
import { APP_IDS, allPermissionKeys, normalizePermissionKeys } from '@authportal/shared'
export type AuthUser = {
id: string
@@ -72,9 +72,12 @@ export function loadAuthUser(
user: UserRow,
): AuthUser {
const apps = getUserApps(request.server.db, user.id)
const permissions = normalizePermissionKeys(
let permissions = normalizePermissionKeys(
getUserPermissions(request.server.db, user.id),
)
if (user.isAdmin) {
permissions = allPermissionKeys()
}
return {
id: user.id,
email: user.email,