Skip to content

Commit 88fe0ec

Browse files
FrostyApeOneFrostyApeOne
authored andcommitted
Added cypress internal auth user
1 parent baf97ee commit 88fe0ec

6 files changed

Lines changed: 198 additions & 414 deletions

File tree

src/DfE.ExternalApplications.Web/appsettings.Development.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
"UseWebSockets": true,
4646
"InstanceIdentifier": "auto"
4747
}
48+
},
49+
"InternalServiceAuth": {
50+
"TokenLifetimeMinutes": 60
4851
}
4952
}

src/DfE.ExternalApplications.Web/appsettings.Test.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@
5252
"UseWebSockets": true,
5353
"InstanceIdentifier": "auto"
5454
}
55+
},
56+
"InternalServiceAuth": {
57+
"TokenLifetimeMinutes": 60
5558
}
5659
}

src/DfE.ExternalApplications.Web/appsettings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
{
1919
"Email": "eat-transfer-service@service.com",
2020
"ApiKey": "secret"
21+
},
22+
{
23+
"Email": "eat-cypress-service@service.com",
24+
"ApiKey": "secret"
2125
}
2226
],
2327
"SecretKey": "secret",

src/Tests/DfE.ExternalApplications.CypressTests/cypress/auth/authenticationInterceptor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export class AuthenticationInterceptor {
1515
"x-user-context-name": (Cypress.env('username')), // must be present, but not used
1616
"x-user-context-id": "", // must be present for antiforgery claims
1717
"x-user-ad-id": "",
18-
"x-cypress-user": "cypressUser",
18+
"x-service-email": Cypress.env('username'),
1919
"x-cypress-test": "true",
20-
"x-cypress-secret": Cypress.env('cypress_secret')
20+
"x-service-api-key": Cypress.env('cypress_secret')
2121

2222
};
2323
},

src/Tests/DfE.ExternalApplications.CypressTests/cypress/support/e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ beforeEach(() => {
5757
}
5858

5959
// Add Cypress authentication headers
60-
req.headers['x-cypress-test'] = 'true';
61-
req.headers['x-cypress-secret'] = Cypress.env('cypress_secret') || '';
60+
req.headers['x-service-email'] = Cypress.env('username') || '';
61+
req.headers['x-service-api-key'] = Cypress.env('cypress_secret') || '';
6262
});
6363
});
6464

0 commit comments

Comments
 (0)