Skip to content

Feature 1: Admin UI Dashboard

Overview

Complete web-based administration interface for managing the FlexGate Proxy platform.

Status

Complete (100%)

Components

1. Authentication

Location: admin-ui/src/components/Auth/

Login Page

  • File: Login.tsx
  • Route: /login
  • Features:
    • Email/password authentication
    • Enterprise SSO button
    • Form validation
    • Error handling
    • Redirect after login

Protected Routes

  • File: ProtectedRoute.tsx
  • Purpose: Wrap protected pages
  • Behavior:
    • Check authentication status
    • Redirect to login if unauthenticated
    • Allow access if authenticated

SSO Callback

  • File: SSOCallback.tsx
  • Route: /auth/callback
  • Purpose: Handle SAML callback from IdP
  • Flow:
    1. Extract SAML response from URL
    2. Call backend to validate
    3. Store token and user data
    4. Redirect to dashboard

2. Layout System

Location: admin-ui/src/components/Layout/

  • File: Header.tsx
  • Features:
    • App title and logo
    • User profile dropdown
    • Logout functionality
    • Responsive design
  • File: Sidebar.tsx
  • Features:
    • Navigation menu (7 items)
    • Active route highlighting
    • Icons for each menu item
    • Fixed left sidebar

Layout Wrapper

  • File: Layout.tsx
  • Purpose: Combine Header + Sidebar + Content
  • Structure:
    ┌─────────────────────────────────┐
    │         Header (Top)            │
    ├──────────┬──────────────────────┤
    │          │                      │
    │ Sidebar  │   Content Area      │
    │  (Left)  │   (Main)            │
    │          │                      │
    └──────────┴──────────────────────┘

3. Dashboard

Location: admin-ui/src/pages/Dashboard.tsx

Features

  • Welcome message
  • Quick stats overview
  • System status
  • Recent activity
  • Quick links to main features

4. Navigation Menu

ItemIconRoutePurpose
Dashboard📊/dashboardOverview and stats
Routes🛣️/routesRoute management
Metrics📈/metricsPerformance metrics
Logs📝/logsLog viewer
OAuth🔑/oauthOAuth providers
Webhooks🔗/webhooksWebhook management
Settings⚙️/settingsSystem settings

Technical Stack

Frontend

  • Framework: React 18+
  • Language: TypeScript
  • UI Library: Material-UI (MUI)
  • Router: React Router v6
  • State Management: React Hooks (useState, useEffect)
  • HTTP Client: Fetch API

Styling

  • Theme: Material-UI theme system
  • Mode: Light mode (customizable)
  • Primary Color: #1976d2 (Blue)
  • Secondary Color: #dc004e (Pink)
  • Responsive: Mobile-friendly breakpoints

User Flows

Login Flow

1. User visits app → Redirect to /login
2. Enter credentials → Submit form
3. Backend validates → Return JWT token
4. Store token in localStorage
5. Redirect to /dashboard
6. All subsequent requests include token

SSO Login Flow

1. User clicks "Login with Enterprise SSO"
2. Redirect to IdP (Einstrust)
3. User authenticates with IdP
4. IdP redirects to /auth/callback with SAML response
5. Backend validates SAML → Returns JWT
6. Store token → Redirect to /dashboard
1. User clicks menu item
2. Router navigates to new route
3. ProtectedRoute checks authentication
4. If authenticated → Render page
5. If not → Redirect to /login

API Integration

Authentication Service

File: admin-ui/src/services/auth.ts

Methods

typescript
// Login with credentials
login(email: string, password: string): Promise<LoginResponse>

// Initiate SSO login
initiateSSOLogin(): Promise<void>

// Handle SSO callback
handleSSOCallback(samlResponse: string): Promise<SSOCallbackResponse>

// Logout
logout(): void

// Check if authenticated
isAuthenticated(): boolean

// Get current user
getCurrentUser(): User | null

Testing Scenarios

E2E Test Cases

