rust_ocpp/v2_0_1/messages/
authorize.rs

1//! Authorize
2use crate::v2_0_1::datatypes::id_token_info_type::IdTokenInfoType;
3use validator::Validate;
4
5use crate::v2_0_1::datatypes::id_token_type::IdTokenType;
6use crate::v2_0_1::datatypes::ocsp_request_data_type::OCSPRequestDataType;
7use crate::v2_0_1::enumerations::authorize_certificate_status_enum_type::AuthorizeCertificateStatusEnumType;
8
9/// ´AuthorizeRequest`, sent by the Charging Station to the CSMS.
10#[derive(serde::Serialize, serde::Deserialize, Validate, Clone, Debug, PartialEq, Default)]
11#[serde(rename_all = "camelCase")]
12pub struct AuthorizeRequest {
13    /// The X.509 certificated presented by EV and encoded in PEM format.
14    #[validate(length(min = 0, max = 5500))]
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub certificate: Option<String>,
17    /// This contains the identifier that needs to be authorized.
18    pub id_token: IdTokenType,
19    /// Contains the information needed to verify the EV Contract Certificate via OCSP.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub iso_15118_certificate_hash_data: Option<Vec<OCSPRequestDataType>>,
22}
23
24/// `AuthorizeResponse`, sent by the
25/// CSMS to the Charging Station in response to an [`AuthorizeRequest`].
26#[derive(serde::Serialize, serde::Deserialize, Clone, Debug, PartialEq, Default)]
27#[serde(rename_all = "camelCase")]
28pub struct AuthorizeResponse {
29    /// Certificate status information. - if all certificates are valid: return
30    /// `Accepted`. - if one of the certificates was revoked, return `CertificateRevoked`.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub certificate_status: Option<AuthorizeCertificateStatusEnumType>,
33    /// Contains information about authorization status, expiry and group id.
34    pub id_token_info: IdTokenInfoType,
35}