Complete documentation of the NDSS CRM authentication system, login workflows, user registration, password recovery, role-based access control with all 24 roles, session management, demo mode, and security best practices.
NDSS CRM uses Supabase / Oracle Auth as its authentication provider, delivering a secure, standards-compliant identity management layer. Supabase / Oracle Auth is built on top of the GoTrue open-source authentication server and supports multiple authentication methods including email/password credentials and OAuth social login providers.
All authentication operations - login, registration, password reset, email verification, and session management - are handled by the Supabase / Oracle Auth server. The NDSS CRM frontend communicates with this server via the @supabase/supabase-js client library and the @supabase/ssr helper for server-side session management in the Next.js App Router environment.
| Method | Status | Description |
|---|---|---|
| Email / Password | Active | Primary authentication method. Users sign in with their registered email address and password. Passwords are hashed using bcrypt with a cost factor of 10. |
| Google OAuth | Active | Staff members can sign in using their Google Workspace accounts if the organisation has configured Google OAuth integration in the Admin settings. |
| Microsoft OAuth | Optional | Available for organisations using Microsoft 365. Must be configured by a Master Administrator with Azure AD credentials. |
| Magic Link | Optional | Passwordless login via a one-time link sent to the user's email. Can be enabled as an alternative to password-based login. |
| Phone OTP | Planned | One-time password sent via SMS for two-factor authentication. Planned for V4.0 release. |
The authentication system spans three layers of the NDSS CRM architecture:
(auth) route group. Form submissions call Supabase / Oracle Auth client methods.src/middleware.ts file intercepts every request and verifies the session cookie. Unauthenticated users attempting to access protected routes are redirected to /login.NDSS CRM uses the @supabase/ssr package (version 0.5.x) for cookie-based session management compatible with the Next.js 16 App Router. This replaces the deprecated @supabase/auth-helpers-nextjs package used in earlier versions of the platform.
The login page is the primary entry point for all NDSS CRM users. It is served at the /login URL and uses a minimal layout without the sidebar or topbar. The page consists of a centred card containing the NDSS CRM logo, a role selector for demo mode, email and password fields, a captcha verification widget, and the login button.
https://crm.newdawn.org.au/login.supabase.auth.signInWithPassword({ email, password }).@supabase/ssr library stores the tokens in an HTTP-only, secure, SameSite cookie.profiles table to determine the assigned role.| Role Category | Landing Page | Notes |
|---|---|---|
| Administration Roles | /dashboard | Full admin dashboard with all KPI widgets and quick actions |
| Operations Roles | /dashboard | Operations-focused dashboard with task lists and pending items |
| Support Workers | /dashboard | Worker dashboard showing today's shifts and client list |
| Clinical Roles | /dashboard | Clinical dashboard with care plan summaries and assessments |
| Client / Family | /portal | Client portal with service schedule and plan information |
| Error Condition | User Message | Technical Detail |
|---|---|---|
| Invalid credentials | "Invalid email or password. Please try again." | Supabase / Oracle returns AuthApiError: Invalid login credentials |
| Email not verified | "Please verify your email address before signing in." | The email_confirmed_at field is null |
| Account disabled | "Your account has been deactivated. Contact your administrator." | Profile is_active is false |
| Rate limited | "Too many login attempts. Please wait 60 seconds." | Supabase / Oracle rate limiting (default: 30 requests per hour per IP) |
| CAPTCHA failed | "CAPTCHA verification failed. Please try again." | hCaptcha or Turnstile token validation failed on the server |
| Network error | "Unable to connect. Check your internet connection." | Fetch request to Supabase / Oracle Auth server timed out or failed |
New user registration in NDSS CRM is a controlled process. Unlike public SaaS applications, NDSS CRM does not allow unrestricted self-registration. Instead, new accounts are created through one of two pathways: administrator-initiated registration (the primary method) or invitation-based self-registration (for client portal users).
The primary method for creating new accounts is through the Admin panel (Chapter 17):
supabase.auth.admin.createUser() with the provided details.profiles table with the assigned role.staff_profiles table.For client portal users (NDIS participants and their families/carers), a simplified invitation flow is used:
/register and enters the invitation code along with their personal details.client or family_member role, and links it to the existing client record.Invitation codes are single-use and expire after 7 days. If an invitation expires, the service coordinator must generate a new one. Invitation codes cannot be reused once redeemed, even if the registration was not completed.
NDSS CRM provides a standard password recovery flow using Supabase / Oracle Auth's built-in password reset functionality. The process is initiated from the login page via the "Forgot password?" link.
/forgot-password.supabase.auth.resetPasswordForEmail(email). A success message is displayed regardless of whether the email exists in the system (to prevent user enumeration)./reset-password with a token parameter.supabase.auth.updateUser({ password }). The user is redirected to the login page with a success message.| Parameter | Value |
|---|---|
| From Address | noreply@newdawn.org.au |
| Subject Line | "NDSS CRM - Reset Your Password" |
| Link Expiry | 1 hour from time of request |
| Max Attempts | 3 reset requests per email per hour |
| Token Type | Single-use, cryptographically random token |
Administrators with the master_admin or administrator role can force-reset a user's password from the Admin panel. This generates a new temporary password and sends it to the user's email, requiring the user to change it on their next login.
NDSS CRM implements a comprehensive Role-Based Access Control system with 24 distinct user roles. Each role defines precisely which modules, pages, actions, and data a user can access. Roles are assigned during account creation and can be changed only by users with the master_admin or administrator role.
The RBAC system operates at three levels:
<RoleGate> component conditionally renders UI elements (buttons, tabs, columns) based on the current user's role.The following tables list all 24 roles organised by functional category, with their module access permissions.
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 1 | master_admin | Master Administrator | Full unrestricted access to all modules, settings, user management, and system configuration. Maximum 2-3 per organisation. |
| 2 | administrator | Administrator | Full access to all operational modules. Cannot modify system-level settings reserved for Master Admins (e.g., Supabase / Oracle configuration, RLS policies). |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 3 | operations_manager | Operations Manager | Clients, Staff, Rostering, Finance, Compliance, Intake, Reports. Full read/write on operational data. |
| 4 | service_coordinator | Service Coordinator | Clients (assigned), Rostering, Intake, Clinical. Manages participant service plans and coordinates supports. |
| 5 | team_leader | Team Leader | Staff (team members), Rostering (team shifts), Compliance (team incidents). Supervisory access for their team. |
| 6 | rostering_officer | Rostering Officer | Full Rostering access, read-only Clients and Staff. Manages shift scheduling and allocation. |
| 7 | intake_officer | Intake Officer | Full Intake & Referrals access, read-only Clients. Manages the participant intake pipeline. |
| 8 | quality_officer | Quality & Compliance Officer | Full Compliance access, read-only across all modules for auditing purposes. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 9 | finance_manager | Finance Manager | Full Finance access including invoicing, claims, budgets, payroll sync, and financial reports. |
| 10 | finance_officer | Finance Officer | Finance read/write for invoicing and claims. Cannot modify budgets or approve payroll. |
| 11 | accounts_payable | Accounts Payable | Limited Finance access for processing outgoing payments and expense management only. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 12 | clinical_lead | Clinical Lead | Full Clinical Services access, Clients (clinical data), Reports (clinical). Oversees all clinical programs. |
| 13 | behaviour_practitioner | Behaviour Support Practitioner | Clinical (BSP module), Clients (assigned, clinical data). Creates and manages behaviour support plans. |
| 14 | occupational_therapist | Occupational Therapist | Clinical (OT module), Clients (assigned, clinical data). Manages OT assessments and interventions. |
| 15 | nurse | Registered Nurse | Clinical (Nursing module), Clients (medical data). Manages medication, nursing care plans, and health monitoring. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 16 | support_worker | Support Worker | My Shifts (view/clock in), Assigned Clients (progress notes, basic profile). Core frontline role. |
| 17 | senior_support_worker | Senior Support Worker | Same as Support Worker plus ability to view team shifts and approve junior worker timesheets. |
| 18 | casual_worker | Casual Support Worker | Restricted version of Support Worker - can only see shifts assigned to them and submit timesheets. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 19 | hr_manager | HR Manager | Full Staff Management access, Learning & Development, Compliance (staff-related). Manages recruitment and employee records. |
| 20 | training_coordinator | Training Coordinator | Full Learning & Development access, read-only Staff profiles for training assignment. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 21 | client | NDIS Participant | Client Portal only - My Services, My Plan, Messages, Documents. Cannot access internal platform. |
| 22 | family_member | Family Member / Carer | Client Portal (read-only view of linked participant data). Can view schedules and progress but cannot modify. |
| 23 | plan_manager | Plan Manager (External) | Limited Finance view for invoices and claims related to their managed participants. |
| # | Role Identifier | Display Name | Access Level |
|---|---|---|---|
| 24 | demo_user | Demo User | Read-only access to all modules with sample data. Cannot create, edit, or delete any records. Used for platform demonstrations. |
The following summarised matrix shows which role categories can access each major module. For individual role permissions, refer to the detailed tables above.
| Module | Admin | Ops | Finance | Clinical | Workers | HR | Client |
|---|---|---|---|---|---|---|---|
| Dashboard | Full | Full | Limited | Limited | Limited | Limited | Portal |
| Clients | Full | Full | Read | Assigned | Assigned | None | Own |
| Staff | Full | Read | None | None | Own | Full | None |
| Rostering | Full | Full | Read | Read | Own | None | View |
| Finance | Full | Read | Full | None | None | None | View |
| Compliance | Full | Full | None | Read | Report | Read | None |
| Intake | Full | Full | None | Read | None | None | None |
| Clinical | Full | Read | None | Full | Read | None | View |
| Learning | Full | Read | None | Own | Own | Full | None |
| Messaging | Full | Full | Own | Own | Own | Own | Own |
| Reports | Full | Full | Finance | Clinical | None | HR | None |
| Admin | Full | None | None | None | None | None | None |
Full = Read, Create, Edit, Delete. Read = View only. Own = Can only access records related to themselves. Assigned = Can only access records for clients/staff assigned to them. Report = Can submit (e.g., incident reports) but not manage. View = Simplified read-only view (e.g., client portal). None = No access.
NDSS CRM uses cookie-based session management implemented through the @supabase/ssr library. This approach is optimised for the Next.js App Router architecture, where both server-side and client-side rendering need access to the user session.
| Setting | Value | Purpose |
|---|---|---|
| Cookie Name | sb-ndss-auth-token | Unique cookie name to prevent conflicts with other Supabase / Oracle projects |
| HttpOnly | true | Prevents JavaScript access to the cookie, mitigating XSS attacks |
| Secure | true | Cookie is only sent over HTTPS connections |
| SameSite | Lax | Provides CSRF protection while allowing normal navigation |
| Path | / | Cookie is available on all routes |
| Max-Age | 604800 (7 days) | Maximum session duration before re-authentication is required |
The Supabase / Oracle Auth system uses a dual-token approach. The access token (JWT) is short-lived (1 hour) and contains the user's identity and role claims. The refresh token is longer-lived (7 days) and is used to obtain new access tokens without requiring the user to re-enter credentials.
The refresh process works as follows:
supabase.auth.refreshSession() using the refresh token.NDSS CRM implements a client-side idle timeout of 30 minutes. If the user does not interact with the application (mouse movement, keyboard input, or scroll events) for 30 consecutive minutes, a warning dialog appears giving the user 60 seconds to click "Stay Logged In" before they are automatically logged out.
// Idle timeout implementation (simplified)
const IDLE_TIMEOUT = 30 * 60 * 1000; // 30 minutes
const WARNING_DURATION = 60 * 1000; // 60 seconds
let idleTimer: NodeJS.Timeout;
function resetIdleTimer() {
clearTimeout(idleTimer);
idleTimer = setTimeout(showIdleWarning, IDLE_TIMEOUT);
}
// Reset on user activity
['mousemove', 'keydown', 'scroll', 'click'].forEach(event => {
document.addEventListener(event, resetIdleTimer, { passive: true });
});
When a user logs out from one browser tab, all other open tabs must also log out to prevent stale session issues. NDSS CRM achieves this using the BroadcastChannel API to synchronise logout events across tabs:
LOGOUT message on the ndss-auth-channel BroadcastChannel.supabase.auth.signOut() and redirect to the login page.NDSS CRM includes a built-in demo mode that allows prospective users, stakeholders, and training participants to explore the platform without affecting real data. Demo mode provides read-only access to all modules using pre-populated sample data.
demo_user role and a metadata flag indicating the selected demo role.demo_user).When a user is in demo mode, several visual indicators make it clear that they are not operating on live data:
NDSS CRM enforces multiple layers of security to protect user accounts, participant data, and organisational information. The following best practices are implemented by default and should be maintained by all system administrators.
All user passwords must meet the following complexity requirements:
| Requirement | Value | Notes |
|---|---|---|
| Minimum Length | 8 characters | 12+ characters recommended for admin roles |
| Uppercase Letter | At least 1 | A-Z |
| Lowercase Letter | At least 1 | a-z |
| Numeric Digit | At least 1 | 0-9 |
| Special Character | At least 1 | !@#$%^&*()_+-=[]{}|;':",.<>?/ |
| Password History | Last 5 | Cannot reuse any of the last 5 passwords |
| Maximum Age | 90 days | Users are prompted to change their password every 90 days |
| Common Password Check | Enabled | Passwords are checked against a list of 10,000 commonly used passwords |
NDSS CRM supports two-factor authentication using Time-based One-Time Passwords (TOTP). 2FA adds a second verification step after the password, requiring users to enter a 6-digit code from an authenticator app (e.g., Google Authenticator, Microsoft Authenticator, Authy).
| Setting | Default Value | Description |
|---|---|---|
| 2FA Availability | All roles | 2FA can be enabled by any user from their profile settings |
| 2FA Enforcement | Admin roles only | Master Admin and Administrator roles are required to enable 2FA. Other roles are encouraged but not required. |
| Recovery Codes | 10 codes generated | Single-use backup codes provided when 2FA is first enabled, for account recovery if the authenticator device is lost |
| TOTP Algorithm | SHA-1, 6 digits, 30s | Standard TOTP parameters compatible with all major authenticator apps |
| Grace Period | 14 days | After 2FA enforcement is enabled, users have 14 days to set up 2FA before their account is restricted |
To prevent brute-force password attacks, NDSS CRM implements progressive account lockout:
| Failed Attempts | Action | Recovery |
|---|---|---|
| 1 - 4 | Warning message displayed | User can immediately retry |
| 5 | CAPTCHA required | User must complete CAPTCHA before retrying |
| 8 | Account locked for 15 minutes | Automatic unlock after 15 minutes, or admin can unlock manually |
| 12 | Account locked for 1 hour | Automatic unlock after 1 hour, or admin can unlock manually |
| 15+ | Account suspended | Only a Master Administrator can reactivate the account |
All authentication events are recorded in the auth_audit_log table for security monitoring and compliance:
| Event Type | Data Recorded |
|---|---|
login_success | User ID, email, role, IP address, user agent, timestamp |
login_failure | Email attempted, failure reason, IP address, user agent, timestamp |
logout | User ID, session duration, timestamp |
password_reset_request | Email, IP address, timestamp |
password_changed | User ID, timestamp |
2fa_enabled | User ID, timestamp |
2fa_disabled | User ID, disabled by (self or admin), timestamp |
account_locked | User ID, reason, lock duration, timestamp |
account_unlocked | User ID, unlocked by (auto or admin), timestamp |
role_changed | User ID, old role, new role, changed by, timestamp |
session_expired | User ID, expiry reason (timeout/token expiry), timestamp |
master_admin and administrator accounts have 2FA enabled.master_admin accounts to a maximum of 2-3 per organisation.For the complete technical architecture behind the authentication system, see Chapter 3: Architecture & Technical Stack. For advanced security configurations, encryption at rest, and data protection policies, see Chapter 20: Security & Data.