Documentation
¶
Overview ¶
Package services defines pluggable services that are used to customize the processing of OCPP messages by the core handlers.
Index ¶
- Constants
- Variables
- func ParseCertificates(pemData []byte) ([]*x509.Certificate, error)
- type BasicKwhTariffService
- type CachingHttpTokenService
- type CachingRootCertificateProviderService
- type CcpResponse
- type CertificateType
- type CertificateValidationService
- type ChargeStationCertificateProvider
- type CompositeRootCertificateProviderService
- type ContractCertificateProvider
- type DefaultChargeStationCertificateProvider
- type DefaultContractCertificateProvider
- type DelegatingChargeStationCertificateProvider
- type EvCertificate15118Response
- type FileRootCertificateProviderService
- type FileSource
- type FixedHttpTokenService
- type GoogleSecretSource
- type HttpError
- type HttpTokenService
- type HubjectTestHttpTokenService
- type HubjectTestTokenResponse
- type ISOVersion
- type LocalChargeStationCertificateProvider
- type LocalSource
- type OAuth2HttpTokenService
- type OAuth2TokenRequest
- type OAuth2TokenResponse
- type OCSPError
- type OcppTokenAuthService
- type OnlineCertificateValidationService
- func (o *OnlineCertificateValidationService) ValidateHashedCertificateChain(ctx context.Context, ocspRequestData []ocpp201.OCSPRequestDataType) (*string, error)
- func (o *OnlineCertificateValidationService) ValidatePEMCertificateChain(ctx context.Context, pemChain []byte, eMAID string) (*string, error)
- type OpcpChargeStationCertificateProvider
- type OpcpContractCertificateProvider
- type OpcpRootCertificateCollectionType
- type OpcpRootCertificateProviderService
- type OpcpRootCertificateReturnType
- type OpcpRootCertificateType
- type RootCertificateProviderService
- type SignedContractDataRequest
- type SignedContractDataResponse
- type StringSource
- type TariffService
- type TokenAuthService
- type ValidationError
- type X509RootCertificateProviderService
Constants ¶
View Source
const XsdMsgDefinition = "urn:iso:15118:2:2013:MsgDef"
Variables ¶
View Source
var HubjectTestTokenRegexp = regexp.MustCompile(`Bearer (.+)\n`)
Functions ¶
func ParseCertificates ¶
func ParseCertificates(pemData []byte) ([]*x509.Certificate, error)
Types ¶
type BasicKwhTariffService ¶
type BasicKwhTariffService struct{}
func (BasicKwhTariffService) CalculateCost ¶
func (BasicKwhTariffService) CalculateCost(transaction *store.Transaction) (float64, error)
type CachingHttpTokenService ¶
func NewCachingHttpTokenService ¶
func NewCachingHttpTokenService(tokenService HttpTokenService, ttl time.Duration, clock clock.PassiveClock) *CachingHttpTokenService
type CachingRootCertificateProviderService ¶
type CachingRootCertificateProviderService struct { sync.Mutex // contains filtered or unexported fields }
func NewCachingRootCertificateProviderService ¶
func NewCachingRootCertificateProviderService(delegate RootCertificateProviderService, ttl time.Duration, clock clock.PassiveClock) *CachingRootCertificateProviderService
func (*CachingRootCertificateProviderService) ProvideCertificates ¶
func (c *CachingRootCertificateProviderService) ProvideCertificates(ctx context.Context) ([]*x509.Certificate, error)
type CcpResponse ¶
type CertificateType ¶
type CertificateType int
const ( CertificateTypeV2G CertificateType = iota CertificateTypeCSO )
type CompositeRootCertificateProviderService ¶
type CompositeRootCertificateProviderService struct {
Providers []RootCertificateProviderService
}
func (CompositeRootCertificateProviderService) ProvideCertificates ¶
func (c CompositeRootCertificateProviderService) ProvideCertificates(ctx context.Context) ([]*x509.Certificate, error)
type ContractCertificateProvider ¶
type ContractCertificateProvider interface {
ProvideCertificate(ctx context.Context, exiRequest string) (EvCertificate15118Response, error)
}
type DefaultChargeStationCertificateProvider ¶
type DefaultChargeStationCertificateProvider struct{}
func (DefaultChargeStationCertificateProvider) ProvideCertificate ¶
func (n DefaultChargeStationCertificateProvider) ProvideCertificate(context.Context, CertificateType, string, string) (pemEncodedCertificateChain string, err error)
type DefaultContractCertificateProvider ¶
type DefaultContractCertificateProvider struct{}
func (DefaultContractCertificateProvider) ProvideCertificate ¶
func (d DefaultContractCertificateProvider) ProvideCertificate(context.Context, string) (EvCertificate15118Response, error)
type DelegatingChargeStationCertificateProvider ¶
type DelegatingChargeStationCertificateProvider struct { V2GChargeStationCertificateProvider ChargeStationCertificateProvider CSOChargeStationCertificateProvider ChargeStationCertificateProvider }
func (*DelegatingChargeStationCertificateProvider) ProvideCertificate ¶
func (d *DelegatingChargeStationCertificateProvider) ProvideCertificate(ctx context.Context, typ CertificateType, pemEncodedCSR string, csId string) (pemEncodedCertificateChain string, err error)
type EvCertificate15118Response ¶
type EvCertificate15118Response struct { Status ocpp201.Iso15118EVCertificateStatusEnumType CertificateInstallationRes string }
type FileRootCertificateProviderService ¶
type FileRootCertificateProviderService struct {
FilePaths []string
}
func (FileRootCertificateProviderService) ProvideCertificates ¶
func (s FileRootCertificateProviderService) ProvideCertificates(context.Context) (certs []*x509.Certificate, err error)
type FileSource ¶
type FileSource struct {
FileName string
}
type FixedHttpTokenService ¶
type FixedHttpTokenService struct {
// contains filtered or unexported fields
}
func NewEnvHttpTokenService ¶
func NewEnvHttpTokenService(envVar string) (*FixedHttpTokenService, error)
func NewFixedHttpTokenService ¶
func NewFixedHttpTokenService(token string) *FixedHttpTokenService
type GoogleSecretSource ¶
type GoogleSecretSource struct {
SecretName string
}
type HttpTokenService ¶
type HubjectTestHttpTokenService ¶
type HubjectTestHttpTokenService struct {
// contains filtered or unexported fields
}
func NewHubjectTestHttpTokenService ¶
func NewHubjectTestHttpTokenService(url string, httpClient *http.Client) *HubjectTestHttpTokenService
type ISOVersion ¶
type ISOVersion string
const ( ISO15118V2 ISOVersion = "ISO15118-2" ISO15118V20 ISOVersion = "ISO15118-20" )
type LocalChargeStationCertificateProvider ¶
type LocalChargeStationCertificateProvider struct { Store store.CertificateStore CertificateReader LocalSource PrivateKeyReader LocalSource }
LocalChargeStationCertificateProvider issues CSO certificates using local data
func (*LocalChargeStationCertificateProvider) ProvideCertificate ¶
func (l *LocalChargeStationCertificateProvider) ProvideCertificate(ctx context.Context, typ CertificateType, pemEncodedCSR string, csId string) (pemEncodedCertificateChain string, err error)
type OAuth2HttpTokenService ¶
func NewOAuth2HttpTokenService ¶
func NewOAuth2HttpTokenService(url, clientId, clientSecret string, httpClient *http.Client, clk clock.PassiveClock) *OAuth2HttpTokenService
type OAuth2TokenRequest ¶
type OAuth2TokenResponse ¶
type OCSPError ¶
type OCSPError int
OCSPError is an error returned by the OCSP server in response to a check
type OcppTokenAuthService ¶
type OcppTokenAuthService struct { TokenStore store.TokenStore Clock clock.PassiveClock }
func (*OcppTokenAuthService) Authorize ¶
func (o *OcppTokenAuthService) Authorize(ctx context.Context, token ocpp201.IdTokenType) ocpp201.IdTokenInfoType
type OnlineCertificateValidationService ¶
type OnlineCertificateValidationService struct { RootCertificateProvider RootCertificateProviderService MaxOCSPAttempts int HttpClient *http.Client }
func (*OnlineCertificateValidationService) ValidateHashedCertificateChain ¶
func (o *OnlineCertificateValidationService) ValidateHashedCertificateChain(ctx context.Context, ocspRequestData []ocpp201.OCSPRequestDataType) (*string, error)
func (*OnlineCertificateValidationService) ValidatePEMCertificateChain ¶
type OpcpChargeStationCertificateProvider ¶
type OpcpChargeStationCertificateProvider struct { BaseURL string HttpTokenService HttpTokenService ISOVersion ISOVersion HttpClient *http.Client }
The OpcpChargeStationCertificateProvider issues certificates using the CPO CA
func (OpcpChargeStationCertificateProvider) ProvideCertificate ¶
func (h OpcpChargeStationCertificateProvider) ProvideCertificate(ctx context.Context, typ CertificateType, pemEncodedCSR string, csId string) (string, error)
type OpcpContractCertificateProvider ¶
type OpcpContractCertificateProvider struct { BaseURL string HttpTokenService HttpTokenService HttpClient *http.Client }
func (OpcpContractCertificateProvider) ProvideCertificate ¶
func (h OpcpContractCertificateProvider) ProvideCertificate(ctx context.Context, exiRequest string) (EvCertificate15118Response, error)
type OpcpRootCertificateCollectionType ¶
type OpcpRootCertificateCollectionType struct {
RootCertificates []OpcpRootCertificateType `json:"rootCertificates"`
}
type OpcpRootCertificateProviderService ¶
type OpcpRootCertificateProviderService struct { BaseURL string TokenService HttpTokenService HttpClient *http.Client }
func (OpcpRootCertificateProviderService) ProvideCertificates ¶
func (s OpcpRootCertificateProviderService) ProvideCertificates(ctx context.Context) (certs []*x509.Certificate, err error)
type OpcpRootCertificateReturnType ¶
type OpcpRootCertificateReturnType struct {
RootCertificateCollection OpcpRootCertificateCollectionType `json:"RootCertificateCollection"`
}
type OpcpRootCertificateType ¶
type OpcpRootCertificateType struct { RootCertificateId string `json:"rootCertificateId"` DN string `json:"distinguishedName"` CACertificate string `json:"caCertificate"` CommonName string `json:"commonName"` RootAuthorityKeyIdentifier string `json:"rootAuthorityKeyIdentifier"` RootIssuerSerialNumber string `json:"rootIssuerSerialNumber"` ValidFrom string `json:"validFrom"` ValidTo string `json:"validTo"` OrganizationName string `json:"organizationName"` CertificateRevocationList string `json:"certificateRevocationList"` CrossCertificatePair string `json:"crossCertificatePair"` LabeledURI string `json:"labeledUri"` RootType string `json:"rootType"` Fingerprint string `json:"fingerprint"` }
type RootCertificateProviderService ¶
type RootCertificateProviderService interface {
ProvideCertificates(ctx context.Context) ([]*x509.Certificate, error)
}
type SignedContractDataResponse ¶
type SignedContractDataResponse struct { CcpResponse CcpResponse `json:"CCPResponse"` XsdMsgDefNamespace string `json:"xsdMsgDefNamespace"` }
type StringSource ¶
type StringSource struct {
Data string
}
type TariffService ¶
type TariffService interface {
CalculateCost(transaction *store.Transaction) (float64, error)
}
type TokenAuthService ¶
type TokenAuthService interface {
Authorize(ctx context.Context, token ocpp201.IdTokenType) ocpp201.IdTokenInfoType
}
type ValidationError ¶
type ValidationError int
const ( ValidationErrorCertChain ValidationError = iota ValidationErrorCertExpired ValidationErrorCertRevoked ValidationErrorWrongEmaid )
func (ValidationError) Error ¶
func (v ValidationError) Error() string
type X509RootCertificateProviderService ¶
type X509RootCertificateProviderService struct {
Certificates []*x509.Certificate
}
func (X509RootCertificateProviderService) ProvideCertificates ¶
func (x X509RootCertificateProviderService) ProvideCertificates(ctx context.Context) ([]*x509.Certificate, error)
Click to show internal directories.
Click to hide internal directories.