Skip to content

Commit d69fee5

Browse files
feat: use oidc-mock in local running, insert nonce throughout
1 parent b13b5c3 commit d69fee5

8 files changed

Lines changed: 30 additions & 17 deletions

File tree

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PLAYWRIGHT_TIMEOUT=30000
55
SERVICES_JSON_PATH=./services.json
66
PORT=3000
77
SESSION_SECRET=<any long random string>
8-
SSO_CLIENT_ID=<from Internal Access>
9-
SSO_CLIENT_SECRET=<from Internal Access>
8+
SSO_ISSUER=http://localhost:8090/default
9+
SSO_CLIENT_ID=test-client
10+
SSO_CLIENT_SECRET=test-secret
1011
APP_URL=http://localhost:3000

CLAUDE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ The daily cron (2 AM London) enqueues one job per service. Jobs are processed se
3737
## Running locally
3838

3939
```bash
40-
# Start Postgres
41-
docker compose up postgres -d
40+
# Start Postgres and OIDC mock
41+
docker compose up postgres oidc-mock -d
4242

4343
# Run migrations and seed
4444
npm run db:migrate
@@ -56,8 +56,9 @@ Required `.env` (see `.env.example`):
5656
```
5757
DATABASE_URL=postgres://scraper:scraper@localhost:5432/compliance_scraper
5858
SESSION_SECRET=<any long random string>
59-
SSO_CLIENT_ID=<from Internal Access>
60-
SSO_CLIENT_SECRET=<from Internal Access>
59+
SSO_ISSUER=http://localhost:8090/default
60+
SSO_CLIENT_ID=test-client
61+
SSO_CLIENT_SECRET=test-secret
6162
APP_URL=http://localhost:3000
6263
```
6364

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@ pnpm run db:seed
5656
## Running locally
5757

5858
```bash
59+
# Start Postgres and OIDC mock
60+
docker compose up postgres oidc-mock -d
61+
62+
# Run migrations and seed (first time only)
63+
pnpm run db:migrate
64+
pnpm run db:seed
65+
66+
# Start the app
5967
pnpm run dev
60-
pnpm run dev:watch
61-
pnpm run build && pnpm start
6268
```
6369

64-
Opens at [http://localhost:3000](http://localhost:3000)
70+
Opens at [http://localhost:3000](http://localhost:3000). Sign-in uses a local mock identity provider (auto-login, no credentials needed).
6571

6672
### Docker Compose
6773

src/server/views/cookies-list.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="govuk-grid-column-one-quarter">
1717
<div class="govuk-form-group govuk-!-margin-bottom-2">
1818
<label class="govuk-label govuk-label--s" for="organisation">Organisation</label>
19-
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" onchange="this.form.submit()">
19+
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" data-auto-submit>
2020
<option value="">All organisations</option>
2121
{% for org in organisations %}
2222
<option value="{{ org }}" {% if currentFilters.organisation == org %}selected{% endif %}>{{ org }}</option>
@@ -25,7 +25,7 @@
2525
</div>
2626
</div>
2727
{% if currentFilters.organisation %}
28-
<div class="govuk-grid-column-one-quarter" style="padding-top: 30px;">
28+
<div class="govuk-grid-column-one-quarter govuk-!-padding-top-6">
2929
<a href="/cookies" class="govuk-link">Clear filters</a>
3030
</div>
3131
{% endif %}

src/server/views/home.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</a>
3636
{% else %}
3737
<a href="/auth/login" role="button" draggable="false" class="govuk-button" data-module="govuk-button">
38-
Sign in with Internal Access
38+
Sign in
3939
</a>
4040
{% endif %}
4141

src/server/views/layout.njk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,10 @@
172172
});
173173
});
174174
</script>
175+
<script nonce="{{ cspNonce }}">
176+
document.querySelectorAll('select[data-auto-submit]').forEach(function(el) {
177+
el.addEventListener('change', function() { el.form.submit(); });
178+
});
179+
</script>
175180
</body>
176181
</html>

src/server/views/privacy-list.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="govuk-grid-column-one-quarter">
1616
<div class="govuk-form-group govuk-!-margin-bottom-2">
1717
<label class="govuk-label govuk-label--s" for="organisation">Organisation</label>
18-
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" onchange="this.form.submit()">
18+
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" data-auto-submit>
1919
<option value="">All organisations</option>
2020
{% for org in organisations %}
2121
<option value="{{ org }}" {% if currentFilters.organisation == org %}selected{% endif %}>{{ org }}</option>
@@ -24,7 +24,7 @@
2424
</div>
2525
</div>
2626
{% if currentFilters.organisation %}
27-
<div class="govuk-grid-column-one-quarter" style="padding-top: 30px;">
27+
<div class="govuk-grid-column-one-quarter govuk-!-padding-top-6">
2828
<a href="/privacy" class="govuk-link">Clear filters</a>
2929
</div>
3030
{% endif %}

src/server/views/results.njk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="govuk-grid-column-one-quarter">
2121
<div class="govuk-form-group govuk-!-margin-bottom-2">
2222
<label class="govuk-label govuk-label--s" for="status">Stated compliance</label>
23-
<select class="govuk-select govuk-!-width-full" id="status" name="status" onchange="this.form.submit()">
23+
<select class="govuk-select govuk-!-width-full" id="status" name="status" data-auto-submit>
2424
<option value="">All statuses</option>
2525
<option value="fully_compliant" {% if currentFilters.status == 'fully_compliant' %}selected{% endif %}>Fully compliant</option>
2626
<option value="partially_compliant" {% if currentFilters.status == 'partially_compliant' %}selected{% endif %}>Partially compliant</option>
@@ -32,7 +32,7 @@
3232
<div class="govuk-grid-column-one-quarter">
3333
<div class="govuk-form-group govuk-!-margin-bottom-2">
3434
<label class="govuk-label govuk-label--s" for="organisation">Organisation</label>
35-
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" onchange="this.form.submit()">
35+
<select class="govuk-select govuk-!-width-full" id="organisation" name="organisation" data-auto-submit>
3636
<option value="">All organisations</option>
3737
{% for org in organisations %}
3838
<option value="{{ org }}" {% if currentFilters.organisation == org %}selected{% endif %}>{{ org }}</option>
@@ -41,7 +41,7 @@
4141
</div>
4242
</div>
4343
{% if currentFilters.status or currentFilters.organisation %}
44-
<div class="govuk-grid-column-one-quarter" style="padding-top: 30px;">
44+
<div class="govuk-grid-column-one-quarter govuk-!-padding-top-6">
4545
<a href="/accessibility" class="govuk-link">Clear filters</a>
4646
</div>
4747
{% endif %}

0 commit comments

Comments
 (0)