# DBIS Admin Console - Login Credentials & Endpoints

**Last Updated:** 2025-01-22

---

## 🔐 Login Credentials

### Current Authentication Status

**⚠️ Mock Authentication Active**

The frontend is currently using **mock authentication** for development. This means:

- **Any username and password will work**
- The system accepts any credentials and creates a mock admin user
- No actual backend authentication is performed yet

### Mock User Details

When you log in with any credentials, you'll receive:

```json
{
  "id": "1",
  "employeeId": "emp-001",
  "name": "Admin User",
  "email": "<your-username>",
  "role": "DBIS_Super_Admin",
  "permissions": ["all"]
}
```

### Login Instructions

1. **Go to:** http://192.168.11.130/login
2. **Enter any username** (e.g., `admin`, `test`, `user`)
3. **Enter any password** (e.g., `password`, `123456`, `admin`)
4. **Click "Sign In"**

**Note:** The login form requires both fields to be filled, but the values don't matter - any combination will work.

---

## 🌐 Frontend Routes (Client-Side)

### Public Routes

| Route | Description | Component |
|-------|-------------|-----------|
| `/login` | Login page | `LoginPage` |
| `/404` | 404 error page | `PageError` |
| `/403` | 403 forbidden page | `PageError` |
| `/500` | 500 server error page | `PageError` |

### Protected Routes (Require Authentication)

#### DBIS Admin Console Routes

| Route | Description | Component |
|-------|-------------|-----------|
| `/` | Redirects to `/dbis/overview` | - |
| `/dbis/overview` | Global Overview Dashboard | `DBISOverviewPage` |
| `/dbis/participants` | Participants & Jurisdictions | `DBISParticipantsPage` |
| `/dbis/gru` | GRU Command Center | `DBISGRUPage` |
| `/dbis/gas-qps` | GAS & QPS Control Panel | `DBISGASQPSPage` |
| `/dbis/cbdc-fx` | CBDC & FX Management | `DBISCBDCFXPage` |
| `/dbis/metaverse-edge` | Metaverse & Edge Management | `DBISMetaverseEdgePage` |
| `/dbis/risk-compliance` | Risk & Compliance Dashboard | `DBISRiskCompliancePage` |

#### SCB Admin Console Routes

| Route | Description | Component |
|-------|-------------|-----------|
| `/scb/overview` | SCB Overview Dashboard | `SCBOverviewPage` |
| `/scb/fi-management` | FI Management & Nostro/Vostro | `SCBFIManagementPage` |
| `/scb/corridors` | Corridor & FX Policy | `SCBCorridorPolicyPage` |

---

## 🔌 Backend API Endpoints

### Base URL

**Development:** `http://localhost:3000`  
**Production:** Configured via `VITE_API_BASE_URL` environment variable  
**Default:** `http://192.168.11.150:3000` (based on deployment config)

### Authentication Endpoints

| Method | Endpoint | Description | Status |
|--------|----------|-------------|--------|
| `POST` | `/api/auth/login` | User login | ⚠️ Not implemented (using mock) |
| `POST` | `/api/auth/logout` | User logout | ⚠️ Not implemented (using mock) |
| `POST` | `/api/auth/refresh` | Refresh token | ⚠️ Not implemented |

### DBIS Admin API Endpoints

#### Dashboard & Overview

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/dashboard/overview` | Global overview dashboard data |
| `GET` | `/api/admin/dbis/participants` | List all participants |
| `GET` | `/api/admin/dbis/participants/:scbId` | Get participant details |
| `GET` | `/api/admin/dbis/participants/:scbId/jurisdiction` | Get jurisdiction settings |
| `GET` | `/api/admin/dbis/corridors` | Get all corridors |

#### GRU Command Center

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/gru/command` | GRU command dashboard |
| `POST` | `/api/admin/dbis/gru/issuance/proposal` | Create GRU issuance proposal |
| `POST` | `/api/admin/dbis/gru/lock` | Lock/unlock GRU class |
| `POST` | `/api/admin/dbis/gru/circuit-breakers` | Set circuit breakers |
| `POST` | `/api/admin/dbis/gru/bonds/window` | Manage bond issuance window |
| `POST` | `/api/admin/dbis/gru/bonds/buyback` | Trigger emergency buyback |

