Documentation
¶
Overview ¶
Package auth provides connection authentication for the CSMS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized indicates authentication failure.
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod string
AuthMethod identifies how a connection authenticated.
const ( AuthMethodNone AuthMethod = "none" AuthMethodBasic AuthMethod = "basic" AuthMethodMTLS AuthMethod = "mtls" AuthMethodToken AuthMethod = "token" )
type Authenticator ¶
Authenticator authenticates a charge point at WebSocket upgrade time. cpID is the charge point identifier parsed from the HTTP request path by the CSMS server.
func BasicAuth ¶
func BasicAuth(verify VerifyBasic) Authenticator
BasicAuth authenticates using HTTP Basic credentials (OCPP Security Profile 1/2). The verifier receives the charge point id parsed from the request path. If the returned identity leaves Credential empty, it is set to the HTTP Basic username.
func MTLSFromClientCert ¶
func MTLSFromClientCert(verify VerifyMTLS) Authenticator
MTLSFromClientCert authenticates using the presented TLS client certificate (OCPP Security Profile 3). The HTTP server must be configured with tls.RequireAndVerifyClientCert.
type Identity ¶
type Identity struct {
CPID string
Method AuthMethod
Credential string
Metadata map[string]string
}
Identity is the authenticated identity of a charge point connection.
type VerifyBasic ¶
VerifyBasic checks the parsed charge point id and password, returning the identity.
type VerifyMTLS ¶
type VerifyMTLS func(cpID string, cert *x509.Certificate) (Identity, error)
VerifyMTLS checks a client certificate and returns the identity.