@zetra/citrineos-util 1.8.3-fork.1 → 1.8.3-fork.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authorization/ApiAuthPlugin.d.ts +1 -1
- package/dist/authorization/ApiAuthPlugin.js +1 -1
- package/dist/authorization/OidcTokenProvider.d.ts +2 -15
- package/dist/authorization/OidcTokenProvider.js +4 -43
- package/dist/authorization/OidcTokenProvider.js.map +1 -1
- package/dist/authorization/provider/LocalByPassAuthProvider.d.ts +2 -2
- package/dist/authorization/provider/LocalByPassAuthProvider.js +1 -1
- package/dist/authorization/provider/OIDCAuthProvider.d.ts +2 -2
- package/dist/authorization/provider/OIDCAuthProvider.js +1 -1
- package/dist/authorization/rbac/RbacRulesLoader.js +1 -1
- package/dist/authorizer/RealTimeAuthorizer.d.ts +4 -4
- package/dist/authorizer/RealTimeAuthorizer.js +1 -1
- package/dist/authorizer/UnknownTokenOcpiAuthorizer.d.ts +18 -0
- package/dist/authorizer/UnknownTokenOcpiAuthorizer.js +107 -0
- package/dist/authorizer/UnknownTokenOcpiAuthorizer.js.map +1 -0
- package/dist/authorizer/index.d.ts +1 -0
- package/dist/authorizer/index.js +1 -0
- package/dist/authorizer/index.js.map +1 -1
- package/dist/cache/memory.d.ts +1 -1
- package/dist/cache/memory.js +11 -3
- package/dist/cache/memory.js.map +1 -1
- package/dist/cache/redis.d.ts +1 -1
- package/dist/cache/redis.js +16 -19
- package/dist/cache/redis.js.map +1 -1
- package/dist/certificate/CertificateAuthority.d.ts +2 -2
- package/dist/certificate/CertificateAuthority.js +1 -1
- package/dist/certificate/CertificateUtil.d.ts +1 -1
- package/dist/certificate/CertificateUtil.js +1 -1
- package/dist/certificate/client/acme.d.ts +1 -1
- package/dist/certificate/client/hubject.d.ts +1 -1
- package/dist/certificate/client/hubject.js +1 -1
- package/dist/files/ftpServer.d.ts +1 -1
- package/dist/files/gcpCloudStorage.d.ts +1 -1
- package/dist/files/localStorage.d.ts +1 -1
- package/dist/files/s3Storage.d.ts +1 -1
- package/dist/networkconnection/WebsocketNetworkConnection.d.ts +10 -1
- package/dist/networkconnection/WebsocketNetworkConnection.js +39 -7
- package/dist/networkconnection/WebsocketNetworkConnection.js.map +1 -1
- package/dist/networkconnection/authenticator/Authenticator.d.ts +1 -1
- package/dist/networkconnection/authenticator/AuthenticatorFilter.d.ts +1 -1
- package/dist/networkconnection/authenticator/BasicAuthenticationFilter.d.ts +2 -2
- package/dist/networkconnection/authenticator/BasicAuthenticationFilter.js +2 -2
- package/dist/networkconnection/authenticator/ConnectedStationFilter.d.ts +1 -1
- package/dist/networkconnection/authenticator/ConnectedStationFilter.js +1 -1
- package/dist/networkconnection/authenticator/NetworkProfileFilter.d.ts +2 -2
- package/dist/networkconnection/authenticator/NetworkProfileFilter.js +2 -2
- package/dist/networkconnection/authenticator/UnknownStationFilter.d.ts +2 -2
- package/dist/queue/kafka/receiver.d.ts +2 -2
- package/dist/queue/kafka/receiver.js +1 -1
- package/dist/queue/kafka/sender.d.ts +2 -2
- package/dist/queue/kafka/sender.js +1 -1
- package/dist/queue/rabbit-mq/receiver.d.ts +44 -2
- package/dist/queue/rabbit-mq/receiver.js +202 -27
- package/dist/queue/rabbit-mq/receiver.js.map +1 -1
- package/dist/queue/rabbit-mq/sender.d.ts +17 -3
- package/dist/queue/rabbit-mq/sender.js +32 -6
- package/dist/queue/rabbit-mq/sender.js.map +1 -1
- package/dist/security/SignedMeterValuesUtil.d.ts +2 -2
- package/dist/security/SignedMeterValuesUtil.js +2 -2
- package/dist/util/idGenerator.d.ts +2 -2
- package/dist/util/parser.d.ts +1 -1
- package/dist/util/swagger.d.ts +1 -1
- package/dist/util/swagger.js +1 -1
- package/dist/util/validator.d.ts +2 -2
- package/dist/util/validator.js +2 -2
- package/package.json +8 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FastifyPluginAsync, FastifyReply } from 'fastify';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
|
-
import type { IApiAuthProvider, UserInfo } from '@citrineos
|
|
4
|
+
import type { IApiAuthProvider, UserInfo } from '@zetra/citrineos-base';
|
|
5
5
|
/**
|
|
6
6
|
* Options for the authentication plugin
|
|
7
7
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import { Logger } from 'tslog';
|
|
5
5
|
import fp from 'fastify-plugin';
|
|
6
|
-
import { HttpStatus } from '@citrineos
|
|
6
|
+
import { HttpStatus } from '@zetra/citrineos-base';
|
|
7
7
|
/**
|
|
8
8
|
* Authentication plugin for Fastify
|
|
9
9
|
* This plugin adds authentication and authorization capabilities to Fastify
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface OidcTokenProviderConfig {
|
|
4
|
-
tokenUrl: string;
|
|
5
|
-
clientId: string;
|
|
6
|
-
clientSecret: string;
|
|
7
|
-
audience: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class OidcTokenProvider {
|
|
10
|
-
private config;
|
|
11
|
-
private oidcToken?;
|
|
12
|
-
private readonly _logger;
|
|
13
|
-
constructor(config: OidcTokenProviderConfig, logger?: Logger<ILogObj>);
|
|
14
|
-
getToken(): Promise<string>;
|
|
15
|
-
}
|
|
1
|
+
export { OidcTokenProvider } from '@zetra/citrineos-base';
|
|
2
|
+
export type { OidcTokenProviderConfig } from '@zetra/citrineos-base';
|
|
@@ -1,47 +1,8 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
_logger;
|
|
9
|
-
constructor(config, logger) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
this._logger = logger
|
|
12
|
-
? logger.getSubLogger({ name: this.constructor.name })
|
|
13
|
-
: new Logger({ name: this.constructor.name });
|
|
14
|
-
}
|
|
15
|
-
async getToken() {
|
|
16
|
-
if (this.oidcToken && this.oidcToken.expiresAt > Date.now()) {
|
|
17
|
-
this._logger.debug('Returning cached OIDC token');
|
|
18
|
-
return this.oidcToken.accessToken;
|
|
19
|
-
}
|
|
20
|
-
this._logger.debug('Fetching new OIDC token');
|
|
21
|
-
const response = await fetch(this.config.tokenUrl, {
|
|
22
|
-
method: 'POST',
|
|
23
|
-
headers: {
|
|
24
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
25
|
-
},
|
|
26
|
-
body: new URLSearchParams({
|
|
27
|
-
grant_type: 'client_credentials',
|
|
28
|
-
client_id: this.config.clientId,
|
|
29
|
-
client_secret: this.config.clientSecret,
|
|
30
|
-
audience: this.config.audience,
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
const errorText = await response.text();
|
|
35
|
-
this._logger.error('Failed to fetch OIDC token:', errorText);
|
|
36
|
-
throw new Error(`Failed to fetch OIDC token: ${response.statusText}`);
|
|
37
|
-
}
|
|
38
|
-
const tokenData = await response.json();
|
|
39
|
-
this.oidcToken = {
|
|
40
|
-
accessToken: tokenData.access_token,
|
|
41
|
-
// Set expiry to 1 minute before actual expiration to be safe
|
|
42
|
-
expiresAt: Date.now() + (tokenData.expires_in - 60) * 1000,
|
|
43
|
-
};
|
|
44
|
-
return this.oidcToken.accessToken;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
4
|
+
// The OidcTokenProvider now lives in @zetra/citrineos-base so that base-level modules
|
|
5
|
+
// (e.g. AbstractModule message API callbacks) can authenticate callbacks as well.
|
|
6
|
+
// Re-exported here to preserve existing import paths.
|
|
7
|
+
export { OidcTokenProvider } from '@zetra/citrineos-base';
|
|
47
8
|
//# sourceMappingURL=OidcTokenProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcTokenProvider.js","sourceRoot":"","sources":["../../src/authorization/OidcTokenProvider.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;
|
|
1
|
+
{"version":3,"file":"OidcTokenProvider.js","sourceRoot":"","sources":["../../src/authorization/OidcTokenProvider.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AAEtC,gFAAgF;AAChF,kFAAkF;AAClF,sDAAsD;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FastifyRequest } from 'fastify';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
|
-
import type { IApiAuthProvider, UserInfo } from '@citrineos
|
|
5
|
-
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@citrineos
|
|
4
|
+
import type { IApiAuthProvider, UserInfo } from '@zetra/citrineos-base';
|
|
5
|
+
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@zetra/citrineos-base';
|
|
6
6
|
/**
|
|
7
7
|
* A local bypass authentication provider that doesn't perform actual authentication
|
|
8
8
|
* Only for development and testing environments
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import { Logger } from 'tslog';
|
|
5
|
-
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@citrineos
|
|
5
|
+
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@zetra/citrineos-base';
|
|
6
6
|
/**
|
|
7
7
|
* A local bypass authentication provider that doesn't perform actual authentication
|
|
8
8
|
* Only for development and testing environments
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FastifyRequest } from 'fastify';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
|
-
import type { IApiAuthProvider, UserInfo } from '@citrineos
|
|
5
|
-
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@citrineos
|
|
4
|
+
import type { IApiAuthProvider, UserInfo } from '@zetra/citrineos-base';
|
|
5
|
+
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@zetra/citrineos-base';
|
|
6
6
|
export interface OIDCConfig {
|
|
7
7
|
jwksUri: string;
|
|
8
8
|
issuer: string;
|
|
@@ -5,7 +5,7 @@ import { Logger } from 'tslog';
|
|
|
5
5
|
import jwt from 'jsonwebtoken';
|
|
6
6
|
import jwksClient from 'jwks-rsa';
|
|
7
7
|
import JwksRsa from 'jwks-rsa';
|
|
8
|
-
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@citrineos
|
|
8
|
+
import { ApiAuthenticationResult, ApiAuthorizationResult } from '@zetra/citrineos-base';
|
|
9
9
|
import { createPublicKey } from 'crypto';
|
|
10
10
|
import { RbacRulesLoader } from '../rbac/RbacRulesLoader.js';
|
|
11
11
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import { Logger } from 'tslog';
|
|
6
|
-
import { RbacRulesSchema } from '@citrineos
|
|
6
|
+
import { RbacRulesSchema } from '@zetra/citrineos-base';
|
|
7
7
|
import { UrlMatcher } from './UrlMatcher.js';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AuthorizationStatusEnumType, type ConnectorDto, type EvseDto, type IAuthorizer, type IdTokenEnumType, type IMessageContext, type SystemConfig } from '@citrineos
|
|
2
|
-
import type { Authorization, ILocationRepository } from '@citrineos
|
|
1
|
+
import { type AuthorizationStatusEnumType, type ConnectorDto, type EvseDto, type IAuthorizer, type IdTokenEnumType, type IMessageContext, type SystemConfig } from '@zetra/citrineos-base';
|
|
2
|
+
import type { Authorization, ILocationRepository } from '@zetra/citrineos-data';
|
|
3
3
|
import type { ILogObj } from 'tslog';
|
|
4
4
|
import { Logger } from 'tslog';
|
|
5
5
|
export interface RealTimeAuthorizationRequestBody {
|
|
@@ -8,8 +8,8 @@ export interface RealTimeAuthorizationRequestBody {
|
|
|
8
8
|
idTokenType: IdTokenEnumType;
|
|
9
9
|
locationId?: string;
|
|
10
10
|
stationId: string;
|
|
11
|
-
evseId
|
|
12
|
-
connectorId
|
|
11
|
+
evseId?: number;
|
|
12
|
+
connectorId?: number;
|
|
13
13
|
}
|
|
14
14
|
export interface RealTimeAuthorizationResponse {
|
|
15
15
|
timestamp: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { AuthorizationStatusEnum, AuthorizationWhitelistEnum, } from '@citrineos
|
|
4
|
+
import { AuthorizationStatusEnum, AuthorizationWhitelistEnum, } from '@zetra/citrineos-base';
|
|
5
5
|
import { Logger } from 'tslog';
|
|
6
6
|
import { OidcTokenProvider } from '../authorization/index.js';
|
|
7
7
|
export class RealTimeAuthorizer {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AuthorizationStatusEnumType, type IdTokenEnumType, type IMessageContext, type SystemConfig } from '@zetra/citrineos-base';
|
|
2
|
+
import type { ILocationRepository, ITenantPartnerRepository } from '@zetra/citrineos-data';
|
|
3
|
+
import type { ILogObj } from 'tslog';
|
|
4
|
+
import { Logger } from 'tslog';
|
|
5
|
+
/**
|
|
6
|
+
* Delegates real-time authorization of unknown tokens to the OCPI module's
|
|
7
|
+
* `/realTimeAuth` endpoint, which performs the OCPI `POST /authorize` against the eMSP.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UnknownTokenOcpiAuthorizer {
|
|
10
|
+
private readonly _locationRepository;
|
|
11
|
+
private readonly _tenantPartnerRepository;
|
|
12
|
+
private readonly _config;
|
|
13
|
+
private readonly _logger;
|
|
14
|
+
private readonly _oidcTokenProvider?;
|
|
15
|
+
constructor(locationRepository: ILocationRepository, tenantPartnerRepository: ITenantPartnerRepository, config: SystemConfig, logger?: Logger<ILogObj>);
|
|
16
|
+
authorize(idToken: string, idTokenType: IdTokenEnumType, context: IMessageContext): Promise<AuthorizationStatusEnumType>;
|
|
17
|
+
private _buildRealTimeAuthUrl;
|
|
18
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { AuthorizationStatusEnum, } from '@zetra/citrineos-base';
|
|
5
|
+
import { Logger } from 'tslog';
|
|
6
|
+
import { OidcTokenProvider } from '../authorization/index.js';
|
|
7
|
+
// The hub TenantPartner that unknown tokens are delegated to for real-time authorization.
|
|
8
|
+
// Warning : As of now, only one hub partner is supported. In case of several partners, need for a rework to send authorization to all partners.
|
|
9
|
+
const HUB_PARTNER_COUNTRY_CODE = 'FR';
|
|
10
|
+
const HUB_PARTNER_PARTY_IDS = ['007', '107'];
|
|
11
|
+
/**
|
|
12
|
+
* Delegates real-time authorization of unknown tokens to the OCPI module's
|
|
13
|
+
* `/realTimeAuth` endpoint, which performs the OCPI `POST /authorize` against the eMSP.
|
|
14
|
+
*/
|
|
15
|
+
export class UnknownTokenOcpiAuthorizer {
|
|
16
|
+
_locationRepository;
|
|
17
|
+
_tenantPartnerRepository;
|
|
18
|
+
_config;
|
|
19
|
+
_logger;
|
|
20
|
+
_oidcTokenProvider;
|
|
21
|
+
constructor(locationRepository, tenantPartnerRepository, config, logger) {
|
|
22
|
+
this._locationRepository = locationRepository;
|
|
23
|
+
this._tenantPartnerRepository = tenantPartnerRepository;
|
|
24
|
+
this._config = config;
|
|
25
|
+
this._logger = logger
|
|
26
|
+
? logger.getSubLogger({ name: this.constructor.name })
|
|
27
|
+
: new Logger({ name: this.constructor.name });
|
|
28
|
+
if (config.oidcClient) {
|
|
29
|
+
this._oidcTokenProvider = new OidcTokenProvider(config.oidcClient, this._logger);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async authorize(idToken, idTokenType, context) {
|
|
33
|
+
const hubPartner = await this._tenantPartnerRepository.getHubPartner(context.tenantId, HUB_PARTNER_COUNTRY_CODE, HUB_PARTNER_PARTY_IDS);
|
|
34
|
+
if (!hubPartner?.id) {
|
|
35
|
+
this._logger.debug(`No hub TenantPartner found for tenant ${context.tenantId} (${HUB_PARTNER_COUNTRY_CODE} ${HUB_PARTNER_PARTY_IDS.join('/')}); cannot delegate real-time authorization`);
|
|
36
|
+
return AuthorizationStatusEnum.Unknown;
|
|
37
|
+
}
|
|
38
|
+
const chargingStation = await this._locationRepository.readChargingStationByStationId(context.tenantId, context.stationId);
|
|
39
|
+
const payload = {
|
|
40
|
+
tenantPartnerId: hubPartner.id,
|
|
41
|
+
idToken,
|
|
42
|
+
idTokenType,
|
|
43
|
+
locationId: chargingStation?.locationId?.toString(),
|
|
44
|
+
stationId: context.stationId,
|
|
45
|
+
};
|
|
46
|
+
const url = this._buildRealTimeAuthUrl();
|
|
47
|
+
this._logger.debug(`Delegating unknown-token real-time authorization for partner ${hubPartner.id} to ${url}`);
|
|
48
|
+
try {
|
|
49
|
+
const headers = {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
};
|
|
52
|
+
// The OCPI `/realTimeAuth` endpoint is an admin endpoint. When citrineos-ocpi is
|
|
53
|
+
// configured with OIDC, it expects a Bearer JWT (client-credentials); otherwise we
|
|
54
|
+
// fall back to the legacy `Token <adminToken>` scheme.
|
|
55
|
+
if (this._oidcTokenProvider) {
|
|
56
|
+
try {
|
|
57
|
+
const token = await this._oidcTokenProvider.getToken();
|
|
58
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
this._logger.error('Failed to get OIDC token for real-time authorization:', error);
|
|
62
|
+
return AuthorizationStatusEnum.Unknown;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (this._config.ocpiServer.adminToken) {
|
|
66
|
+
headers['Authorization'] = `Token ${this._config.ocpiServer.adminToken}`;
|
|
67
|
+
}
|
|
68
|
+
const response = await fetch(url, {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
headers,
|
|
71
|
+
body: JSON.stringify(payload),
|
|
72
|
+
});
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
const responseBody = await response.text();
|
|
75
|
+
this._logger.error(`Real-time authorization request to ${url} failed: HTTP ${response.status} ${responseBody}`);
|
|
76
|
+
return AuthorizationStatusEnum.Unknown;
|
|
77
|
+
}
|
|
78
|
+
const responseJson = (await response.json());
|
|
79
|
+
this._logger.debug(`Real-time auth response: ${responseJson?.data?.allowed}`);
|
|
80
|
+
switch (responseJson?.data?.allowed) {
|
|
81
|
+
case 'ALLOWED':
|
|
82
|
+
return AuthorizationStatusEnum.Accepted;
|
|
83
|
+
case 'BLOCKED':
|
|
84
|
+
return AuthorizationStatusEnum.Blocked;
|
|
85
|
+
case 'EXPIRED':
|
|
86
|
+
return AuthorizationStatusEnum.Expired;
|
|
87
|
+
case 'NO_CREDIT':
|
|
88
|
+
return AuthorizationStatusEnum.NoCredit;
|
|
89
|
+
case 'NOT_ALLOWED':
|
|
90
|
+
return AuthorizationStatusEnum.NotAtThisLocation;
|
|
91
|
+
default:
|
|
92
|
+
return AuthorizationStatusEnum.Unknown;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
this._logger.error(`Real-time authorization for unknown token failed: ${error}`);
|
|
97
|
+
return AuthorizationStatusEnum.Unknown;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_buildRealTimeAuthUrl() {
|
|
101
|
+
const { host, port, version } = this._config.ocpiServer;
|
|
102
|
+
// Mirrors the citrineos-ocpi route: global '/ocpi' prefix + Tokens controller
|
|
103
|
+
// base '/:role(cpo|emsp)/:versionId/tokens' + the '/realTimeAuth' admin endpoint.
|
|
104
|
+
return `http://${host}:${port}/ocpi/emsp/${version}/tokens/realTimeAuth`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=UnknownTokenOcpiAuthorizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownTokenOcpiAuthorizer.js","sourceRoot":"","sources":["../../src/authorizer/UnknownTokenOcpiAuthorizer.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AACtC,OAAO,EACL,uBAAuB,GAKxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAM9D,0FAA0F;AAC1F,gJAAgJ;AAChJ,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IACpB,mBAAmB,CAAsB;IACzC,wBAAwB,CAA2B;IACnD,OAAO,CAAe;IACtB,OAAO,CAAkB;IACzB,kBAAkB,CAAqB;IAExD,YACE,kBAAuC,EACvC,uBAAiD,EACjD,MAAoB,EACpB,MAAwB;QAExB,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAC9C,IAAI,CAAC,wBAAwB,GAAG,uBAAuB,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM;YACnB,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YACtD,CAAC,CAAC,IAAI,MAAM,CAAU,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,MAAM,CAAC,UAAU,EAAE,CAA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AC1C,KAAK,SAAS;oBACZ,OAAO,uBAAuB,CAAC,OAAO,CAAC;gBACzC,KAAK,SAAS;oBACZ,OAAO,uBAAuB,CAAC,OAAO,CAAC;gBACzC,KAAK,WAAW;oBACd,OAAO,uBAAuB,CAAC,QAAQ,CAAC;gBAC1C,KAAK,aAAa;oBAChB,OAAO,uBAAuB,CAAC,iBAAiB,CAAC;gBACnD;oBACE,OAAO,uBAAuB,CAAC,OAAO,CAAC;YAC3C,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,qDAAqD,KAAK,EAAE,CAAC,CAAC;YACjF,OAAO,uBAAuB,CAAC,OAAO,CAAC;QACzC,CAAC;IACH,CAAC;IAEO,qBAAqB;QAC3B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACxD,8EAA8E;QAC9E,kFAAkF;QAClF,OAAO,UAAU,IAAI,IAAI,IAAI,cAAc,OAAO,sBAAsB,CAAC;IAC3E,CAAC;CACF"}
|
package/dist/authorizer/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorizer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AACtC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorizer/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC"}
|
package/dist/cache/memory.d.ts
CHANGED
package/dist/cache/memory.js
CHANGED
|
@@ -52,7 +52,15 @@ export class MemoryCache {
|
|
|
52
52
|
async remove(key, namespace) {
|
|
53
53
|
namespace = namespace || 'default';
|
|
54
54
|
const namespaceKey = `${namespace}:${key}`;
|
|
55
|
-
|
|
55
|
+
if (this._timeoutMap.has(namespaceKey)) {
|
|
56
|
+
clearTimeout(this._timeoutMap.get(namespaceKey));
|
|
57
|
+
this._timeoutMap.delete(namespaceKey);
|
|
58
|
+
}
|
|
59
|
+
const deleted = this._cache.delete(namespaceKey);
|
|
60
|
+
if (deleted) {
|
|
61
|
+
this.resolveOnChange(namespaceKey, null);
|
|
62
|
+
}
|
|
63
|
+
return deleted;
|
|
56
64
|
}
|
|
57
65
|
onChange(key, waitSeconds, namespace, classConstructor) {
|
|
58
66
|
namespace = namespace || 'default';
|
|
@@ -113,7 +121,7 @@ export class MemoryCache {
|
|
|
113
121
|
}
|
|
114
122
|
if (expireSeconds) {
|
|
115
123
|
this._timeoutMap.set(namespaceKey, setTimeout(() => {
|
|
116
|
-
this.
|
|
124
|
+
void this.remove(key, namespace);
|
|
117
125
|
}, expireSeconds * 1000));
|
|
118
126
|
}
|
|
119
127
|
this.resolveOnChange(namespaceKey, value);
|
|
@@ -131,7 +139,7 @@ export class MemoryCache {
|
|
|
131
139
|
}
|
|
132
140
|
if (expireSeconds) {
|
|
133
141
|
this._timeoutMap.set(namespaceKey, setTimeout(() => {
|
|
134
|
-
this.
|
|
142
|
+
void this.remove(key, namespace);
|
|
135
143
|
}, expireSeconds * 1000));
|
|
136
144
|
}
|
|
137
145
|
this.resolveOnChange(namespaceKey, value);
|
package/dist/cache/memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/cache/memory.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AAItC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAsB;IAC5B,mBAAmB,CAA4C;IAC/D,0BAA0B,CAAsC;IAChE,WAAW,CAA8B;IAEjD;QACE,MAAM,kBAAkB,GAA8C,IAAI,G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YAClC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,WAAW,CAAC,GAAG,CAClB,YAAY,EACZ,UAAU,CAAC,GAAG,EAAE;gBACd,KAAK,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACnC,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC,CACzB,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,eAAe,CAAC,YAAoB,EAAE,KAAoB;QAChE,MAAM,uBAAuB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC3E,IAAI,uBAAuB,EAAE,CAAC;YAC5B,uBAAuB,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
|
package/dist/cache/redis.d.ts
CHANGED
package/dist/cache/redis.js
CHANGED
|
@@ -37,28 +37,30 @@ export class RedisCache {
|
|
|
37
37
|
return new Promise((resolve) => {
|
|
38
38
|
// Create a Redis subscriber to listen for operations affecting the key
|
|
39
39
|
const subscriber = createClient();
|
|
40
|
+
let closed = false;
|
|
41
|
+
// Cancel the fallback timer and close the subscriber, exactly once
|
|
42
|
+
const cleanup = () => {
|
|
43
|
+
if (closed)
|
|
44
|
+
return;
|
|
45
|
+
closed = true;
|
|
46
|
+
if (timer)
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
subscriber.quit().catch((error) => {
|
|
49
|
+
console.log('Error quitting subscriber', error);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
40
52
|
// Channel: Key-space, message: the name of the event, which is the command executed on the key
|
|
41
53
|
subscriber
|
|
42
54
|
.subscribe(`__keyspace@0__:${key}`, (channel, message) => {
|
|
43
55
|
switch (message) {
|
|
44
56
|
case 'set':
|
|
45
57
|
resolve(this.get(key, namespace, classConstructor));
|
|
46
|
-
|
|
47
|
-
.quit()
|
|
48
|
-
.then()
|
|
49
|
-
.catch((error) => {
|
|
50
|
-
console.log('Error quitting subscriber', error);
|
|
51
|
-
});
|
|
58
|
+
cleanup();
|
|
52
59
|
break;
|
|
53
60
|
case 'del':
|
|
54
61
|
case 'expire':
|
|
55
62
|
resolve(null);
|
|
56
|
-
|
|
57
|
-
.quit()
|
|
58
|
-
.then()
|
|
59
|
-
.catch((error) => {
|
|
60
|
-
console.log('Error quitting subscriber', error);
|
|
61
|
-
});
|
|
63
|
+
cleanup();
|
|
62
64
|
break;
|
|
63
65
|
default:
|
|
64
66
|
// Do nothing
|
|
@@ -69,14 +71,9 @@ export class RedisCache {
|
|
|
69
71
|
.catch((error) => {
|
|
70
72
|
console.log('Error creating Redis subscriber', error);
|
|
71
73
|
});
|
|
72
|
-
setTimeout(() => {
|
|
74
|
+
const timer = setTimeout(() => {
|
|
73
75
|
resolve(this.get(key, namespace, classConstructor));
|
|
74
|
-
|
|
75
|
-
.quit()
|
|
76
|
-
.then()
|
|
77
|
-
.catch((error) => {
|
|
78
|
-
console.log('Error closing Redis subscriber', error);
|
|
79
|
-
});
|
|
76
|
+
cleanup();
|
|
80
77
|
}, waitSeconds * 1000);
|
|
81
78
|
});
|
|
82
79
|
}
|
package/dist/cache/redis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis.js","sourceRoot":"","sources":["../../src/cache/redis.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,sCAAsC;AAItC,OAAO,EAAE,eAAe,EAAE,MAA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AC;QACnC,GAAG,GAAG,GAAG,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO;aAChB,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;aAC/E,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,KAAK,IAAI,CAAC;YACzB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ICache, SystemConfig } from '@citrineos
|
|
2
|
-
import { OCPP2_0_1 } from '@citrineos
|
|
1
|
+
import type { ICache, SystemConfig } from '@zetra/citrineos-base';
|
|
2
|
+
import { OCPP2_0_1 } from '@zetra/citrineos-base';
|
|
3
3
|
import type { IChargingStationCertificateAuthorityClient, IV2GCertificateAuthorityClient } from './client/interface.js';
|
|
4
4
|
import type { ILogObj } from 'tslog';
|
|
5
5
|
import { Logger } from 'tslog';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pkijs from 'pkijs';
|
|
2
2
|
import { CertificationRequest } from 'pkijs';
|
|
3
|
-
import { Certificate, CountryNameEnumType, SignatureAlgorithmEnumType } from '@citrineos
|
|
3
|
+
import { Certificate, CountryNameEnumType, SignatureAlgorithmEnumType } from '@zetra/citrineos-data';
|
|
4
4
|
import jsrsasign from 'jsrsasign';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
import type { ILogObj } from 'tslog';
|
|
@@ -5,7 +5,7 @@ import * as pkijs from 'pkijs';
|
|
|
5
5
|
import { CertificationRequest } from 'pkijs';
|
|
6
6
|
import * as asn1js from 'asn1js';
|
|
7
7
|
import { fromBER } from 'asn1js';
|
|
8
|
-
import { Certificate, CountryNameEnumType, SignatureAlgorithmEnumType } from '@citrineos
|
|
8
|
+
import { Certificate, CountryNameEnumType, SignatureAlgorithmEnumType } from '@zetra/citrineos-data';
|
|
9
9
|
import jsrsasign from 'jsrsasign';
|
|
10
10
|
import { fromBase64, stringToArrayBuffer } from 'pvutils';
|
|
11
11
|
import moment from 'moment';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IChargingStationCertificateAuthorityClient } from './interface.js';
|
|
2
|
-
import type { SystemConfig } from '@citrineos
|
|
2
|
+
import type { SystemConfig } from '@zetra/citrineos-base';
|
|
3
3
|
import { Client } from 'acme-client';
|
|
4
4
|
import type { ILogObj } from 'tslog';
|
|
5
5
|
import { Logger } from 'tslog';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IV2GCertificateAuthorityClient } from './interface.js';
|
|
2
|
-
import { type ICache, type SystemConfig } from '@citrineos
|
|
2
|
+
import { type ICache, type SystemConfig } from '@zetra/citrineos-base';
|
|
3
3
|
import type { ILogObj } from 'tslog';
|
|
4
4
|
import { Logger } from 'tslog';
|
|
5
5
|
export declare class Hubject implements IV2GCertificateAuthorityClient {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { HttpMethod, HttpStatus, HUBJECT_DEFAULT_AUTH_TOKEN, HUBJECT_DEFAULT_BASEURL, HUBJECT_DEFAULT_CLIENTID, HUBJECT_DEFAULT_CLIENTSECRET, HUBJECT_DEFAULT_TOKENURL, } from '@citrineos
|
|
4
|
+
import { HttpMethod, HttpStatus, HUBJECT_DEFAULT_AUTH_TOKEN, HUBJECT_DEFAULT_BASEURL, HUBJECT_DEFAULT_CLIENTID, HUBJECT_DEFAULT_CLIENTSECRET, HUBJECT_DEFAULT_TOKENURL, } from '@zetra/citrineos-base';
|
|
5
5
|
import { Logger } from 'tslog';
|
|
6
6
|
import { createPemBlock } from '../CertificateUtil.js';
|
|
7
7
|
export class Hubject {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BootstrapConfig, ConfigStore, SystemConfig } from '@citrineos
|
|
1
|
+
import type { BootstrapConfig, ConfigStore, SystemConfig } from '@zetra/citrineos-base';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
4
|
export declare class GcpCloudStorage implements ConfigStore {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigStore, SystemConfig } from '@citrineos
|
|
1
|
+
import type { ConfigStore, SystemConfig } from '@zetra/citrineos-base';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
4
|
export declare class LocalStorage implements ConfigStore {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BootstrapConfig, ConfigStore, SystemConfig } from '@citrineos
|
|
1
|
+
import type { BootstrapConfig, ConfigStore, SystemConfig } from '@zetra/citrineos-base';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
4
|
export declare class S3Storage implements ConfigStore {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { IAuthenticator, ICache, IMessageRouter, INetworkConnection, SystemConfig, WebsocketServerConfig } from '@citrineos
|
|
1
|
+
import type { IAuthenticator, ICache, IMessageRouter, INetworkConnection, SystemConfig, WebsocketServerConfig } from '@zetra/citrineos-base';
|
|
2
2
|
import type { ILogObj } from 'tslog';
|
|
3
3
|
import { Logger } from 'tslog';
|
|
4
4
|
export declare class WebsocketNetworkConnection implements INetworkConnection {
|
|
5
|
+
private static readonly CONNECTION_TTL_PING_INTERVAL_MULTIPLIER;
|
|
5
6
|
protected _cache: ICache;
|
|
6
7
|
protected _config: SystemConfig;
|
|
7
8
|
protected _logger: Logger<ILogObj>;
|
|
@@ -22,6 +23,14 @@ export declare class WebsocketNetworkConnection implements INetworkConnection {
|
|
|
22
23
|
bindNetworkHook(): (identifier: string, message: string) => Promise<void>;
|
|
23
24
|
disconnect(tenantId: number, stationId: string): Promise<boolean>;
|
|
24
25
|
shutdown(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Closes every currently established websocket connection, waiting for each
|
|
28
|
+
* to complete its close handshake (up to `gracePeriodMs`) before terminating
|
|
29
|
+
* it, so the 'close' event handler runs and cleans up the cache/router state.
|
|
30
|
+
*
|
|
31
|
+
* @param {number} gracePeriodMs - Time to wait for a graceful close before forcing termination.
|
|
32
|
+
*/
|
|
33
|
+
private _closeActiveConnections;
|
|
25
34
|
/**
|
|
26
35
|
* Updates certificates for a specific server with the provided TLS key, certificate chain, and optional
|
|
27
36
|
* root CA.
|