TC1.1: Basic Login

Precondition: User has valid credentials

Steps:
1. Navigate to http://localhost:3000
2. Should redirect to /login
3. Enter email: test@example.com
4. Enter password: Test123!
5. Click "Login" button
6. Should redirect to /dashboard
7. Verify user is logged in (check header shows username)
8. Verify sidebar is visible
9. Verify dashboard content loads

Expected: Successful login and dashboard display

TC1.2: Invalid Login

Precondition: User enters wrong credentials

Steps:
1. Navigate to /login
2. Enter email: wrong@example.com
3. Enter password: WrongPass
4. Click "Login"
5. Should show error message
6. Should NOT redirect
7. Form should be clearable/retryable

Expected: Error message displayed, remain on login page

TC1.3: SSO Login

Precondition: SSO configured with Einstrust

Steps:
1. Navigate to /login
2. Click "Login with Enterprise SSO"
3. Should redirect to IdP
4. Complete IdP authentication
5. Should redirect back to /auth/callback
6. Should process SAML response
7. Should redirect to /dashboard
8. Verify logged in via SSO

Expected: Successful SSO authentication

TC1.4: Protected Route Access

Precondition: User not logged in

Steps:
1. Clear localStorage (logout)
2. Navigate to /routes (protected page)
3. Should redirect to /login
4. Login successfully
5. Should redirect back to /routes

Expected: Unauthenticated access blocked, redirect to login

TC1.5: Navigation

Precondition: User logged in

Steps:
1. Login successfully
2. Click each sidebar menu item:
   - Dashboard → /dashboard
   - Routes → /routes
   - Metrics → /metrics
   - Logs → /logs
   - OAuth → /oauth
   - Webhooks → /webhooks
   - Settings → /settings
3. Verify each page loads
4. Verify active menu item highlighted
5. Navigate back to Dashboard

Expected: All navigation works, active states correct

TC1.6: Logout

Precondition: User logged in

Steps:
1. Login successfully
2. Click user profile in header
3. Click "Logout"
4. Should redirect to /login
5. Verify token removed from localStorage
6. Try to access /dashboard
7. Should redirect to /login

Expected: Logout clears session, blocks protected routes

TC1.7: Session Persistence

Precondition: User logged in

Steps:
1. Login successfully
2. Refresh browser (F5)
3. Should remain logged in
4. Should stay on current page
5. Close browser tab
6. Reopen app in new tab
7. Should still be logged in (if token valid)

Expected: Session persists across refreshes

TC1.8: Responsive Design

Precondition: User logged in

Steps:
1. Login on desktop (1920x1080)
2. Verify layout looks correct
3. Resize to tablet (768px width)
4. Verify sidebar collapses or adjusts
5. Resize to mobile (375px width)
6. Verify mobile-friendly layout
7. Test navigation on mobile

Expected: Responsive layout at all breakpoints

Performance Requirements

  • Initial Load: < 2 seconds
  • Route Navigation: < 500ms
  • API Response Time: < 1 second
  • Bundle Size: < 500KB (gzipped)

Security Considerations

  1. Token Storage: JWT in localStorage (consider httpOnly cookies for production)
  2. Token Expiry: Handle expired tokens gracefully
  3. XSS Protection: Sanitize all user inputs
  4. CSRF Protection: Use CSRF tokens for state-changing operations
  5. HTTPS Only: Enforce HTTPS in production

Accessibility

  • Keyboard Navigation: All interactive elements accessible via keyboard
  • Screen Readers: Proper ARIA labels
  • Color Contrast: WCAG AA compliance
  • Focus Indicators: Visible focus states

Browser Support

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Known Issues

  • ✅ None currently

Future Enhancements

  • [ ] Dark mode toggle
  • [ ] Multi-language support
  • [ ] Customizable dashboard widgets
  • [ ] Keyboard shortcuts
  • [ ] Notification center
  • [ ] User preferences panel

Released under the MIT License.