Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7dfc896
feat: implement Crime IDAM integration (#357)
alexbottenberg Mar 10, 2026
c97a029
fix: add crimeCallbackHandler to @hmcts/auth mock in web app tests
alexbottenberg Mar 11, 2026
916bf23
fix: prioritize email claim over sub claim in Crime IDAM token parsing
alexbottenberg Mar 11, 2026
078aca0
fix: remove PII from Crime IDAM telemetry
alexbottenberg Mar 11, 2026
08852ed
fix: validate OAuth state parameter in Crime IDAM callback
alexbottenberg Mar 11, 2026
bdf9ff8
fix: remove sensitive data from Crime IDAM callback logging and telem…
alexbottenberg Mar 11, 2026
1659132
fix: namespace Crime IDAM provenance ID to prevent cross-provider col…
alexbottenberg Mar 11, 2026
00c4855
fix: make isRejectedCrimeRole case-insensitive
alexbottenberg Mar 11, 2026
649225f
fix: correct Crime IDAM token endpoint and DB connection initialisation
alexbottenberg Mar 12, 2026
a4a4e78
test: add e2e tests for Crime IDAM integration
alexbottenberg Mar 12, 2026
b8cddba
fix: correct default Crime IDAM scope to include roles
alexbottenberg Mar 12, 2026
34027b9
fix: enable Crime IDAM in E2E test environment
alexbottenberg Mar 12, 2026
2e420b0
feat: move Crime IDAM sign-in to Common Platform option
alexbottenberg Mar 12, 2026
d0c4415
fix: correct sign-in spec Common Platform assertion and rewrite accou…
alexbottenberg Mar 13, 2026
5b22a0e
fix: add scope parameter to CFT IDAM authorization URL
alexbottenberg Mar 13, 2026
3a1e68b
Merge master into feature/357-crime-idam-integration
abottenberg Apr 23, 2026
dd076c5
feat(auth): add Crime IDAM logout by clearing local session only
abottenberg Apr 29, 2026
ae22bc2
Merge master into feature/357-crime-idam-integration
abottenberg Apr 29, 2026
48f82d7
fix(e2e): handle URL-encoded ui_locales parameter in Crime IDAM redir…
abottenberg Apr 30, 2026
3c85f22
fix(e2e): skip Crime IDAM redirect test in PR builds by adding @night…
abottenberg Apr 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ CFT_IDAM_URL=https://idam-web-public.aat.platform.hmcts.net
# - CFT_IDAM_CLIENT_SECRET
SSO_ALLOW_HTTP_REDIRECT=false

# Crime IDAM Configuration
# Crime IDAM secrets loaded from Azure Key Vault:
# - CRIME_IDAM_BASE_URL
# - CRIME_IDAM_CLIENT_ID
# - CRIME_IDAM_CLIENT_SECRET
# - CRIME_IDAM_SCOPE (defaults to "openid profile roles" if not provided)
#
# Enable Crime IDAM in development (disabled by default):
# ENABLE_CRIME_IDAM=true

# Azure B2C Configuration (for CaTH verified users)
# B2C_CLIENT_ID and B2C_CLIENT_SECRET are loaded from Azure Key Vault.
# Non-secret config must be set here for local development.
Expand Down
1 change: 1 addition & 0 deletions apps/web/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ nodejs:
POSTGRES_DATABASE: cath
CFT_IDAM_URL: https://idam-web-public.{{ .Values.global.environment }}.platform.hmcts.net
CATH_SERVICE_URL: https://cath-web.{{ .Values.global.environment }}.platform.hmcts.net
CRIME_IDAM_BASE_URL: https://login.sit.cjscp.org.uk
GOVUK_NOTIFY_TEMPLATE_ID_SUBSCRIPTION: 5b5c31d0-27a3-466b-b750-bd1a858cd50f
GOVUK_NOTIFY_TEMPLATE_ID_SUBSCRIPTION_PDF_AND_SUMMARY: ebc08910-5dd5-44c5-b3fc-72f90935f858
GOVUK_NOTIFY_TEMPLATE_ID_SUBSCRIPTION_SUMMARY_ONLY: bf0802f9-3199-4774-a0c1-f9cb1755ff8f
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ vi.mock("@hmcts/auth", () => ({
b2cForgotPasswordHandler: vi.fn(),
cftCallbackHandler: vi.fn(),
configurePassport: vi.fn(),
crimeCallbackHandler: vi.fn(),
sessionTimeoutMiddleware: vi.fn((_req: any, _res: any, next: any) => next()),
ssoCallbackHandler: vi.fn()
}));
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
b2cForgotPasswordHandler,
cftCallbackHandler,
configurePassport,
crimeCallbackHandler,
sessionTimeoutMiddleware,
ssoCallbackHandler
} from "@hmcts/auth";
Expand Down Expand Up @@ -75,6 +76,7 @@ export async function createApp(): Promise<Express> {
app.use(
configureHelmet({
cftIdamUrl: process.env.CFT_IDAM_URL,
crimeIdamUrl: process.env.CRIME_IDAM_BASE_URL,
b2cCustomDomain: process.env.B2C_CUSTOM_DOMAIN,
b2cTenantName: process.env.B2C_TENANT_NAME
})
Expand Down Expand Up @@ -141,6 +143,9 @@ export async function createApp(): Promise<Express> {
// Manual route registration for CFT callback (maintains /cft-login/return URL for external CFT IDAM config)
app.get("/cft-login/return", cftCallbackHandler);

// Manual route registration for Crime IDAM callback (maintains /crime-login/return URL for external Crime IDAM config)
app.get("/crime-login/return", crimeCallbackHandler);

// Manual route registration for B2C callback (maintains /login/return URL for Azure B2C config)
// Supports both GET (response_mode=query) and POST (response_mode=form_post)
app.get("/login/return", b2cCallbackHandler);
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { createApp } from "./app.js";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const PORT = process.env.PORT || 8080;
const IS_PRODUCTION = process.env.NODE_ENV === "production";

Expand Down
13 changes: 13 additions & 0 deletions docs/GITHUB_SECRETS_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ The following secrets must be configured in your GitHub repository settings (`Se
| `CFT_INVALID_TEST_ACCOUNT` | CFT IDAM invalid test account email |
| `CFT_INVALID_TEST_ACCOUNT_PASSWORD` | CFT IDAM invalid test account password |

### Test User Credentials (Crime IDAM)

| Secret Name | Description |
|------------|-------------|
| `CRIME_IDAM_BASE_URL` | Crime IDAM base URL |
| `CRIME_IDAM_CLIENT_ID` | Crime IDAM Client ID |
| `CRIME_IDAM_CLIENT_SECRET` | Crime IDAM Client Secret |
| `CRIME_IDAM_SCOPE` | Crime IDAM OAuth scope (defaults to "openid profile roles") |
| `CRIME_VALID_TEST_ACCOUNT` | Crime IDAM valid test account email |
| `CRIME_VALID_TEST_ACCOUNT_PASSWORD` | Crime IDAM valid test account password |
| `CRIME_INVALID_TEST_ACCOUNT` | Crime IDAM invalid test account email |
| `CRIME_INVALID_TEST_ACCOUNT_PASSWORD` | Crime IDAM invalid test account password |

## Workflow Configuration

The E2E tests workflow (`.github/workflows/e2e.yml`) automatically uses these secrets when running tests on:
Expand Down
Loading
Loading