diff --git a/.secrets.baseline b/.secrets.baseline index 765a4526c..35236111e 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "package-lock.json|^.secrets.baseline$", "lines": null }, - "generated_at": "2021-08-17T20:14:30Z", + "generated_at": "2021-10-15T14:47:01Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -119,12 +119,22 @@ "verified_result": null } ], + "auth/authenticators/authenticator.ts": [ + { + "hashed_secret": "fdee05598fdd57ff8e9ae29e92c25a04f2c52fa6", + "is_secret": false, + "is_verified": false, + "line_number": 39, + "type": "Secret Keyword", + "verified_result": null + } + ], "auth/authenticators/cloud-pak-for-data-authenticator.ts": [ { "hashed_secret": "d5ff02fa48e492fac0a245ad63d1ae608e705c05", "is_secret": false, "is_verified": false, - "line_number": 70, + "line_number": 71, "type": "Secret Keyword", "verified_result": null }, @@ -132,7 +142,7 @@ "hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1", "is_secret": false, "is_verified": false, - "line_number": 71, + "line_number": 72, "type": "Secret Keyword", "verified_result": null } @@ -142,7 +152,7 @@ "hashed_secret": "8f4bfc22c4fd7cb884f94ec175ff4a3284a174a1", "is_secret": false, "is_verified": false, - "line_number": 69, + "line_number": 70, "type": "Secret Keyword", "verified_result": null } @@ -312,7 +322,7 @@ "hashed_secret": "2863fa4b5510c46afc2bd2998dfbc0cf3d6df032", "is_secret": false, "is_verified": false, - "line_number": 27, + "line_number": 32, "type": "Secret Keyword", "verified_result": null }, @@ -320,7 +330,7 @@ "hashed_secret": "407bb564bd0e4d31368cb53004c9c42adf8f7be8", "is_secret": false, "is_verified": false, - "line_number": 29, + "line_number": 34, "type": "Secret Keyword", "verified_result": null }, @@ -328,7 +338,7 @@ "hashed_secret": "e38ad214943daad1d64c102faec29de4afe9da3d", "is_secret": false, "is_verified": false, - "line_number": 36, + "line_number": 41, "type": "Secret Keyword", "verified_result": null } @@ -364,7 +374,7 @@ "hashed_secret": "09f798553f7c035c2915bf8c59b46b6c285d2d84", "is_secret": false, "is_verified": false, - "line_number": 4, + "line_number": 20, "type": "Secret Keyword", "verified_result": null } @@ -374,7 +384,7 @@ "hashed_secret": "5c5a15a8b0b3e154d77746945e563ba40100681b", "is_secret": false, "is_verified": false, - "line_number": 19, + "line_number": 35, "type": "Secret Keyword", "verified_result": null } @@ -384,7 +394,7 @@ "hashed_secret": "85dd3fb12cb0dcae03f1bba6fb61f4edd90d986d", "is_secret": false, "is_verified": false, - "line_number": 5, + "line_number": 21, "type": "Secret Keyword", "verified_result": null }, @@ -392,7 +402,7 @@ "hashed_secret": "0c910ad3070d996b37a1c65f542b17adc3f962bc", "is_secret": false, "is_verified": false, - "line_number": 6, + "line_number": 22, "type": "Secret Keyword", "verified_result": null } @@ -402,7 +412,7 @@ "hashed_secret": "1572bd30ac06678a82df42b5913e5e52e27f9a12", "is_secret": false, "is_verified": false, - "line_number": 15, + "line_number": 31, "type": "Secret Keyword", "verified_result": null }, @@ -410,7 +420,7 @@ "hashed_secret": "16856d955c788df03735a24feb2e3ffefd91f3dc", "is_secret": false, "is_verified": false, - "line_number": 16, + "line_number": 32, "type": "Secret Keyword", "verified_result": null } @@ -420,7 +430,7 @@ "hashed_secret": "257368587362aab7f1180b4a5fe550ec26053e05", "is_secret": false, "is_verified": false, - "line_number": 14, + "line_number": 30, "type": "Secret Keyword", "verified_result": null }, @@ -428,7 +438,7 @@ "hashed_secret": "5c5a15a8b0b3e154d77746945e563ba40100681b", "is_secret": false, "is_verified": false, - "line_number": 17, + "line_number": 33, "type": "Secret Keyword", "verified_result": null }, @@ -436,7 +446,7 @@ "hashed_secret": "a3bf8418470bbb21ecdb24c28e38b446a3ab9b75", "is_secret": false, "is_verified": false, - "line_number": 48, + "line_number": 65, "type": "Secret Keyword", "verified_result": null }, @@ -444,7 +454,7 @@ "hashed_secret": "2c208e466e476d4d8cbe055832f40f04e4d5dd23", "is_secret": false, "is_verified": false, - "line_number": 53, + "line_number": 70, "type": "Secret Keyword", "verified_result": null }, @@ -452,7 +462,7 @@ "hashed_secret": "945db841c03e42eef2f3d0a4ff310e2f3b3e59ec", "is_secret": false, "is_verified": false, - "line_number": 77, + "line_number": 94, "type": "Secret Keyword", "verified_result": null } @@ -462,7 +472,7 @@ "hashed_secret": "43ed4c2d8375dfc89e3dc8c917f404b9481d355b", "is_secret": false, "is_verified": false, - "line_number": 5, + "line_number": 21, "type": "Secret Keyword", "verified_result": null } @@ -472,7 +482,7 @@ "hashed_secret": "43ed4c2d8375dfc89e3dc8c917f404b9481d355b", "is_secret": false, "is_verified": false, - "line_number": 13, + "line_number": 29, "type": "Secret Keyword", "verified_result": null } @@ -482,7 +492,7 @@ "hashed_secret": "a7ef1be18bb8d37af79f3d87761a203378bf26a2", "is_secret": false, "is_verified": false, - "line_number": 129, + "line_number": 145, "type": "Secret Keyword", "verified_result": null } @@ -492,7 +502,7 @@ "hashed_secret": "4c65cd3f160d60f7ca28ca04fa60b9035132781c", "is_secret": false, "is_verified": false, - "line_number": 7, + "line_number": 23, "type": "Secret Keyword", "verified_result": null }, @@ -500,7 +510,7 @@ "hashed_secret": "407bb564bd0e4d31368cb53004c9c42adf8f7be8", "is_secret": false, "is_verified": false, - "line_number": 174, + "line_number": 204, "type": "Secret Keyword", "verified_result": null }, @@ -508,7 +518,7 @@ "hashed_secret": "2863fa4b5510c46afc2bd2998dfbc0cf3d6df032", "is_secret": false, "is_verified": false, - "line_number": 200, + "line_number": 230, "type": "Secret Keyword", "verified_result": null }, @@ -516,13 +526,13 @@ "hashed_secret": "ed8c99e906cf3fdbae90a71e06142ebc72b4c056", "is_secret": false, "is_verified": false, - "line_number": 218, + "line_number": 248, "type": "Secret Keyword", "verified_result": null } ] }, - "version": "0.13.1+ibm.40.dss", + "version": "0.13.1+ibm.46.dss", "word_list": { "file": null, "hash": null diff --git a/auth/authenticators/authenticator-interface.ts b/auth/authenticators/authenticator-interface.ts index b057d7533..92a741c51 100644 --- a/auth/authenticators/authenticator-interface.ts +++ b/auth/authenticators/authenticator-interface.ts @@ -45,4 +45,9 @@ export interface AuthenticatorInterface { * authentication information will be added to. */ authenticate(requestOptions: AuthenticateOptions): Promise; + + /** + * Returns a string that indicates the authentication type. + */ + authenticationType(): string; } diff --git a/auth/authenticators/authenticator.ts b/auth/authenticators/authenticator.ts index b975203ae..e88589346 100644 --- a/auth/authenticators/authenticator.ts +++ b/auth/authenticators/authenticator.ts @@ -23,6 +23,23 @@ import { AuthenticateOptions, AuthenticatorInterface } from './authenticator-int * to be used as a stand-alone authenticator. */ export class Authenticator implements AuthenticatorInterface { + /** + * Constants that define the various authenticator types. + */ + static AUTHTYPE_BASIC = 'basic'; + + static AUTHTYPE_BEARERTOKEN = 'bearertoken'; + + static AUTHTYPE_IAM = 'iam'; + + static AUTHTYPE_CONTAINER = 'container'; + + static AUTHTYPE_CP4D = 'cp4d'; + + static AUTHTYPE_NOAUTH = 'noauth'; + + static AUTHTYPE_UNKNOWN = 'unknown'; + /** * Create a new Authenticator instance. * @@ -48,4 +65,19 @@ export class Authenticator implements AuthenticatorInterface { const error = new Error('Should be implemented by subclass!'); return Promise.reject(error); } + + /** + * Retrieves the authenticator's type. + * The returned value will be the same string that is used + * when configuring an instance of the authenticator with the + * "_AUTH_TYPE" configuration property + * (e.g. "basic", "iam", etc.). + * This function should be overridden in each authenticator + * implementation class that extends this class. + * + * @returns a string that indicates the authenticator's type + */ + public authenticationType(): string { + return Authenticator.AUTHTYPE_UNKNOWN; + } } diff --git a/auth/authenticators/basic-authenticator.ts b/auth/authenticators/basic-authenticator.ts index b831b4194..93754b3ed 100644 --- a/auth/authenticators/basic-authenticator.ts +++ b/auth/authenticators/basic-authenticator.ts @@ -75,4 +75,14 @@ export class BasicAuthenticator extends Authenticator { resolve(); }); } + + /** + * Returns the authenticator's type ('basic'). + * + * @returns a string that indicates the authenticator's type + */ + // eslint-disable-next-line class-methods-use-this + public authenticationType(): string { + return Authenticator.AUTHTYPE_BASIC; + } } diff --git a/auth/authenticators/bearer-token-authenticator.ts b/auth/authenticators/bearer-token-authenticator.ts index 425eda3ee..f61c8c7f1 100644 --- a/auth/authenticators/bearer-token-authenticator.ts +++ b/auth/authenticators/bearer-token-authenticator.ts @@ -82,4 +82,14 @@ export class BearerTokenAuthenticator extends Authenticator { resolve(); }); } + + /** + * Returns the authenticator's type ('bearertoken'). + * + * @returns a string that indicates the authenticator's type + */ + // eslint-disable-next-line class-methods-use-this + public authenticationType(): string { + return Authenticator.AUTHTYPE_BEARERTOKEN; + } } diff --git a/auth/authenticators/cloud-pak-for-data-authenticator.ts b/auth/authenticators/cloud-pak-for-data-authenticator.ts index 9d40ef97b..6655bac6f 100644 --- a/auth/authenticators/cloud-pak-for-data-authenticator.ts +++ b/auth/authenticators/cloud-pak-for-data-authenticator.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import { Authenticator } from './authenticator'; import { Cp4dTokenManager } from '../token-managers'; import { BaseOptions, TokenRequestBasedAuthenticator } from './token-request-based-authenticator'; @@ -75,4 +76,14 @@ export class CloudPakForDataAuthenticator extends TokenRequestBasedAuthenticator // also, the token manager will handle input validation this.tokenManager = new Cp4dTokenManager(options); } + + /** + * Returns the authenticator's type ('cp4d'). + * + * @returns a string that indicates the authenticator's type + */ + // eslint-disable-next-line class-methods-use-this + public authenticationType(): string { + return Authenticator.AUTHTYPE_CP4D; + } } diff --git a/auth/authenticators/container-authenticator.ts b/auth/authenticators/container-authenticator.ts index 9c6259975..a3687dd69 100644 --- a/auth/authenticators/container-authenticator.ts +++ b/auth/authenticators/container-authenticator.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import { Authenticator } from './authenticator'; import { ContainerTokenManager } from '../token-managers'; import { IamRequestOptions, IamRequestBasedAuthenticator } from './iam-request-based-authenticator'; @@ -113,4 +114,14 @@ export class ContainerAuthenticator extends IamRequestBasedAuthenticator { // update properties in token manager this.tokenManager.setIamProfileId(iamProfileId); } + + /** + * Returns the authenticator's type ('container'). + * + * @returns a string that indicates the authenticator's type + */ + // eslint-disable-next-line class-methods-use-this + public authenticationType(): string { + return Authenticator.AUTHTYPE_CONTAINER; + } } diff --git a/auth/authenticators/iam-authenticator.ts b/auth/authenticators/iam-authenticator.ts index a66cea9d1..6316bd2e5 100644 --- a/auth/authenticators/iam-authenticator.ts +++ b/auth/authenticators/iam-authenticator.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import { Authenticator } from './authenticator'; import { IamTokenManager } from '../token-managers'; import { validateInput } from '../utils'; import { IamRequestOptions, IamRequestBasedAuthenticator } from './iam-request-based-authenticator'; @@ -82,4 +83,14 @@ export class IamAuthenticator extends IamRequestBasedAuthenticator { public getRefreshToken(): string { return this.tokenManager.getRefreshToken(); } + + /** + * Returns the authenticator's type ('iam'). + * + * @returns a string that indicates the authenticator's type + */ + // eslint-disable-next-line class-methods-use-this + public authenticationType(): string { + return Authenticator.AUTHTYPE_IAM; + } } diff --git a/auth/authenticators/no-auth-authenticator.ts b/auth/authenticators/no-auth-authenticator.ts index 8de2883fd..6338447c1 100644 --- a/auth/authenticators/no-auth-authenticator.ts +++ b/auth/authenticators/no-auth-authenticator.ts @@ -29,4 +29,13 @@ export class NoAuthAuthenticator extends Authenticator { // immediately proceed to request. it will probably fail return Promise.resolve(); } + + /** + * Returns the authenticator's type ('noauth'). + * + * @returns a string that indicates the authenticator's type + */ + public authenticationType(): string { + return Authenticator.AUTHTYPE_NOAUTH; + } } diff --git a/auth/utils/get-authenticator-from-environment.ts b/auth/utils/get-authenticator-from-environment.ts index e697251ad..919dad493 100644 --- a/auth/utils/get-authenticator-from-environment.ts +++ b/auth/utils/get-authenticator-from-environment.ts @@ -82,22 +82,22 @@ export function getAuthenticatorFromEnvironment(serviceName: string): Authentica // fold authType to lower case for case insensitivity switch (authType.toLowerCase()) { - case 'noauth': + case Authenticator.AUTHTYPE_NOAUTH: authenticator = new NoAuthAuthenticator(); break; - case 'basic': + case Authenticator.AUTHTYPE_BASIC: authenticator = new BasicAuthenticator(credentials); break; - case 'bearertoken': + case Authenticator.AUTHTYPE_BEARERTOKEN: authenticator = new BearerTokenAuthenticator(credentials); break; - case 'cp4d': + case Authenticator.AUTHTYPE_CP4D: authenticator = new CloudPakForDataAuthenticator(credentials); break; - case 'iam': + case Authenticator.AUTHTYPE_IAM: authenticator = new IamAuthenticator(credentials); break; - case 'container': + case Authenticator.AUTHTYPE_CONTAINER: authenticator = new ContainerAuthenticator(credentials); break; default: diff --git a/test/unit/basic-authenticator.test.js b/test/unit/basic-authenticator.test.js index 7953659cc..d4fd20e76 100644 --- a/test/unit/basic-authenticator.test.js +++ b/test/unit/basic-authenticator.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const { BasicAuthenticator } = require('../../dist/auth'); +const { Authenticator, BasicAuthenticator } = require('../../dist/auth'); const USERNAME = 'dave'; const PASSWORD = 'grohl'; @@ -26,6 +26,7 @@ const CONFIG = { describe('Basic Authenticator', () => { it('should store the username and password on the class', () => { const authenticator = new BasicAuthenticator(CONFIG); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_BASIC); expect(authenticator.authHeader).toEqual({ Authorization: 'Basic ZGF2ZTpncm9obA==', }); diff --git a/test/unit/bearer-token-authenticator.test.js b/test/unit/bearer-token-authenticator.test.js index d8a3bd405..bfab4c142 100644 --- a/test/unit/bearer-token-authenticator.test.js +++ b/test/unit/bearer-token-authenticator.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const { BearerTokenAuthenticator } = require('../../dist/auth'); +const { Authenticator, BearerTokenAuthenticator } = require('../../dist/auth'); describe('Bearer Token Authenticator', () => { const config = { @@ -24,6 +24,7 @@ describe('Bearer Token Authenticator', () => { it('should store the bearer token on the class', () => { const authenticator = new BearerTokenAuthenticator(config); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_BEARERTOKEN); expect(authenticator.bearerToken).toBe(config.bearerToken); }); diff --git a/test/unit/container-authenticator.test.js b/test/unit/container-authenticator.test.js index 264ee6d22..d1d0130d8 100644 --- a/test/unit/container-authenticator.test.js +++ b/test/unit/container-authenticator.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const { ContainerAuthenticator } = require('../../dist/auth'); +const { Authenticator, ContainerAuthenticator } = require('../../dist/auth'); const { ContainerTokenManager } = require('../../dist/auth'); // mock the `getToken` method in the token manager - dont make any rest calls @@ -43,6 +43,7 @@ describe('Container Authenticator', () => { it('should store all config options on the class', () => { const authenticator = new ContainerAuthenticator(config); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_CONTAINER); expect(authenticator.crTokenFilename).toBe(config.crTokenFilename); expect(authenticator.iamProfileName).toBe(config.iamProfileName); expect(authenticator.iamProfileId).toBe(config.iamProfileId); diff --git a/test/unit/cp4d-authenticator.test.js b/test/unit/cp4d-authenticator.test.js index 6f2bd0c0d..4c7e89108 100644 --- a/test/unit/cp4d-authenticator.test.js +++ b/test/unit/cp4d-authenticator.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const { CloudPakForDataAuthenticator } = require('../../dist/auth'); +const { Authenticator, CloudPakForDataAuthenticator } = require('../../dist/auth'); const { Cp4dTokenManager } = require('../../dist/auth'); const USERNAME = 'danmullen'; @@ -46,6 +46,7 @@ const getTokenSpy = jest describe('CP4D Authenticator', () => { it('should store all CONFIG options on the class', () => { const authenticator = new CloudPakForDataAuthenticator(CONFIG); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_CP4D); expect(authenticator.username).toBe(CONFIG.username); expect(authenticator.password).toBe(CONFIG.password); expect(authenticator.url).toBe(CONFIG.url); diff --git a/test/unit/get-authenticator-from-environment.test.js b/test/unit/get-authenticator-from-environment.test.js index be687fc65..6dfaa9efb 100644 --- a/test/unit/get-authenticator-from-environment.test.js +++ b/test/unit/get-authenticator-from-environment.test.js @@ -16,6 +16,7 @@ const { getAuthenticatorFromEnvironment, + Authenticator, BasicAuthenticator, BearerTokenAuthenticator, CloudPakForDataAuthenticator, @@ -53,6 +54,7 @@ describe('Get Authenticator From Environment Module', () => { setUpNoAuthPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(NoAuthAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_NOAUTH); expect(readExternalSourcesMock).toHaveBeenCalled(); }); @@ -60,36 +62,42 @@ describe('Get Authenticator From Environment Module', () => { setUpBasicPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(BasicAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_BASIC); }); it('should get bearer token authenticator', () => { setUpBearerTokenPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(BearerTokenAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_BEARERTOKEN); }); it('should get iam authenticator', () => { setUpIamPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(IamAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_IAM); }); it('should get cp4d authenticator', () => { setUpCp4dPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(CloudPakForDataAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_CP4D); }); it('should get container authenticator', () => { setUpContainerPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(ContainerAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_CONTAINER); }); it('should throw away service properties and use auth properties', () => { setUpAuthPropsPayload(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(IamAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_IAM); expect(authenticator.apikey).toBe(APIKEY); expect(authenticator.disableSslVerification).toBe(true); expect(authenticator.url).toBe(TOKEN_URL); @@ -99,6 +107,7 @@ describe('Get Authenticator From Environment Module', () => { readExternalSourcesMock.mockImplementation(() => ({ iamProfileName: IAM_PROFILE_NAME })); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(ContainerAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_CONTAINER); expect(authenticator.iamProfileName).toBe(IAM_PROFILE_NAME); }); @@ -106,6 +115,7 @@ describe('Get Authenticator From Environment Module', () => { readExternalSourcesMock.mockImplementation(() => ({ apikey: APIKEY })); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(IamAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_IAM); expect(authenticator.apikey).toBe(APIKEY); }); @@ -120,6 +130,7 @@ describe('Get Authenticator From Environment Module', () => { setUpIamPayloadWithScope(); const authenticator = getAuthenticatorFromEnvironment(SERVICE_NAME); expect(authenticator).toBeInstanceOf(IamAuthenticator); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_IAM); expect(authenticator.scope).toBe('jon snow'); }); }); diff --git a/test/unit/iam-authenticator.test.js b/test/unit/iam-authenticator.test.js index 358b34504..c35e29ef3 100644 --- a/test/unit/iam-authenticator.test.js +++ b/test/unit/iam-authenticator.test.js @@ -14,7 +14,7 @@ * limitations under the License. */ -const { IamAuthenticator } = require('../../dist/auth'); +const { Authenticator, IamAuthenticator } = require('../../dist/auth'); const { IamTokenManager } = require('../../dist/auth'); // mock the `getToken` method in the token manager - dont make any rest calls @@ -41,6 +41,7 @@ describe('IAM Authenticator', () => { it('should store all config options on the class', () => { const authenticator = new IamAuthenticator(config); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_IAM); expect(authenticator.apikey).toBe(config.apikey); expect(authenticator.url).toBe(config.url); expect(authenticator.clientId).toBe(config.clientId); diff --git a/test/unit/no-auth-authenticator.test.js b/test/unit/no-auth-authenticator.test.js index b993392a8..9ef80542e 100644 --- a/test/unit/no-auth-authenticator.test.js +++ b/test/unit/no-auth-authenticator.test.js @@ -14,11 +14,12 @@ * limitations under the License. */ -const { NoAuthAuthenticator } = require('../../dist/auth'); +const { Authenticator, NoAuthAuthenticator } = require('../../dist/auth'); describe('NoAuth Authenticator', () => { it('should resolve Promise on authenticate', async () => { const authenticator = new NoAuthAuthenticator(); + expect(authenticator.authenticationType()).toEqual(Authenticator.AUTHTYPE_NOAUTH); const result = await authenticator.authenticate({}); expect(result).toBeUndefined();