Skip to content

Commit 0d5d9a2

Browse files
Remove unneeded file
Signed-off-by: Lukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot)
1 parent ca421d0 commit 0d5d9a2

File tree

2 files changed

+55
-9
lines changed

2 files changed

+55
-9
lines changed

tests/functional/cypress/support/commands.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,35 @@ export function shortenMiddle(str) {
204204
return `${first}...${last}`;
205205
}
206206

207+
export function getTokenForV3() {
208+
// V3 APIs require a token with specific claims: http://lfx.dev/claims/username and http://lfx.dev/claims/email
209+
// The token generation is the same as V4, but V3 expects the AUTH0_USERNAME_CLAIM to be set to "http://lfx.dev/claims/username"
210+
cy.task('log', '--> getting token by request for V3');
211+
return cy
212+
.request({
213+
method: 'POST',
214+
url: Cypress.env('AUTH0_TOKEN_API'),
215+
headers: {
216+
'content-type': 'application/json',
217+
},
218+
body: {
219+
grant_type: 'http://auth0.com/oauth/grant-type/password-realm',
220+
realm: 'Username-Password-Authentication',
221+
username: Cypress.env('AUTH0_USER_NAME'),
222+
password: Cypress.env('AUTH0_PASSWORD'),
223+
client_id: Cypress.env('AUTH0_CLIENT_ID'),
224+
audience: 'https://api-gw.dev.platform.linuxfoundation.org/',
225+
scope: 'access:api openid profile email',
226+
},
227+
})
228+
.then((response) => {
229+
expect(response.status).to.eq(200);
230+
const token = response.body.access_token;
231+
cy.task('log', `--> got token ${shortenMiddle(token)} from request for V3`);
232+
return token;
233+
});
234+
}
235+
207236
export function getAPIBaseURL(version) {
208237
const local = Cypress.env('LOCAL');
209238
switch (version) {
@@ -212,6 +241,12 @@ export function getAPIBaseURL(version) {
212241
return 'http://localhost:5001/v4/';
213242
}
214243
return `${Cypress.env('APP_URL')}cla-service/v4/`;
244+
case 'v3':
245+
if (local) {
246+
return 'http://localhost:5001/v3/';
247+
}
248+
// V3 is deployed on the legacy API endpoint, not the new cla-service endpoint
249+
return 'https://api.lfcla.dev.platform.linuxfoundation.org/v3/';
215250
default:
216251
cy.task('log', `--> unknown API version ${version}`);
217252
}
@@ -230,6 +265,26 @@ export function getXACLHeader() {
230265
return {};
231266
}
232267

268+
export function getXACLHeaders() {
269+
// V3 APIs (which are actually V1 internally) use the same authentication as V4
270+
// They need both X-ACL headers and bearer tokens
271+
const xacl = Cypress.env('XACL');
272+
if (xacl) {
273+
return {
274+
'X-ACL': xacl,
275+
'X-USERNAME': 'lgryglicki',
276+
'X-EMAIL': '[email protected]',
277+
};
278+
}
279+
return {};
280+
}
281+
282+
export function getOAuth2Headers() {
283+
// V3 APIs (which are actually V1 internally) use the same authentication as V4
284+
// They need both X-ACL headers and bearer tokens - just alias to getXACLHeaders
285+
return getXACLHeaders();
286+
}
287+
233288
let bearerToken = '';
234289
export function getTokenKey() {
235290
const envToken = Cypress.env('TOKEN');

utils/restore_username_claim.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)