#### GAS & QPS

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/gas-qps` | GAS & QPS dashboard |

#### CBDC & FX

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/cbdc-fx` | CBDC & FX dashboard |

#### Metaverse & Edge

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/metaverse-edge` | Metaverse & Edge dashboard |

#### Risk & Compliance

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/dbis/risk-compliance` | Risk & Compliance dashboard |

#### Network Controls

| Method | Endpoint | Description |
|--------|----------|-------------|
| `POST` | `/api/admin/dbis/network/quiesce` | Quiesce subsystem |
| `POST` | `/api/admin/dbis/network/kill-switch` | Activate kill switch |
| `POST` | `/api/admin/dbis/network/escalate` | Escalate incident |

#### Corridor Controls

| Method | Endpoint | Description |
|--------|----------|-------------|
| `POST` | `/api/admin/dbis/corridors/caps` | Adjust corridor caps |
| `POST` | `/api/admin/dbis/corridors/throttle` | Throttle corridor |
| `POST` | `/api/admin/dbis/corridors/enable-disable` | Enable/disable corridor |

#### Liquidity Engine

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/liquidity/decision-map` | Get liquidity decision map |
| `PUT` | `/api/admin/liquidity/decision-map` | Update liquidity decision map |
| `GET` | `/api/admin/liquidity/quotes` | Get liquidity quotes |
| `GET` | `/api/admin/liquidity/routing-stats` | Get routing statistics |
| `POST` | `/api/admin/liquidity/simulate-route` | Simulate routing |

### SCB Admin API Endpoints

#### SCB Overview

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/scb/dashboard/overview` | SCB overview dashboard |

#### FI Management

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/scb/fi` | Get FI management dashboard |
| `POST` | `/api/admin/scb/fi/approve-suspend` | Approve or suspend FI |
| `POST` | `/api/admin/scb/fi/limits` | Set FI limits |
| `POST` | `/api/admin/scb/fi/api-profile` | Assign API profile |

#### Corridor & FX Policy

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/admin/scb/corridors` | Get corridor policy dashboard |

#### CBDC & GRU Controls

| Method | Endpoint | Description |
|--------|----------|-------------|
| `POST` | `/api/admin/scb/cbdc/parameters` | Update CBDC parameters |
| `POST` | `/api/admin/scb/gru/policy` | Update GRU policy |

---

## 🔑 Authentication Details

### Current Implementation

- **Type:** Mock authentication (development mode)
- **Token Storage:** `sessionStorage` (cleared on tab close)
- **Token Format:** `SOV-TOKEN <token>`
- **Token Header:** `Authorization: SOV-TOKEN <token>`

### Request Headers

All API requests include:

```
Authorization: SOV-TOKEN <token>
X-SOV-Timestamp: <timestamp>
X-SOV-Nonce: <random-nonce>
Content-Type: application/json
```

### User Roles

| Role | Permissions | Access Level |
|------|-------------|--------------|
| `DBIS_Super_Admin` | `['all']` | Full access to all features |
| `DBIS_Ops` | Specific permissions | DBIS operations access |
| `DBIS_Risk` | Specific permissions | Risk & compliance access |
| `SCB_Admin` | SCB-specific | SCB-level access only |

---

## 📍 Quick Reference

### Login
- **URL:** http://192.168.11.130/login
- **Credentials:** Any username/password combination
- **After Login:** Redirects to `/dbis/overview`

### Main Dashboards
- **DBIS Overview:** http://192.168.11.130/dbis/overview
- **SCB Overview:** http://192.168.11.130/scb/overview

### API Base URL
- **Default:** `http://192.168.11.150:3000`
- **Configurable:** Via `VITE_API_BASE_URL` environment variable

---

## ⚠️ Important Notes

1. **Mock Authentication:** Currently using mock auth - any credentials work
2. **Backend Required:** Most API endpoints require a running backend
3. **Token Format:** Uses `SOV-TOKEN` prefix (not standard `Bearer`)
4. **Session Storage:** Tokens stored in `sessionStorage` (not `localStorage`)
5. **Auto-Logout:** Session clears when browser tab closes

---

## 🔄 Next Steps

To enable real authentication:

1. Implement backend `/api/auth/login` endpoint
2. Update `authService.ts` to call real API
3. Configure JWT token validation
4. Set up proper user roles and permissions
5. Remove mock authentication code

---

**For development/testing:** Use any username and password to log in.
