From 4f288e61bb81e889761e30d36e93993296694486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Poullain?= Date: Mon, 25 May 2020 08:52:50 +0200 Subject: [PATCH] [JWT] Remove Auth0 et Cognito tests --- .github/workflows/test.yml | 3 - .../src/authentication/jwt.jwks.spec.ts | 106 ------------------ 2 files changed, 109 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6ca60b536..3c992d7d57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,9 +16,6 @@ jobs: node-version: [8, 10] env: - AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} - AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }} - AUTH0_TOKEN: ${{ secrets.AUTH0_TOKEN }} SETTINGS_AWS_ACCESS_KEY_ID: ${{ secrets.SETTINGS_AWS_ACCESS_KEY_ID }} SETTINGS_AWS_SECRET_ACCESS_KEY: ${{ secrets.SETTINGS_AWS_SECRET_ACCESS_KEY }} NODE_VERSION: ${{ matrix.node-version }} diff --git a/packages/acceptance-tests/src/authentication/jwt.jwks.spec.ts b/packages/acceptance-tests/src/authentication/jwt.jwks.spec.ts index d6ced48784..977da75c5d 100644 --- a/packages/acceptance-tests/src/authentication/jwt.jwks.spec.ts +++ b/packages/acceptance-tests/src/authentication/jwt.jwks.spec.ts @@ -82,110 +82,4 @@ describe('[Authentication|JWT|JWKS] Users can be authenticated with a JWKS retre } }); - it('from Auth0.', () => { - const domain = Config.get2('auth0.domain', 'string'); - const audience = Config.get2('auth0.audience', 'string'); - const token = Config.get2('auth0.token', 'string'); - - if (token === undefined) { - console.warn('AUTH0_TOKEN not defined. Skipping this test...'); - return; - } - - class AppController { - - @Get('/api/users/me') - @JWTRequired({ - secretOrPublicKey: getRSAPublicKeyFromJWKS({ - cache: true, - jwksRequestsPerMinute: 5, - jwksUri: `https://${domain}/.well-known/jwks.json`, - rateLimit: true, - }) - }, { - algorithms: [ 'RS256' ], - audience, - issuer: `https://${domain}/`, - }) - getUser() { - return new HttpResponseOK({ - name: 'Alix' - }); - } - - } - - const app = createApp(AppController); - - return request(app) - .get('/api/users/me') - .set('Authorization', 'Bearer ' + token) - .expect(200) - .then(response => { - deepStrictEqual(response.body, { - name: 'Alix' - }); - }); - }); - - it('from AWS Cognito.', async () => { - const clientId = Config.get2('cognito.clientId', 'string'); - const domain = Config.get2('cognito.domain', 'string'); - const refreshToken = Config.get2('cognito.refreshToken', 'string'); - let token: string; - const region = Config.get2('cognito.region', 'string'); - const userPoolId = Config.get2('cognito.userPoolId', 'string'); - - if (refreshToken === undefined) { - console.warn('COGNITO_REFRESH_TOKEN not defined. Skipping this test...'); - return; - } - - try { - const { body } = await superagent - .post(`https://${domain}.auth.${region}.amazoncognito.com/oauth2/token`) - .send('grant_type=refresh_token') - .send(`client_id=${clientId}`) - .send(`refresh_token=${refreshToken}`); - token = body.id_token; - } catch (error) { - throw new Error('Requesting a new access token failed.'); - } - - class AppController { - - @Get('/api/users/me') - @JWTRequired({ - secretOrPublicKey: getRSAPublicKeyFromJWKS({ - cache: true, - jwksRequestsPerMinute: 5, - jwksUri: `https://cognito-idp.${region}.amazonaws.com/${userPoolId}/.well-known/jwks.json`, - rateLimit: true, - }) - }, { - algorithms: [ 'RS256' ], - audience: clientId, - issuer: `https://cognito-idp.${region}.amazonaws.com/${userPoolId}`, - }) - getUser() { - return new HttpResponseOK({ - name: 'Alix' - }); - } - - } - - const app = createApp(AppController); - - return request(app) - .get('/api/users/me') - .set('Authorization', 'Bearer ' + token) - .expect(200) - .then(response => { - deepStrictEqual(response.body, { - name: 'Alix' - }); - }); - }); - });