-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Console Authentication System — @object-ui/auth package, route guards, system admin pages #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: Console Authentication System — @object-ui/auth package, route guards, system admin pages #421
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a69704
Initial plan
Copilot 7c2e3cd
feat(auth): create @object-ui/auth package with AuthProvider, useAuth…
Copilot 36eca34
feat(console): integrate auth system with login/register routes, Auth…
Copilot 87a388f
fix(auth): address code review — extract getUserInitials utility, imp…
Copilot 148234f
fix(console): move useAuth hook call before early returns in AppConte…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Forgot Password Page for ObjectStack Console | ||
| */ | ||
|
|
||
| import { ForgotPasswordForm } from '@object-ui/auth'; | ||
|
|
||
| export function ForgotPasswordPage() { | ||
| return ( | ||
| <div className="flex min-h-screen items-center justify-center bg-background"> | ||
| <ForgotPasswordForm loginUrl="/login" /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Login Page for ObjectStack Console | ||
| */ | ||
|
|
||
| import { useNavigate } from 'react-router-dom'; | ||
| import { LoginForm } from '@object-ui/auth'; | ||
|
|
||
| export function LoginPage() { | ||
| const navigate = useNavigate(); | ||
|
|
||
| return ( | ||
| <div className="flex min-h-screen items-center justify-center bg-background"> | ||
| <LoginForm | ||
| onSuccess={() => navigate('/')} | ||
| registerUrl="/register" | ||
| forgotPasswordUrl="/forgot-password" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /** | ||
| * Register Page for ObjectStack Console | ||
| */ | ||
|
|
||
| import { useNavigate } from 'react-router-dom'; | ||
| import { RegisterForm } from '@object-ui/auth'; | ||
|
|
||
| export function RegisterPage() { | ||
| const navigate = useNavigate(); | ||
|
|
||
| return ( | ||
| <div className="flex min-h-screen items-center justify-center bg-background"> | ||
| <RegisterForm | ||
| onSuccess={() => navigate('/')} | ||
| loginUrl="/login" | ||
| /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * Audit Log Page | ||
| * | ||
| * Read-only grid displaying system audit logs. | ||
| * Shows user actions, resources, timestamps, and details. | ||
| */ | ||
|
|
||
| import { systemObjects } from './systemObjects'; | ||
|
|
||
| const auditObject = systemObjects.find((o) => o.name === 'sys_audit_log')!; | ||
|
|
||
| export function AuditLogPage() { | ||
| return ( | ||
| <div className="flex flex-col gap-6 p-6"> | ||
| <div> | ||
| <h1 className="text-2xl font-bold tracking-tight">Audit Log</h1> | ||
| <p className="text-muted-foreground">View system activity and user actions</p> | ||
| </div> | ||
|
|
||
| <div className="rounded-md border"> | ||
| <table className="w-full text-sm"> | ||
| <thead> | ||
| <tr className="border-b bg-muted/50"> | ||
| {auditObject.views[0].columns.map((col) => { | ||
| const field = auditObject.fields.find((f) => f.name === col); | ||
| return ( | ||
| <th key={col} className="h-10 px-4 text-left font-medium text-muted-foreground"> | ||
| {field?.label ?? col} | ||
| </th> | ||
| ); | ||
| })} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr className="border-b"> | ||
| <td className="p-4 text-muted-foreground" colSpan={auditObject.views[0].columns.length}> | ||
| Connect to ObjectStack server to load audit logs. In production, this page uses plugin-grid in read-only mode. | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /** | ||
| * Organization Management Page | ||
| * | ||
| * Displays a list of organizations with member management. | ||
| * Reuses the plugin-grid for data display. | ||
| */ | ||
|
|
||
| import { useAuth } from '@object-ui/auth'; | ||
| import { systemObjects } from './systemObjects'; | ||
|
|
||
| const orgObject = systemObjects.find((o) => o.name === 'sys_org')!; | ||
|
|
||
| export function OrgManagementPage() { | ||
| const { user: currentUser } = useAuth(); | ||
| const isAdmin = currentUser?.role === 'admin'; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-6 p-6"> | ||
| <div className="flex items-center justify-between"> | ||
| <div> | ||
| <h1 className="text-2xl font-bold tracking-tight">Organization Management</h1> | ||
| <p className="text-muted-foreground">Manage organizations and their members</p> | ||
| </div> | ||
| {isAdmin && ( | ||
| <button | ||
| type="button" | ||
| className="inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" | ||
| > | ||
| Add Organization | ||
| </button> | ||
| )} | ||
| </div> | ||
|
|
||
| <div className="rounded-md border"> | ||
| <table className="w-full text-sm"> | ||
| <thead> | ||
| <tr className="border-b bg-muted/50"> | ||
| {orgObject.views[0].columns.map((col) => { | ||
| const field = orgObject.fields.find((f) => f.name === col); | ||
| return ( | ||
| <th key={col} className="h-10 px-4 text-left font-medium text-muted-foreground"> | ||
| {field?.label ?? col} | ||
| </th> | ||
| ); | ||
| })} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr className="border-b"> | ||
| <td className="p-4 text-muted-foreground" colSpan={orgObject.views[0].columns.length}> | ||
| Connect to ObjectStack server to load organizations. In production, this page uses plugin-grid for full CRUD functionality. | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System admin routes are mounted without any admin role guard, so any authenticated user can navigate to
/apps/:appName/system/users|organizations|roles. The pages only hide the “Add …” button, which doesn’t meet the “admin-gated” intent and is a security gap. Wrap the admin-only routes (users/orgs/roles, possibly audit-log) in anAuthGuard requiredRoles={["admin"]}(or a permissions-based guard) and provide an explicit access-denied fallback.