]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(auth): remove ocppVersion from UnifiedIdentifier
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Mar 2026 18:29:50 +0000 (19:29 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Mar 2026 18:29:50 +0000 (19:29 +0100)
Version info is now sourced from adapter.ocppVersion since each
station has a single adapter. Eliminates redundant version stamping
on every identifier.

- Remove ocppVersion field from UnifiedIdentifier interface
- CertificateAuthStrategy uses this.adapter.ocppVersion
- Adapters no longer stamp version on created identifiers
- Fix CertificateAuthStrategy OCPP 1.6 test to use 1.6 adapter
  instead of relying on missing certificateHashData

19 files changed:
src/charging-station/ocpp/OCPPServiceUtils.ts
src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts
src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts
src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts
src/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.ts
src/charging-station/ocpp/auth/types/AuthTypes.ts
tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts
tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts
tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts
tests/charging-station/ocpp/auth/helpers/MockFactories.ts
tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts
tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy-DisablePostAuthorize.test.ts
tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts
tests/charging-station/ocpp/auth/types/AuthTypes.test.ts
tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts
tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts
tests/helpers/OCPPAuthIntegrationTest.ts

index e96a7166fb26fbbb1a01439312a4602d69ac2c76..6c4a881dd0821e4c75dd119ac41afe99e73d2c5a 100644 (file)
@@ -191,7 +191,6 @@ export const isIdTagAuthorizedUnified = async (
         connectorId,
         context: AuthContext.TRANSACTION_START,
         identifier: {
-          ocppVersion: stationOcppVersion,
           type: IdentifierType.ID_TAG,
           value: idTag,
         },
index 678640b741849e8abfd6276559235e8cfcaf0a57..b2983c0a0afd343e69fb0965d9eb41e8e265b691 100644 (file)
@@ -144,7 +144,7 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter {
    * Convert OCPP 1.6 idTag to unified identifier
    * @param identifier - OCPP 1.6 idTag string to convert
    * @param additionalData - Optional metadata to include in unified identifier
-   * @returns Unified identifier with ID_TAG type and OCPP 1.6 version
+   * @returns Unified identifier with ID_TAG type
    */
   convertToUnifiedIdentifier (
     identifier: string,
@@ -154,7 +154,6 @@ export class OCPP16AuthAdapter implements OCPPAuthAdapter {
       additionalInfo: additionalData
         ? Object.fromEntries(Object.entries(additionalData).map(([k, v]) => [k, String(v)]))
         : undefined,
-      ocppVersion: OCPPVersion.VERSION_16,
       parentId: additionalData?.parentId as string | undefined,
       type: IdentifierType.ID_TAG,
       value: identifier,
index fa98092194286dd2841e0ed6b8e118f53e5bd909..21ed9af829b9a6b75b3ea05c7976a7697d5110de 100644 (file)
@@ -219,7 +219,7 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter {
    * Convert OCPP 2.0 IdToken to unified identifier
    * @param identifier - OCPP 2.0 IdToken or raw string identifier
    * @param additionalData - Optional metadata to include in the unified identifier
-   * @returns Unified identifier with normalized type and OCPP version metadata
+   * @returns Unified identifier with normalized type and metadata
    */
   convertToUnifiedIdentifier (
     identifier: OCPP20IdTokenType | string,
@@ -256,7 +256,6 @@ export class OCPP20AuthAdapter implements OCPPAuthAdapter {
           ? Object.fromEntries(Object.entries(additionalData).map(([k, v]) => [k, String(v)]))
           : {}),
       },
-      ocppVersion: OCPPVersion.VERSION_20,
       parentId: additionalData?.parentId as string | undefined,
       type: unifiedType,
       value: idToken.idToken,
index f15ed43e7982f3e57c06614083d3309f4848037c..37286c0fa566c022d9ce85543634005e38ea7269 100644 (file)
@@ -308,17 +308,13 @@ export class OCPPAuthServiceImpl implements OCPPAuthService {
     const supportedTypes = new Set<string>()
 
     // Test common identifier types
-    const ocppVersion =
-      this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_16
-        ? OCPPVersion.VERSION_16
-        : OCPPVersion.VERSION_20
     const testIdentifiers: UnifiedIdentifier[] = [
-      { ocppVersion, type: IdentifierType.ISO14443, value: 'test' },
-      { ocppVersion, type: IdentifierType.ISO15693, value: 'test' },
-      { ocppVersion, type: IdentifierType.KEY_CODE, value: 'test' },
-      { ocppVersion, type: IdentifierType.LOCAL, value: 'test' },
-      { ocppVersion, type: IdentifierType.MAC_ADDRESS, value: 'test' },
-      { ocppVersion, type: IdentifierType.NO_AUTHORIZATION, value: 'test' },
+      { type: IdentifierType.ISO14443, value: 'test' },
+      { type: IdentifierType.ISO15693, value: 'test' },
+      { type: IdentifierType.KEY_CODE, value: 'test' },
+      { type: IdentifierType.LOCAL, value: 'test' },
+      { type: IdentifierType.MAC_ADDRESS, value: 'test' },
+      { type: IdentifierType.NO_AUTHORIZATION, value: 'test' },
     ]
 
     testIdentifiers.forEach(identifier => {
index 0059f9f44ced0fbb68bdc799758fc2f8a91eb24c..6d42dfef2b6c7a2b6cb7e77ae41bcb9b927256d8 100644 (file)
@@ -76,7 +76,7 @@ export class CertificateAuthStrategy implements AuthStrategy {
       const adapter = this.adapter
 
       // For OCPP 2.0, we can use certificate-based validation
-      if (request.identifier.ocppVersion === OCPPVersion.VERSION_20) {
+      if (this.adapter.ocppVersion === OCPPVersion.VERSION_20) {
         const result = await this.validateCertificateWithOCPP20(request, adapter, config)
         this.updateStatistics(result, startTime)
         return result
@@ -85,7 +85,7 @@ export class CertificateAuthStrategy implements AuthStrategy {
       // Should not reach here due to canHandle check, but handle gracefully
       return this.createFailureResult(
         AuthorizationStatus.INVALID,
-        `Certificate authentication not supported for OCPP ${request.identifier.ocppVersion}`,
+        `Certificate authentication not supported for OCPP ${this.adapter.ocppVersion}`,
         request.identifier,
         startTime
       )
@@ -113,7 +113,7 @@ export class CertificateAuthStrategy implements AuthStrategy {
     }
 
     // Only supported in OCPP 2.0+
-    if (request.identifier.ocppVersion === OCPPVersion.VERSION_16) {
+    if (this.adapter.ocppVersion === OCPPVersion.VERSION_16) {
       return false
     }
 
index 4d33bb401ce49d3303f705ebbeeb342b0c843f4a..414fc093243cc5dadb2461232dba7c64f6ec47fa 100644 (file)
@@ -257,9 +257,6 @@ export interface UnifiedIdentifier {
   /** Group identifier for group-based authorization (OCPP 2.0) */
   readonly groupId?: string
 
-  /** OCPP version this identifier originated from */
-  readonly ocppVersion: OCPPVersion
-
   /** Parent ID for hierarchical authorization (OCPP 1.6) */
   readonly parentId?: string
 
index 4c3ed7d6a10d84938d76f2a65ba0629524e56d17..4816502f683f6d5b4a3155e12b1abe8c6461ff7b 100644 (file)
@@ -74,7 +74,7 @@ await describe('OCPP Authentication', async () => {
       const request = createMockAuthRequest({
         connectorId: 1,
         context: AuthContext.TRANSACTION_START,
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'VALID_ID_123'),
+        identifier: createMockIdentifier('VALID_ID_123'),
       })
 
       const result = await authService16.authenticate(request)
@@ -98,7 +98,7 @@ await describe('OCPP Authentication', async () => {
         const request = createMockAuthRequest({
           connectorId: 1,
           context,
-          identifier: createMockIdentifier(OCPPVersion.VERSION_16, `CONTEXT_TEST_${context}`),
+          identifier: createMockIdentifier(`CONTEXT_TEST_${context}`),
         })
 
         const result = await authService16.authenticate(request)
@@ -110,7 +110,7 @@ await describe('OCPP Authentication', async () => {
     await it('should authorize request directly', async () => {
       const request = createMockAuthRequest({
         connectorId: 1,
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'AUTH_DIRECT_TEST'),
+        identifier: createMockIdentifier('AUTH_DIRECT_TEST'),
       })
 
       const result = await authService16.authorize(request)
@@ -130,7 +130,7 @@ await describe('OCPP Authentication', async () => {
       const request = createMockAuthRequest({
         connectorId: 2,
         context: AuthContext.TRANSACTION_START,
-        identifier: createMockIdentifier(OCPPVersion.VERSION_20, 'VALID_ID_456'),
+        identifier: createMockIdentifier('VALID_ID_456'),
       })
 
       const result = await authService20.authenticate(request)
@@ -153,7 +153,7 @@ await describe('OCPP Authentication', async () => {
         const request = createMockAuthRequest({
           connectorId: 2,
           context,
-          identifier: createMockIdentifier(OCPPVersion.VERSION_20, `V20_CONTEXT_${context}`),
+          identifier: createMockIdentifier(`V20_CONTEXT_${context}`),
         })
 
         const result = await authService20.authenticate(request)
@@ -175,7 +175,6 @@ await describe('OCPP Authentication', async () => {
         connectorId: 999, // Invalid connector
         context: AuthContext.TRANSACTION_START,
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_16,
           type: IdentifierType.ISO14443,
           value: '', // Invalid empty value
         },
@@ -204,7 +203,7 @@ await describe('OCPP Authentication', async () => {
         const request = createMockAuthRequest({
           connectorId: 1,
           context: i % 2 === 0 ? AuthContext.TRANSACTION_START : AuthContext.TRANSACTION_STOP,
-          identifier: createMockIdentifier(OCPPVersion.VERSION_16, `CONCURRENT_${String(i)}`),
+          identifier: createMockIdentifier(`CONCURRENT_${String(i)}`),
         })
         promises.push(authServiceConcurrent.authenticate(request))
       }
@@ -356,7 +355,7 @@ await describe('OCPP Authentication', async () => {
         strategy.initialize(config)
 
         const request = createMockAuthRequest({
-          identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'LIST-ID'),
+          identifier: createMockIdentifier('LIST-ID'),
         })
         const result = await strategy.authenticate(request, config)
 
index b7f22f2af34bd8ead6211f0177a7ebb7412fdd8b..52a3fcbb699e8fcbe2179e18e47022e702dd3685 100644 (file)
@@ -69,10 +69,9 @@ await describe('OCPP16AuthAdapter', async () => {
       const idTag = 'TEST_ID_TAG'
       const result = adapter.convertToUnifiedIdentifier(idTag)
 
-      const expected = createMockIdentifier(OCPPVersion.VERSION_16, idTag)
+      const expected = createMockIdentifier(idTag)
       assert.strictEqual(result.value, expected.value)
       assert.strictEqual(result.type, expected.type)
-      assert.strictEqual(result.ocppVersion, expected.ocppVersion)
     })
 
     await it('should include additional data in unified identifier', () => {
@@ -88,7 +87,7 @@ await describe('OCPP16AuthAdapter', async () => {
 
   await describe('convertFromUnifiedIdentifier', async () => {
     await it('should convert unified identifier to OCPP 1.6 idTag', () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_16, 'TEST_ID_TAG')
+      const identifier = createMockIdentifier('TEST_ID_TAG')
 
       const result = adapter.convertFromUnifiedIdentifier(identifier)
       assert.strictEqual(result, 'TEST_ID_TAG')
@@ -97,32 +96,25 @@ await describe('OCPP16AuthAdapter', async () => {
 
   await describe('isValidIdentifier', async () => {
     await it('should validate correct OCPP 1.6 identifier', () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_16, 'VALID_TAG')
+      const identifier = createMockIdentifier('VALID_TAG')
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), true)
     })
 
     await it('should reject identifier with empty value', () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_16, '')
+      const identifier = createMockIdentifier('')
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), false)
     })
 
     await it('should reject identifier exceeding max length (20 chars)', () => {
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_16,
-        'THIS_TAG_IS_TOO_LONG_FOR_OCPP16'
-      )
+      const identifier = createMockIdentifier('THIS_TAG_IS_TOO_LONG_FOR_OCPP16')
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), false)
     })
 
     await it('should reject non-ID_TAG types', () => {
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_16,
-        'TEST_TAG',
-        IdentifierType.CENTRAL
-      )
+      const identifier = createMockIdentifier('TEST_TAG', IdentifierType.CENTRAL)
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), false)
     })
@@ -157,7 +149,7 @@ await describe('OCPP16AuthAdapter', async () => {
 
   await describe('authorizeRemote', async () => {
     await it('should perform remote authorization successfully', async () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_16, 'VALID_TAG')
+      const identifier = createMockIdentifier('VALID_TAG')
 
       const result = await adapter.authorizeRemote(identifier, 1, 123)
 
@@ -174,7 +166,7 @@ await describe('OCPP16AuthAdapter', async () => {
           reject(new Error('Network error'))
         })
 
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_16, 'TEST_TAG')
+      const identifier = createMockIdentifier('TEST_TAG')
 
       const result = await adapter.authorizeRemote(identifier, 1)
 
index 80d7345e91c439f13e714e4dab55c19777e99a21..594711fe290b2d09564bedf6ea30430b896f352d 100644 (file)
@@ -58,21 +58,19 @@ await describe('OCPP20AuthAdapter', async () => {
       }
 
       const result = adapter.convertToUnifiedIdentifier(idToken)
-      const expected = createMockIdentifier(OCPPVersion.VERSION_20, 'TEST_TOKEN')
+      const expected = createMockIdentifier('TEST_TOKEN')
 
       assert.strictEqual(result.value, expected.value)
       assert.strictEqual(result.type, IdentifierType.ID_TAG)
-      assert.strictEqual(result.ocppVersion, expected.ocppVersion)
       assert.strictEqual(result.additionalInfo?.ocpp20Type, OCPP20IdTokenEnumType.Central)
     })
 
     await it('should convert string to unified identifier', () => {
       const result = adapter.convertToUnifiedIdentifier('STRING_TOKEN')
-      const expected = createMockIdentifier(OCPPVersion.VERSION_20, 'STRING_TOKEN')
+      const expected = createMockIdentifier('STRING_TOKEN')
 
       assert.strictEqual(result.value, expected.value)
       assert.strictEqual(result.type, expected.type)
-      assert.strictEqual(result.ocppVersion, expected.ocppVersion)
     })
 
     await it('should handle eMAID type correctly', () => {
@@ -107,11 +105,7 @@ await describe('OCPP20AuthAdapter', async () => {
 
   await describe('convertFromUnifiedIdentifier', async () => {
     await it('should convert unified identifier to OCPP 2.0 IdToken', () => {
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_20,
-        'CENTRAL_TOKEN',
-        IdentifierType.CENTRAL
-      )
+      const identifier = createMockIdentifier('CENTRAL_TOKEN', IdentifierType.CENTRAL)
 
       const result = adapter.convertFromUnifiedIdentifier(identifier)
 
@@ -120,11 +114,7 @@ await describe('OCPP20AuthAdapter', async () => {
     })
 
     await it('should map E_MAID type correctly', () => {
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_20,
-        'EMAID_TOKEN',
-        IdentifierType.E_MAID
-      )
+      const identifier = createMockIdentifier('EMAID_TOKEN', IdentifierType.E_MAID)
 
       const result = adapter.convertFromUnifiedIdentifier(identifier)
 
@@ -133,7 +123,7 @@ await describe('OCPP20AuthAdapter', async () => {
     })
 
     await it('should handle ID_TAG to Local mapping', () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_20, 'LOCAL_TAG')
+      const identifier = createMockIdentifier('LOCAL_TAG')
 
       const result = adapter.convertFromUnifiedIdentifier(identifier)
 
@@ -143,24 +133,19 @@ await describe('OCPP20AuthAdapter', async () => {
 
   await describe('isValidIdentifier', async () => {
     await it('should validate correct OCPP 2.0 identifier', () => {
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_20,
-        'VALID_TOKEN',
-        IdentifierType.CENTRAL
-      )
+      const identifier = createMockIdentifier('VALID_TOKEN', IdentifierType.CENTRAL)
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), true)
     })
 
     await it('should reject identifier with empty value', () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_20, '', IdentifierType.CENTRAL)
+      const identifier = createMockIdentifier('', IdentifierType.CENTRAL)
 
       assert.strictEqual(adapter.isValidIdentifier(identifier), false)
     })
 
     await it('should reject identifier exceeding max length (36 chars)', () => {
       const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_20,
         'THIS_TOKEN_IS_DEFINITELY_TOO_LONG_FOR_OCPP20_SPECIFICATION',
         IdentifierType.CENTRAL
       )
@@ -180,7 +165,7 @@ await describe('OCPP20AuthAdapter', async () => {
       ]
 
       for (const type of validTypes) {
-        const identifier = createMockIdentifier(OCPPVersion.VERSION_20, 'VALID_TOKEN', type)
+        const identifier = createMockIdentifier('VALID_TOKEN', type)
         assert.strictEqual(adapter.isValidIdentifier(identifier), true)
       }
     })
@@ -233,11 +218,7 @@ await describe('OCPP20AuthAdapter', async () => {
         ),
       } as unknown as ChargingStation['ocppRequestService']
 
-      const identifier = createMockIdentifier(
-        OCPPVersion.VERSION_20,
-        'VALID_TOKEN',
-        IdentifierType.CENTRAL
-      )
+      const identifier = createMockIdentifier('VALID_TOKEN', IdentifierType.CENTRAL)
 
       const result = await adapter.authorizeRemote(identifier, 1, 'tx_123')
 
@@ -248,7 +229,7 @@ await describe('OCPP20AuthAdapter', async () => {
     })
 
     await it('should handle invalid token gracefully', async () => {
-      const identifier = createMockIdentifier(OCPPVersion.VERSION_20, '', IdentifierType.CENTRAL)
+      const identifier = createMockIdentifier('', IdentifierType.CENTRAL)
 
       const result = await adapter.authorizeRemote(identifier, 1)
 
index ebf53db33971e4a3ee674f18f875346d4658cf77..09917b9ade15eec90c7dfc0586f0bcc86ab25903 100644 (file)
@@ -32,17 +32,14 @@ import { OCPPVersion } from '../../../../../src/types/index.js'
 
 /**
  * Create a mock UnifiedIdentifier for any OCPP version.
- * @param ocppVersion - OCPP version (defaults to VERSION_16)
  * @param value - Identifier token value (defaults to 'TEST-TAG-001')
  * @param type - Identifier type enum value (defaults to ID_TAG)
- * @returns Mock UnifiedIdentifier configured for specified OCPP version
+ * @returns Mock UnifiedIdentifier configured for testing
  */
 export const createMockIdentifier = (
-  ocppVersion: OCPPVersion = OCPPVersion.VERSION_16,
   value = 'TEST-TAG-001',
   type: IdentifierType = IdentifierType.ID_TAG
 ): UnifiedIdentifier => ({
-  ocppVersion,
   type,
   value,
 })
@@ -209,7 +206,6 @@ export const createMockOCPPAdapter = (
       ? identifier.value
       : { idToken: identifier.value, type: identifier.type },
   convertToUnifiedIdentifier: (identifier: object | string) => ({
-    ocppVersion,
     type: IdentifierType.ID_TAG,
     value:
       typeof identifier === 'string'
index b3ec246495e062e2b05630e62c8b8148f12bce41..eb307b560fb66ee1f6ad55be38ed7eb5f475650a 100644 (file)
@@ -103,7 +103,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       await authService.initialize()
 
       const idTagIdentifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VALID_ID_TAG',
       }
@@ -116,7 +115,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       await authService.initialize()
 
       const centralIdentifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CENTRAL,
         value: 'CENTRAL_ID',
       }
@@ -167,7 +165,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'TAG_TO_INVALIDATE',
       }
@@ -208,7 +205,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VALID_TAG',
       }
@@ -230,7 +226,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'UNKNOWN_TAG',
       }
@@ -259,7 +254,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'LOCAL_TAG',
       }
@@ -284,7 +278,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation16)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'OCPP16_TAG',
       }
@@ -304,7 +297,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation20)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.E_MAID,
         value: 'EMAID123456',
       }
@@ -332,7 +324,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: '',
       }
@@ -362,7 +353,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation16)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'START_TAG',
       }
@@ -383,7 +373,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation16)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'STOP_TAG',
       }
@@ -404,7 +393,6 @@ await describe('OCPPAuthServiceImpl', async () => {
       const authService = new OCPPAuthServiceImpl(mockStation20)
 
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CENTRAL,
         value: 'REMOTE_ID',
       }
index 3a3f1ffbdc1b08328ff6e21292e4964b25214511..321a5320f0e3a3e5a79b3bc81387c4b0f35c6a96 100644 (file)
@@ -48,7 +48,6 @@ await describe('CertificateAuthStrategy', async () => {
           )
         }),
       convertToUnifiedIdentifier: identifier => ({
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CERTIFICATE,
         value: typeof identifier === 'string' ? identifier : JSON.stringify(identifier),
       }),
@@ -100,7 +99,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'DEF456',
             serialNumber: 'TEST_CERT_001',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_IDENTIFIER',
         },
@@ -113,7 +111,6 @@ await describe('CertificateAuthStrategy', async () => {
       const config = createTestAuthConfig({ certificateAuthEnabled: true })
       const request = createMockAuthRequest({
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.ID_TAG,
           value: 'ID_TAG',
         },
@@ -123,16 +120,25 @@ await describe('CertificateAuthStrategy', async () => {
     })
 
     await it('should return false for OCPP 1.6', () => {
+      const ocpp16Adapter = createMockOCPPAdapter(OCPPVersion.VERSION_16)
+      const ocpp16Strategy = new CertificateAuthStrategy(mockStation, ocpp16Adapter)
+      ocpp16Strategy.initialize(createTestAuthConfig({ certificateAuthEnabled: true }))
+
       const config = createTestAuthConfig({ certificateAuthEnabled: true })
       const request = createMockAuthRequest({
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_16,
+          certificateHashData: {
+            hashAlgorithm: 'SHA256',
+            issuerKeyHash: 'ABC123',
+            issuerNameHash: 'DEF456',
+            serialNumber: 'TEST_CERT_001',
+          },
           type: IdentifierType.CERTIFICATE,
           value: 'CERT',
         },
       })
 
-      assert.strictEqual(strategy.canHandle(request, config), false)
+      assert.strictEqual(ocpp16Strategy.canHandle(request, config), false)
     })
 
     await it('should return false when certificate auth is disabled', () => {
@@ -145,7 +151,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'DEF456',
             serialNumber: 'TEST_CERT_001',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT',
         },
@@ -158,7 +163,6 @@ await describe('CertificateAuthStrategy', async () => {
       const config = createTestAuthConfig({ certificateAuthEnabled: true })
       const request = createMockAuthRequest({
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_NO_DATA',
         },
@@ -184,7 +188,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: '789012ghi345',
             serialNumber: 'TEST_CERT_001',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_TEST',
         },
@@ -207,7 +210,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'def456',
             serialNumber: 'INVALID_CERT',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_INVALID',
         },
@@ -229,7 +231,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'def456',
             serialNumber: 'REVOKED_CERT',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_REVOKED',
         },
@@ -245,7 +246,6 @@ await describe('CertificateAuthStrategy', async () => {
       const config = createTestAuthConfig({ certificateAuthEnabled: true })
       const request = createMockAuthRequest({
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_NO_DATA',
         },
@@ -267,7 +267,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'def456',
             serialNumber: 'TEST_CERT',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_BAD_ALGO',
         },
@@ -289,7 +288,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'also-not-hex!',
             serialNumber: 'TEST_CERT',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_BAD_HASH',
         },
@@ -324,7 +322,6 @@ await describe('CertificateAuthStrategy', async () => {
             issuerNameHash: 'def456',
             serialNumber: 'TEST_CERT_001',
           },
-          ocppVersion: OCPPVersion.VERSION_20,
           type: IdentifierType.CERTIFICATE,
           value: 'CERT_TEST',
         },
index 3573265b546edbbb589bf3aae5797e16fb9a6fbe..ccef7f8c6f38bdeb974765fe25b6b97cd5dc4e00 100644 (file)
@@ -11,7 +11,6 @@ import {
   AuthorizationStatus,
   IdentifierType,
 } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
-import { OCPPVersion } from '../../../../../src/types/index.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 import {
   createMockAuthCache,
@@ -46,11 +45,7 @@ await describe('LocalAuthStrategy - DisablePostAuthorize', async () => {
       })
       strategy.initialize(config)
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_20,
-          'BLOCKED-TAG',
-          IdentifierType.ISO14443
-        ),
+        identifier: createMockIdentifier('BLOCKED-TAG', IdentifierType.ISO14443),
       })
 
       // Act
@@ -78,11 +73,7 @@ await describe('LocalAuthStrategy - DisablePostAuthorize', async () => {
       })
       strategy.initialize(config)
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_20,
-          'BLOCKED-TAG',
-          IdentifierType.ISO14443
-        ),
+        identifier: createMockIdentifier('BLOCKED-TAG', IdentifierType.ISO14443),
       })
 
       // Act
@@ -111,11 +102,7 @@ await describe('LocalAuthStrategy - DisablePostAuthorize', async () => {
       })
       strategy.initialize(config)
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_20,
-          'BLOCKED-TAG',
-          IdentifierType.ISO14443
-        ),
+        identifier: createMockIdentifier('BLOCKED-TAG', IdentifierType.ISO14443),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -142,11 +129,7 @@ await describe('LocalAuthStrategy - DisablePostAuthorize', async () => {
       })
       strategy.initialize(config)
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_20,
-          'BLOCKED-TAG',
-          IdentifierType.ISO14443
-        ),
+        identifier: createMockIdentifier('BLOCKED-TAG', IdentifierType.ISO14443),
       })
 
       // Act
index b684a91bfcdda7dfa0fcf5e964da626d9af807b7..c0e6451437f6571f98f4aeaf5fb04bc3d147f26a 100644 (file)
@@ -18,7 +18,6 @@ import {
   AuthorizationStatus,
   IdentifierType,
 } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
-import { OCPPVersion } from '../../../../../src/types/index.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 import {
   createMockAuthCache,
@@ -72,7 +71,7 @@ await describe('LocalAuthStrategy', async () => {
     await it('should return true when local auth list is enabled', () => {
       const config = createTestAuthConfig({ localAuthListEnabled: true })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'TEST_TAG', IdentifierType.ID_TAG),
+        identifier: createMockIdentifier('TEST_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategy.canHandle(request, config), true)
     })
@@ -80,7 +79,7 @@ await describe('LocalAuthStrategy', async () => {
     await it('should return true when cache is enabled', () => {
       const config = createTestAuthConfig({ authorizationCacheEnabled: true })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'TEST_TAG', IdentifierType.ID_TAG),
+        identifier: createMockIdentifier('TEST_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategy.canHandle(request, config), true)
     })
@@ -88,7 +87,7 @@ await describe('LocalAuthStrategy', async () => {
     await it('should return false when nothing is enabled', () => {
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'TEST_TAG', IdentifierType.ID_TAG),
+        identifier: createMockIdentifier('TEST_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategy.canHandle(request, config), false)
     })
@@ -120,11 +119,7 @@ await describe('LocalAuthStrategy', async () => {
         localAuthListEnabled: true,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'LOCAL_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('LOCAL_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -144,11 +139,7 @@ await describe('LocalAuthStrategy', async () => {
 
       const config = createTestAuthConfig({ authorizationCacheEnabled: true })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'CACHED_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('CACHED_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -163,11 +154,7 @@ await describe('LocalAuthStrategy', async () => {
       const request = createMockAuthRequest({
         allowOffline: true,
         context: AuthContext.TRANSACTION_STOP,
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'UNKNOWN_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('UNKNOWN_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -181,11 +168,7 @@ await describe('LocalAuthStrategy', async () => {
     await it('should return undefined when no local auth available', async () => {
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'UNKNOWN_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('UNKNOWN_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
index 2faa90aead7ebaabc08ff59c336a4eccb0352b92..6d983106f0e90ff970a67a9378effb5f0be225eb 100644 (file)
@@ -83,11 +83,7 @@ await describe('RemoteAuthStrategy', async () => {
     await it('should return true when remote auth is enabled', () => {
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'REMOTE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('REMOTE_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategy.canHandle(request, config), true)
     })
@@ -97,11 +93,7 @@ await describe('RemoteAuthStrategy', async () => {
         remoteAuthorization: false,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'REMOTE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('REMOTE_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategy.canHandle(request, config), false)
     })
@@ -110,11 +102,7 @@ await describe('RemoteAuthStrategy', async () => {
       const strategyNoAdapters = new RemoteAuthStrategy()
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'REMOTE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('REMOTE_TAG', IdentifierType.ID_TAG),
       })
       assert.strictEqual(strategyNoAdapters.canHandle(request, config), false)
     })
@@ -129,11 +117,7 @@ await describe('RemoteAuthStrategy', async () => {
     await it('should authenticate using adapter', async () => {
       const config = createTestAuthConfig({ authorizationCacheEnabled: true })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'REMOTE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('REMOTE_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -154,11 +138,7 @@ await describe('RemoteAuthStrategy', async () => {
         authorizationCacheLifetime: 300,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'CACHE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('CACHE_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -185,11 +165,7 @@ await describe('RemoteAuthStrategy', async () => {
         authorizationCacheLifetime: 300,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'BLOCKED_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('BLOCKED_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -216,11 +192,7 @@ await describe('RemoteAuthStrategy', async () => {
         authorizationCacheLifetime: 300,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'EXPIRED_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('EXPIRED_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -247,11 +219,7 @@ await describe('RemoteAuthStrategy', async () => {
         authorizationCacheLifetime: 300,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'INVALID_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('INVALID_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -269,11 +237,7 @@ await describe('RemoteAuthStrategy', async () => {
         authorizationCacheLifetime: 300,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'ACCEPTED_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('ACCEPTED_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -285,11 +249,7 @@ await describe('RemoteAuthStrategy', async () => {
 
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'UNAVAILABLE_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('UNAVAILABLE_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -303,7 +263,6 @@ await describe('RemoteAuthStrategy', async () => {
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
         identifier: {
-          ocppVersion: OCPPVersion.VERSION_201,
           type: IdentifierType.ID_TAG,
           value: 'UNKNOWN_VERSION_TAG',
         },
@@ -320,11 +279,7 @@ await describe('RemoteAuthStrategy', async () => {
 
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'ERROR_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('ERROR_TAG', IdentifierType.ID_TAG),
       })
 
       const result = await strategy.authenticate(request, config)
@@ -355,11 +310,7 @@ await describe('RemoteAuthStrategy', async () => {
         localAuthListEnabled: true,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'LOCAL_AUTH_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('LOCAL_AUTH_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -383,11 +334,7 @@ await describe('RemoteAuthStrategy', async () => {
         localAuthListEnabled: true,
       })
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(
-          OCPPVersion.VERSION_16,
-          'REMOTE_AUTH_TAG',
-          IdentifierType.ID_TAG
-        ),
+        identifier: createMockIdentifier('REMOTE_AUTH_TAG', IdentifierType.ID_TAG),
       })
 
       await strategy.authenticate(request, config)
@@ -402,7 +349,7 @@ await describe('RemoteAuthStrategy', async () => {
 
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'TEST', IdentifierType.ID_TAG),
+        identifier: createMockIdentifier('TEST', IdentifierType.ID_TAG),
       })
 
       assert.strictEqual(newStrategy.canHandle(request, config), true)
@@ -413,7 +360,7 @@ await describe('RemoteAuthStrategy', async () => {
 
       const config = createTestAuthConfig()
       const request = createMockAuthRequest({
-        identifier: createMockIdentifier(OCPPVersion.VERSION_16, 'TEST', IdentifierType.ID_TAG),
+        identifier: createMockIdentifier('TEST', IdentifierType.ID_TAG),
       })
 
       assert.strictEqual(strategy.canHandle(request, config), false)
index 2d934f6d535cd8d279ae79830ac94f181f9a178f..361c93847033fecc8ffbf8fc3521a441c79dd057 100644 (file)
@@ -252,14 +252,12 @@ await describe('AuthTypes', async () => {
   await describe('UnifiedIdentifier', async () => {
     await it('should create valid OCPP 1.6 identifier', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VALID_ID_TAG',
       }
 
       assert.strictEqual(identifier.value, 'VALID_ID_TAG')
       assert.strictEqual(identifier.type, IdentifierType.ID_TAG)
-      assert.strictEqual(identifier.ocppVersion, OCPPVersion.VERSION_16)
     })
 
     await it('should create valid OCPP 2.0 identifier with additional info', () => {
@@ -268,14 +266,12 @@ await describe('AuthTypes', async () => {
           contractId: 'CONTRACT123',
           issuer: 'EMSProvider',
         },
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.E_MAID,
         value: 'EMAID123456',
       }
 
       assert.strictEqual(identifier.value, 'EMAID123456')
       assert.strictEqual(identifier.type, IdentifierType.E_MAID)
-      assert.strictEqual(identifier.ocppVersion, OCPPVersion.VERSION_20)
       assert.notStrictEqual(identifier.additionalInfo, undefined)
       assert.strictEqual(identifier.additionalInfo?.issuer, 'EMSProvider')
     })
@@ -288,7 +284,6 @@ await describe('AuthTypes', async () => {
           issuerNameHash: 'ISSUER_HASH',
           serialNumber: '123456',
         },
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CERTIFICATE,
         value: 'CERT_IDENTIFIER',
       }
index d59523f5cfb4ac45eeb98337b1020a2fdea69f3f..64a6c5562c1dbb7b66f73dfebe48f2a13c80765b 100644 (file)
@@ -14,7 +14,6 @@ import {
   type UnifiedIdentifier,
 } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
 import { AuthHelpers } from '../../../../../src/charging-station/ocpp/auth/utils/AuthHelpers.js'
-import { OCPPVersion } from '../../../../../src/types/index.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 
 await describe('AuthHelpers', async () => {
@@ -53,7 +52,6 @@ await describe('AuthHelpers', async () => {
   await describe('createAuthRequest', async () => {
     await it('should create basic auth request with minimal parameters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'TEST123',
       }
@@ -71,7 +69,6 @@ await describe('AuthHelpers', async () => {
 
     await it('should create auth request with connector ID', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.LOCAL,
         value: 'LOCAL001',
       }
@@ -85,7 +82,6 @@ await describe('AuthHelpers', async () => {
 
     await it('should create auth request with metadata', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CENTRAL,
         value: 'CENTRAL001',
       }
@@ -129,7 +125,6 @@ await describe('AuthHelpers', async () => {
     await it('should format error message with truncated identifier', () => {
       const error = new Error('Connection timeout')
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VERY_LONG_IDENTIFIER_VALUE_12345',
       }
@@ -144,7 +139,6 @@ await describe('AuthHelpers', async () => {
     await it('should handle short identifiers correctly', () => {
       const error = new Error('Invalid format')
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.LOCAL,
         value: 'SHORT',
       }
index 9eceffa428ea332b1d876d0737af3d69e6735e5d..b41c195e8dce264a308fb54666fffafca02b3109 100644 (file)
@@ -11,7 +11,6 @@ import {
   type UnifiedIdentifier,
 } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
 import { AuthValidators } from '../../../../../src/charging-station/ocpp/auth/utils/AuthValidators.js'
-import { OCPPVersion } from '../../../../../src/types/index.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 
 await describe('AuthValidators', async () => {
@@ -257,7 +256,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return false for empty value', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: '',
       }
@@ -267,7 +265,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return false for ID_TAG exceeding 20 characters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VERY_LONG_IDENTIFIER_VALUE_123456789',
       }
@@ -277,7 +274,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for valid ID_TAG within 20 characters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_16,
         type: IdentifierType.ID_TAG,
         value: 'VALID_ID_TAG',
       }
@@ -287,7 +283,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for OCPP 2.0 LOCAL type within 36 characters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.LOCAL,
         value: 'LOCAL_TOKEN_123',
       }
@@ -297,7 +292,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return false for OCPP 2.0 type exceeding 36 characters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CENTRAL,
         value: 'VERY_LONG_CENTRAL_IDENTIFIER_VALUE_1234567890123456789',
       }
@@ -307,7 +301,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for CENTRAL type within 36 characters', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.CENTRAL,
         value: 'CENTRAL_TOKEN',
       }
@@ -317,7 +310,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for E_MAID type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.E_MAID,
         value: 'DE-ABC-123456',
       }
@@ -327,7 +319,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for ISO14443 type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.ISO14443,
         value: '04A2B3C4D5E6F7',
       }
@@ -337,7 +328,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for KEY_CODE type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.KEY_CODE,
         value: '1234',
       }
@@ -347,7 +337,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for MAC_ADDRESS type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.MAC_ADDRESS,
         value: '00:11:22:33:44:55',
       }
@@ -357,7 +346,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return true for NO_AUTHORIZATION type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         type: IdentifierType.NO_AUTHORIZATION,
         value: 'NO_AUTH',
       }
@@ -367,7 +355,6 @@ await describe('AuthValidators', async () => {
 
     await it('should return false for unsupported type', () => {
       const identifier: UnifiedIdentifier = {
-        ocppVersion: OCPPVersion.VERSION_20,
         // @ts-expect-error: Testing invalid type
         type: 'UNSUPPORTED_TYPE',
         value: 'VALUE',
index e2afb74981377101178a68b2dac0575d41b9cf08..47ad76df43fb63300785d6bf918600474f4f6be2 100644 (file)
@@ -13,7 +13,6 @@ import {
   AuthorizationStatus,
   IdentifierType,
 } from '../../src/charging-station/ocpp/auth/types/AuthTypes.js'
-import { OCPPVersion } from '../../src/types/index.js'
 import { logger } from '../../src/utils/index.js'
 
 export class OCPPAuthIntegrationTest {
@@ -115,10 +114,6 @@ export class OCPPAuthIntegrationTest {
 
   private async testCacheOperations (): Promise<void> {
     const testIdentifier: UnifiedIdentifier = {
-      ocppVersion:
-        this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_16
-          ? OCPPVersion.VERSION_16
-          : OCPPVersion.VERSION_201,
       type: IdentifierType.LOCAL,
       value: 'CACHE_TEST_ID',
     }
@@ -162,7 +157,6 @@ export class OCPPAuthIntegrationTest {
 
   private async testErrorHandling (): Promise<void> {
     const invalidIdentifier: UnifiedIdentifier = {
-      ocppVersion: OCPPVersion.VERSION_16,
       type: IdentifierType.ISO14443,
       value: '',
     }
@@ -195,7 +189,6 @@ export class OCPPAuthIntegrationTest {
 
   private async testOCPP16AuthFlow (): Promise<void> {
     const identifier: UnifiedIdentifier = {
-      ocppVersion: OCPPVersion.VERSION_16,
       type: IdentifierType.ISO14443,
       value: 'VALID_ID_123',
     }
@@ -224,7 +217,6 @@ export class OCPPAuthIntegrationTest {
 
   private async testOCPP20AuthFlow (): Promise<void> {
     const identifier: UnifiedIdentifier = {
-      ocppVersion: OCPPVersion.VERSION_20,
       type: IdentifierType.ISO15693,
       value: 'VALID_ID_456',
     }
@@ -270,10 +262,6 @@ export class OCPPAuthIntegrationTest {
     }
 
     const identifier: UnifiedIdentifier = {
-      ocppVersion:
-        this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_16
-          ? OCPPVersion.VERSION_16
-          : OCPPVersion.VERSION_20,
       type: IdentifierType.ISO14443,
       value: 'PERF_TEST_ID',
     }
@@ -340,10 +328,6 @@ export class OCPPAuthIntegrationTest {
     }
 
     const testIdentifier: UnifiedIdentifier = {
-      ocppVersion:
-        this.chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_16
-          ? OCPPVersion.VERSION_16
-          : OCPPVersion.VERSION_20,
       type: IdentifierType.ISO14443,
       value: 'TEST123',
     }