Skip to content

Commit 4eabc30

Browse files
authored
Merge pull request #178 from communitiesuk/FSPT-342_disable-test-auth-not-uat
FSPT-342 - Replace JWT auth with basic auth in pre-prod environments
2 parents eff41bf + f7f6de0 commit 4eabc30

File tree

3 files changed

+56
-8
lines changed

3 files changed

+56
-8
lines changed

copilot/fsd-form-designer-adapter/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ variables:
5454
NODE_ENV: production
5555
CHOKIDAR_USEPOLLING: true
5656
PREVIEW_URL: "https://application-questions.access-funding.${COPILOT_ENVIRONMENT_NAME}.communities.gov.uk"
57-
PUBLISH_URL: "http://fsd-form-runner-adapter:3009"
5857
AUTH_SERVICE_URL: "https://account.access-funding.${COPILOT_ENVIRONMENT_NAME}.communities.gov.uk"
5958
SSO_LOGIN_URL: "/sso/login?return_app=form-designer"
6059
SSO_LOGOUT_URL: "/sessions/sign-out"
6160
AUTH_COOKIE_NAME: "fsd_user_token"
6261
AUTH_ENABLED: true
6362

6463
secrets:
64+
PUBLISH_URL: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/FORM_RUNNER_INTERNAL_HOST
6565
RSA256_PUBLIC_KEY_BASE64: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/RSA256_PUBLIC_KEY_BASE64
6666
SESSION_COOKIE_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/SESSION_COOKIE_PASSWORD
6767

copilot/fsd-form-runner-adapter/manifest.yml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ variables:
6666
COPILOT_ENV: ${COPILOT_ENVIRONMENT_NAME}
6767
AWS_BUCKET_NAME:
6868
from_cfn: ${COPILOT_APPLICATION_NAME}-${COPILOT_ENVIRONMENT_NAME}-FormUploadsBucket
69-
BASIC_AUTH_ON: false
7069
NODE_CONFIG: '{"safelist": ["fsd-application-store", "fsd-pre-award-stores", "fsd-pre-award", "fsd-pre-award.${COPILOT_ENVIRONMENT_NAME}.pre-award.local"]}'
7170
NODE_ENV: production
7271
SINGLE_REDIS: true
@@ -84,14 +83,47 @@ environments:
8483
dev:
8584
variables:
8685
PREVIEW_MODE: true
87-
8886
count:
8987
spot: 2
88+
sidecars:
89+
nginx:
90+
port: 8087
91+
image:
92+
location: xscys/nginx-sidecar-basic-auth
93+
variables:
94+
FORWARD_PORT: 3009
95+
CLIENT_MAX_BODY_SIZE: 10m
96+
secrets:
97+
BASIC_AUTH_USERNAME: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_USERNAME
98+
BASIC_AUTH_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_PASSWORD
99+
http:
100+
target_container: nginx
101+
healthcheck:
102+
path: /health-check
103+
port: 3009
104+
90105
test:
91106
variables:
92107
PREVIEW_MODE: true
93108
count:
94109
spot: 2
110+
sidecars:
111+
nginx:
112+
port: 8087
113+
image:
114+
location: xscys/nginx-sidecar-basic-auth
115+
variables:
116+
FORWARD_PORT: 3009
117+
CLIENT_MAX_BODY_SIZE: 10m
118+
secrets:
119+
BASIC_AUTH_USERNAME: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_USERNAME
120+
BASIC_AUTH_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_PASSWORD
121+
http:
122+
target_container: nginx
123+
healthcheck:
124+
path: /health-check
125+
port: 3009
126+
95127
uat:
96128
variables:
97129
PREVIEW_MODE: true
@@ -106,12 +138,28 @@ environments:
106138
value: 80
107139
requests: 30
108140
response_time: 2s
141+
sidecars:
142+
nginx:
143+
port: 8087
144+
image:
145+
location: xscys/nginx-sidecar-basic-auth
146+
variables:
147+
FORWARD_PORT: 3009
148+
CLIENT_MAX_BODY_SIZE: 10m
149+
secrets:
150+
BASIC_AUTH_USERNAME: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_USERNAME
151+
BASIC_AUTH_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/BASIC_AUTH_PASSWORD
152+
http:
153+
target_container: nginx
154+
healthcheck:
155+
path: /health-check
156+
port: 3009
157+
109158
prod:
110159
http:
111160
alias: ['forms.access-funding.levellingup.gov.uk', 'application-questions.access-funding.communities.gov.uk']
112161
variables:
113162
ACCESSIBILITY_STATEMENT_URL: "https://apply.access-funding.communities.gov.uk/accessibility_statement"
114-
BASIC_AUTH_ON: false
115163
CONTACT_US_URL: "https://apply.access-funding.communities.gov.uk/contact_us"
116164
COOKIE_POLICY_URL: "https://apply.access-funding.communities.gov.uk/cookie_policy"
117165
FEEDBACK_LINK: "https://apply.access-funding.communities.gov.uk/feedback"

runner/src/server/plugins/engine/api/RegisterFormPublishApi.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ export class RegisterFormPublishApi implements RegisterApi {
244244
}
245245
}
246246

247-
// TODO: Stop being naughty! Conditionally disabling auth for UAT env is a temporary measure for getting FAB
248-
// into production
249-
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv !== "uat") {
247+
// TODO: Stop being naughty! Conditionally disabling auth for pre-prod envs is a temporary measure for getting
248+
// FAB into production
249+
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv === "prod") {
250250
getOptions.options.auth = jwtAuthStrategyName
251251
}
252252

@@ -311,7 +311,7 @@ export class RegisterFormPublishApi implements RegisterApi {
311311
handler: postHandler,
312312
}
313313
}
314-
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv !== "uat") {
314+
if (config.jwtAuthEnabled && config.jwtAuthEnabled === "true" && config.copilotEnv === "prod") {
315315
postConfig.options.auth = jwtAuthStrategyName
316316
}
317317
server.route(postConfig);

0 commit comments

Comments
 (0)