This document, the Gen2 core specification, describes the Gen2 messaging layer. The companion specifications for the Gen2 transport protocols detail the mapping of the messaging layer to selected transports. The ontologies based on the Gen2 core specification are defined in documents for each specific domain (e.g. navigation, media, vehicle data).

Introduction

This document describes the messaging API for Gen2 protocol. This includes the messaging layer and set of rules for structuring data. The separation between payload encoding (transport) and messaging API (core) improves adaptability. Extending and describing multiple transport protocols becomes possible.

The messages are exchanged between a service implementation holding the representation of data and a client using the data. A service is an entity that manages and offers access to data. A client is an entity that works with data managed by a service.

The Gen2 messaging layer uses a RESTful design for all methods exchanged via the interface ().

The Gen2 data structuring rules (VSS Rule set) are the same through all transport protocols. The basis for structuring data hold by a service is a tree.

Terminology

The acronym 'Gen2' is used to refer to this document, the second generation specification. The acronym 'VSS' is used to refer to the 'Vehicle Signal Specification' which is defined by the GENIVI Alliance. The term 'WebSocket' when used in this document, is as defined in the W3C WebSocket API and the WebSocket Protocol.

Data model

The service is intended for use with a tree-like logical taxonomy to represent the vehicle data. An illustrative example of such a tree structure is shown in Figure 1. While it is meant to support conforming taxonomies it was created principally with the Vehicle Signal Specification (VSS) in mind. For more details, see the VSS documentation.

Diagram showing an example VSS 2.0 tree.
VSS does not have a "domain root node" for the vehicle signal domain, like the Car node in Fig 1. To be introduced in VSS, or removed from here?

Addressing

Addressing of elements is done using URIs as defined in [[RFC3986]].

scheme:authority/path?query

The scheme describes the protocol to use to reach the addressed element.

The authority describes where to reach the service holding and managing the data representation. Scheme and authority are defined within the protocol adaptation.

The path consists of the slash delimited node names of the nodes traversed from the tree root to the tree leaf representing the service. E. g. the path expression from traversing the nodes Vehicle, Car, Engine, RPM would be "Vehicle/Car/Engine/RPM".

The query contains further information related to the request, see .

VSS 2.0 should use slash as delimiter. If not, this difference should be pointed out here.

Service discovery

The purpose of the data model is to provide a client with a description of the data that enables the client to make a request for desired vehicle data, and interpret the response. In order to obtain that description, the client MAY request that the server returns the VSS tree content, i. e. the metadata describing the accessible vehicle data. The client is able to request metadata from any point in the signal tree, such that only the metadata for the nodes within the given branch of the tree is returned. For example, only metadata for the chassis branch of the VSS tree is returned when the chassis path is specified. If the path is set to the VSS root, the response contains the metadata for the entire tree. If the server is able to satisfy the request it SHALL return a Response message. If an error occurs the server SHALL return an ErrorResponse message.
A service discovery request has the format of a read, where the path is appended with a query component, see for the details.
The key data components of these messagess are defined below:

Dynamic registry

To enable e. g. after-market services it SHALL be possible to dynamically add new branches to the VSS tree, and if requested also to delete them at a later point.
Requests of this type are not expected to be frequent for the type of data that is represented in the "vehicle signal domain", which is the current scope of VSS. These requests are therefore partitioned in a separate API, which is described in "Appendix: Dynamic registry API".

Filtering

Filtering is a mechanism to refine a client request, in order to more precisely control the data in a response. Filtering can be applied in read requests and in subscribe requests.For read requests the filter expression MUST be appended to the request path in the form of a query component following the description in [[RFC3986]]. For subscribe requests the filter expression MUST be carried in the request payload. The filter expression follows the same general rules in both request cases. The query component must have the following structure
reserved-word comparison-operator expression
where
- reserved-word must have the dollar-sign as the first character ($). The availabe reserved words are described in the chapters below.
- comparison-operator is one of either the equal sign (EQ), the greater than sign (GT), or the less than sign (LT).
- expression is a character string with its interpretation given by the preceeding reserved-word and comparison operator.

Filter expressions can consist of multiple query expressions, as described in .

As filtering is implemented on the server side, in vehicles, the filtering complexity is intentionally kept to a low level in order to not load the processing resources too much.

Read filtering

The available read filtering options are presented in the following chapters, and are only applicable to read requests. As described in [[RFC3986]], a question mark must be inserted as a delimiter between the path and the query components.

Service discovery filter

The service discovery query has the structure
$spec EQ depth
where
- $spec is the reserved word for service discovery filtering.
- the equal sign (EQ) is the only allowed comparison operator for service discovery filtering.
- depth sets the maximum branch depth that is returned in the response, counted from the root node given by the path component in the request. Depth MUST be a positive integer. If set to zero, it is replaced by the max depth of the subtree.

Search filter

If the path in a read request does not terminate in a leaf node, then the response will contain values from all leaf nodes in the subtree given by the path. The search filter makes it possible to tailor a subset of this response. The search query has the structure
$path EQ search-expression
where
- $path is the reserved word for search filtering.
- the equal sign (EQ) is the only allowed comparison operator for search filtering.
- search-expression is a path expression that may contain the wildcard character (*) for representation of an unknown node name.

The search-expression is relative to the root node given by the path component in the request. An example could be "*/*/isOpen", which, preceeded with a slash, and concatenated with the request root-path "Vehicle/Cabin/Door" would generate the absolute search expression "Vehicle/Cabin/Door/*/*/isOpen", in which case the response would contain all values from the isOpen nodes in that subtree, but not from the other possible leaf nodes in it.

The search filter can be used also in subscribe requests, see chapter Filter combinations.

Data value filter

If a request, typically when it is addressing a subtree, is only interested in response data with a specific value, then a data value filter can be used. The data value query has the structure
$data comparison-operator value
where
- $data is the reserved word for data value filtering.
- comparison-operator is one of either the equal sign (EQ), the greater than sign (GT), or the less than sign (LT).
- value is a number following Javascript syntax rules, or a boolean value.

If the data type of the value-expression is different from the data type of the node matching the path, then an error response is returned.

Subscribe filtering

The available subscribe filtering options are presented in the following chapters, and is only applicable to subscribe requests. The filter expression is carried in the request payload in the form of a key-value pair "filter": "filter expression", where "filter" is the key name, and "filter expression" is replaced by the actual expression.

Interval filter

An interval filter is used in a subscribe request when the client wants subscription notifications to be issued by the server at a regular time interval. The interval query has the structure
$interval EQ value
where
- $interval is the reserved word for interval filtering.
- the equal sign (EQ) is the only allowed comparison operator for interval filtering.
- value is an integer value in milliseconds representing the interval between issued notifications.

Range filter

A range filter is used when the client wants subscription notifications to be issued by the server when a value enters/exits the defined range. The range query has the structure
$range comparison-operator value
where
- $range is the reserved word for range filtering.
- comparison-operator is one of either the greater than sign (GT), or the less than sign (LT).
- value is a number following Javascript syntax rules.

Change filter

A change filter is used when the client wants subscription notifications to be issued by the server when a value has changed more than a defined value since last notification. The change query has the structure
$change comparison-operator value
where
- $change is the reserved word for change filtering.
- comparison-operator is one of either the greater than sign (GT), or the not equal sign (NEQ).
- value is a number following Javascript syntax rules.

When using the not equal comparison operator it MUST have the value zero, all other values lead to an error response. The usage is interpreted as "for any change", and also supports boolean changes.

Filter combinations

Queries of the types descibed below can be aggregated to form more complex queries. The format for this is then
query1 AND query2 AND .. queryN
where
- queryN is any of the query types, following the allowed combinations shown in Table 1.
- N is maximum four.
- AND is the logical AND operator.

IndexFilter nameAllowed combinations
1. Service discovery None
2. Search 3+4+5+6
3. Data value 2
4. Interval 2
5. Range 2+5+6
6. Change 2+5

An example of a read request URI containing an aggregated query is
Vehicle/Cabin/Door?$pathEQ*/*/isOpenAND$dataEQfalse
which would return data for all locked doors.
In filter combinations where a search expression in the URI is combined with a subscribe filter expression in the payload, the logical AND operator combines them.

Shall it be possible to use search filtering in subscribe requests?
Other data models may want further query support.Should there be some text about that?

Authentication and Authorization

In order to secure API access and to guarantee delivery of authorized content only, a token-based mechanism (cmp. OAuth 2.0 - RFC6749, JWT - RFC7519, JWT OAuth Profile - RFC7523) is used. OAuth grants an application access to protected data only for specific use cases (scopes) and often for a limited amount of time.filter

Details on how the JWT tokens will be sent by the clients are described in the TRANSPORT specification.

JWT-based access token

JSON Web Token (JWT) is an open standard RFC 7519 that defines a compact and self-contained way for transmitting authenticated information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can generally be signed using a public/private key pair using RSA or ECC.

For the application to the protocol, the token issuer (iss claim) has to provide access to its public key (sigurl claim) for token verification. At the same time, the public key references in the sigurl claim must be authenticated using appropriate PKI mechanisms. Alternatively, the public key used for verifying tokens may be exchanged (and updated) via a separate, authenticated channel.

The payload of a JWT-based access token contains all the required information like the scope (scp claim), avoiding the need to query the auth server more than once, thus they are called self-contained.

Token verification is crucial and MUST be implemented by all services handling sensitive information.

Expiry

JWT-based access tokens are stateless keys to information that needs to be protected. Therefore a token has to be revokable. As the underlying concept of self-containing tokens does not allow revocation by a central component on a request by request basis, JWT-based access tokens shall generally expire quickly. This narrows down the possible time window for using a token without permission. After a token expires, the client is forced to obtain a fresh access token and can be denied access to the service at this point in time. Additionally, if narrow time constraints must be met, the authorization server must offer a token whitelist - listing only token meta information - every service can subscribe to based on the JWT access token's identifier (jti claim).

Identification

Every JWT shall contain a jti claim in its header to allow for blacklisting, revocation notification and one time use.

Trust decisions

The contents of a JWT cannot be relied upon in a trust decision unless its contents have been cryptographically secured and bound to the context necessary for the trust decision. In particular, the key(s) used to sign and/or encrypt the JWT will typically be under the control of the party identified as the issuer of the JWT. Unsigned JWT-based access tokens MUST fail in their verification.

Every JWT shall contain an iss (issuer) claim in its header to identify the principal that issued the token by an identifier known to the party attempting to verify the token.

Authorization Process & Security (recommendation)

Applying the token mechanisms discussed earlier in this chapter allows authorization based on these tokens. This allows a central token service to enforce a policy based on flexible scopes that may or may not group several services into logical groups. In the following, we describe a reference authorization architecture based on JWTs. Using JWTs allows a server to evaluate a request in isolation, without having to query a central component repeatedly. However, to achieve timely revocation of service access without having the client obtain new tokens frequently, we propose to implement a revocation notification mechanism (see below).

We probably should present a figure defining the entities in this ecosystem - the server(s) managing the services, the token provisioning server, and the token validation server. This chapter does currently not describe this partitioning.

Security by OSI Level

On a basic level, the system has to implement specific security related mechanisms on different layers of the network stack:

OSI Mechanism Protocol(s)
7 Application Token-based Authorization JWT/OAuth2
6 Presentation
5 Session Authentication + Encryption TLS
4 Transport Firewall TCP
3 Network Firewall IP
2 Data-Link
1 Physical

Firewall

A firewall shall ONLY let the traffic pass it is configured for. All other ports shall be blocked by default.

Transport Layer Security

To secure the transfer of messages and tokens, transport layer security shall be established through the TLS protocol. For more detailed requirements on the required TLS version and cipher suites see Section #ref. Whether a concrete interface needs to be encrypted is subject of the security specification. However, all requests that include tokens MUST be made through an encrypted TLS channel. All necessary measures to allow TLS must be implemented, such as reliable time and secure certificate storage on the device using the certificate to authenticate. In case of mutual authentication, the client also needs to have appropriate key material.

Communication types

There are two different types of communication – public and confidential. The differentiation between these two types of communication is rather a project oriented than a security oriented. Communication is considered confidential when two trusted devices communicate with each other, e.g., the communication between two ECUs that are under full control (quality, security, testing etc.) of the vendor is considered confidential while the communication with at least one 3rd party client is considered public (e.g. cloud based client, smartphone client,…).

An internal communication is between a service/server and a - in an OAuth sense - confidential confidential client (i.e., one that can be securely provisioned with cryptographic key material). Internal communication will usually rely on a mutually authenticated TLS channel to establish a client identity for issuing tokens. See OAuth 2.0 - RFC6749 Section 2.1 for details.

Conversely, public communication occurs between a service/server and a - in the OAuth sense - public client. A public client cannot have reliable key material and can therefore not be authenticated directly. Instead, the protocol relies on a trusted system to attest the authenticity of a user identity on that client. The client then forwards a proof of authentication (e.g. an Authorization Grant Token cf. RFC7523) from the trusted system to the in-vehicle authorization server to attest the clients identity.

Use Cases

For the different use case for API usage, different cipher suites are recommended:

Communication between Cipher Suite
vehicle internal clients with encryption, with token-based authentication (default - internal) TLS_PSK_WITH_AES_128_CBC_SHA256
vehicle internal clients with encryption, with TLS-based authentication (e.g. certificate) (mutual auth with certificate pinning) TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 with ECC: secp256r1 (prime256v1)
vehicle internal clients without encryption, with authentication (might be decided to be used on per-service basis) TLS_PSK_WITH_NULL_SHA256
vehicle and vehicle external clients with encryption, with token based authentication (e.g. certificate) (default - external) TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 with ECC: secp256r1 (prime256v1)
vehicle and vehicle external clients without encryption or without authentication -
Authorization Grant Token (AGT)

The AGT is a JWT (https://jwt.io, https://tools.ietf.org/html/rfc7519) Token, profiled according to RFC7523 (JWT OAuth 2.0 Client Authorization Grant profile). The token MUST be signed by a trusted entity. The auth server uses the AGT to establish a client user identity (if any). An AGT shall only be valid for presentation at a particular vehicle's authorization server and shall thus contain a vehicle identifier (e.g., the VIN). The auth server must have access to an authentic public key to verify the AGT signature. The auth server must also be able to obtain updated public key material from the backend for AGT validation.

AGTs shall only be valid for a limited amount of time (several days). Checking revocation is impractical for the auth server as limited connectivity would negatively impact the user experience when attempting to access services in a vehicle. Instead, the client shall fetch new AGTs when the existing copies are about to expire. Under adversarial conditions, this would mean that an attacker can abuse e. g. a stolen portable device to access services in the name of the original user. This issue could however be mitigated by the portable device locking mechanisms as well as the ability to remove a user identity from a vehicle remotely using other frontends. Exfiltrating an AGT from a device or the communication channel would require a much higher effort, if platform and transport security are intact.

The AGT shall contain at least the following claims:

Creating the token

The client requests the AGT from the backend, specifying a target audience (a VIN), alongside backend authentication information (e.g., a backend access token). The backend system shall create and sign the desired AGT only if the user authentication is or was previously successful. Additional authorization checks MAY occur in the backend system. The signature MUST only be applied when all checks are positive. After this step a signed AGT is available for presentation to the auth server.

Token Header

Claims in the AGT header are – find the claim key for JSON in parentheses:

Issuer (iss)

The iss (issuer) claim identifies the principal that issued the JWT. The processing of this claim is generally application specific. The "iss" value is a case-sensitive string containing a String or URI value. This claim is MANDATORY and allows the token consumer to select appropriate key material for validation.

Link to public key used for signature (sigurl)

The sigurl claim (signature url) contains an url pointing to the public key to be applied for token signature verification. This public key has to be assigned to and issued by a trusted source (i.e., the consumer of the token must be able to authenticate the public key obtained from the sigurl, for example by pinning a specific root or intermediate certificate for a certificate in the sigurl). This claim is OPTIONAL, as the auth server may obtain the necessary public key through another suitable (authenticated, updatable) channel.

Issuing date (iat)

The iat (issued at) claim identifies the time at which the JWT was issued. This claim can be used to determine the age of the JWT. Its value MUST be a unix timestamp and MUST be validated to be in the past. This claim is MANDATORY.

Expiration time (exp)

The exp (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. The processing of the exp claim requires that a reliable time source is available and that the current date/time MUST be before the expiration date/time listed in the exp claim. Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew. Its value MUST be a unix timestamp. This claim is MANDATORY.

JWT identifier (jti)

The jti (JWT ID) claim provides a unique identifier for the JWT. The identifier value MUST be assigned in a manner that ensures that there is a negligible probability that the same value will be accidentally assigned to a different data object. The jti claim can be used to prevent the JWT from being replayed. The jti value is a case-sensitive string, it SHALL be used to revoke a token. This claim is MANDATORY.

Token payload

Mandatory claims in the AGT payload – find the claim key for JSON in parentheses:

Username/Userid (uid)

The uid (User Id) claim provides a unique identifier for the user the client is requesting authorization for. Usually the uid claim will hold a system-wide user identifier. The uid claim is used by the auth server to inform authorization decisions (e.g., whether an additional permission popup is necessary). The uid value is a case-sensitive string. The uid will be compared to the user logged in on the main unit. This claim is MANDATORY.

Audience (aud)

The aud (Audience) claim shall indicate which vehicle this AGT was issued for. Usually, the aud claim will contain a VIN. The token consumer MUST ensure that the audience string matches the expected value, i.e. that the token was issued for this vehicle.

The aud claim is MANDATORY??
Auth Server

The Access-Token issuer Service (auth server) is in charge of deciding over access requests submitted by a client. The client will request access to a given scope. A scope usually comprises access to one or more services. The server will validate an access token issued by the auth server, checking - among other things - that the token carries the expected scope. Below, relevant identities, scopes, policies and how tokens are issued are described.

The client request for an access token shall include the following information:

The auth server shall then decide whether or not to issue an access token based on this information, obtaining consent from the current vehicle user, if necessary. This process will be detailed in the following.

Types of Identities for Authorization decisions

Several identities need to be considered for authorization decisions and therefore be used by the authorization server. These identities are listed in the following.

Client Identity

The client requesting a service may have an identity itself. In this context, the term client usually refers to the device a piece of software is running on. The identity of this client (device) is generally only ascertainable if cryptographic key material is securely available on the device. Hence, the OAuth 2.0 standard distinguishes confidential and public clients. A confidential client is more tightly controlled in terms of software as well as hardware and can thus be securely provisioned with key material, which can be used to run cryptographic authentication protocols. In turn, a public client (e.g., a smartphone app on a smartphone without a trust store for secure certificate storage) comes with no such guarantees and is assumed to be more easily compromised by an adversary.

A confidential client shall be able to establish a mutually authenticated TLS channel with the auth server and the service server, providing a trusted identity, usually in the form of a certificate signed by a trusted authority. A confidential client can thus provide a proof of possession for a certain client identifier (client ID). After establishing a mutually authenticated channel with such a client, the server can be reasonably sure to be communicating with the same client as before. Confidential clients are therefore extended a client-level trust.

In contrast, a public client cannot provide any reliable identification information. Instead, public clients shall generate a unique identifier (UUID, client ID), for which it is very unlikely that another client chooses the same value. The client ID is thus only a weak identifier, which shall be used with care. In most cases, public clients shall provide a user identity that is asserted by a trusted backend on top of the client ID. It is this client user identity (that must have been previously authenticated between client, user and backend) which shall be the main source of a trust decision.

Client User Identity

The client user identity is a user identity that has been authenticated by a trusted backend systems towards the client. The auth server may choose to make authorization decisions based on this identity, for example comparing the client user identity with the system user identity (see below). If these two identities match, the auth server might conclude that the user in the vehicle is the same as the user that is logged in on the client and therefore grant a request. For the purposes of this protocol, the client user identity shall be communicated using JWT authorization grant tokens (AGT, see above).

System User Identity

The system user identity corresponds to the identity of the user currently active inside the vehicle. It is assumed that this identity belongs to the user currently in charge of operating the vehicle (i.e., the driver). The system will usually have credentials to act as this user with respect to other backend systems (e.g., to access personalized navigation functionality). The system user identity shall be available to the auth server from the environment (i.e., the platform the auth server is running on, e.g., the main unit).

In the future, there may be situations where more than one user identity is considered active on the system (i.e., the vehicle is personalized for multiple users, including potential passengers). In this case, additional metadata about the system users (e.g., which screen belongs to their seat) may be required for making authorization decisions. This use case, however, is not covered by the current version of this specification.

The client/system user Id descriptions above should be extended with a cloud based client.
Scopes

When requesting access to services, the client must specify a scope it wants to get access to. A scope describes a logical set of services. This facilitates the specification of policies as well as describing the current state of authorization to users, if need be. Clients request access to a certain scope and a service expects an access token for a certain scope. Similarly, the authorization server is not concerned with particular services but just with more abstract scopes. Using scopes allows the reuse of an access token for multiple services, which reduces the burden on client-side token management as well as requests against the auth server. Additionally, scopes also allow more fine-grained access control, where one service might expect different scopes for operations of different sensitivity (e.g., read vs. write).

There shall be two types of scopes: internal scopes are granted based on client properties (e.g. client identity or client type) without user interaction; conversely, user scopes may be granted through user interaction, i.e. a popup asking the user to decide whether or not a certain client should be able to use certain functionality. These user-scopes shall be defined in a way that facilitates understanding of a grant decision when being presented to a user, i.e., so that the set of services grouped into the scope carries meaning to a user. Otherwise, users are not able to effectively exercise the control that is expected by the system to protect them from unwanted accesses.

Every client has to know which scopes to request access á priori, i.e. the scope usually are to be known at implementation time.

User Scopes

As a reference, the following set of scopes shall be used to govern access:

Scope Label Description
hvacRead Read heating, ventilation and AC information
hvacControl Change HVAC state (e.g. set temperature, enable seat heating, etc. )
carStatusRead Read state of vehicle (doors/windows open, oil temperature, etc.)
carConfigrurationRead Read car-related settings (i.e. read settings found in car menu)
carConfigrurationControl Modify car-related settings (i.e. modify settings found in car menu)
audioRead Read audio/sound management (sources, volume, balance, etc.)
audioControl Modify audio/sound settings (sources, volume, balance, etc.)
The scope definitions needs more work.

New services may require the definition of additional scopes. However, the list of scopes that can be presented to the user for grating authorization must remain as low as possible to avoid user confusion.

Internal Scopes

Internal scopes are scopes that can only be granted to clients based on their properties (client type, client id, client user type, etc.) and not by user interaction. The granularity of such scopes shall be flexible and up to the implementer as well as the desired control over internal service access. They can range from one single scope for all internal services to one scope per service operation.

Policies

Based on the requested scope, the client type, the client user identity, the current system user identity as well as previously granted permissions, the authorization server will search for a policy match. If a match is found, an access token matching the requested scope is issued.

A policy may additionally specify that user interaction is necessary to grant a certain scope. An example policy may state: "If the client user identity does not match the current system user identity, display a popup asking for permission to access scope X". This decision shall be remembered, in the context of the current system user identity, by the authorization server. It is important to note that each system user identity shall be able to grant or deny permissions individually. This means that a system user A may grant permission P to client user Z, while system user B denies P to Z. Implementations must choose to grant (or deny) requested scopes indefinitely (until revocation) or for a certain (potentially user-chosen) amount of time. This choice may be made on a scope-by-scope basis.

On the other hand, the authorization server shall be able to deny access to certain (more sensitive) services under certain conditions. For example, only a client in the body control ECU shall be able to update the status of the vehicle's doors and windows or all write access shall be denied to public clients.

Requesting Permission from the User

A policy may defer an authorization decision to the current system user, as only the user currently in control of the vehicle shall be able to decide whether or not a certain client shall be able to access certain functionality.

There shall only be a small number of scopes (likely less than 10) that a user can ever be asked to grant for a given client. The interface presented to the user for making the authorization decision shall be presented when the client in question is making the request to access a service associated to the scope in question. The interface shall present a meaningful description of the extent of the scope to be granted. It shall also present a meaningful identifier for the client to be authorized. Lacking a reliable identifier, clients shall be allowed to provide a human-readable name when requesting access at the auth server.

It may be beneficial to allow the user making the authorization decision to specify additional constraints. The interface may choose to offer options to grant the permission until a certain time or event. Examples include until the permission is explicitly revoked, until the end of the current drive, for the next month, etc. Useful options should be determined from user research and must be enforced by the auth server.

All permission decisions shall be stored on a per-system-user basis in a consent service within the auth server. This only concerns permission decisions made by the user. Decisions made by the auth server by policy only shall not be documented in this table (as they should be stateless). The consent service shall store decisions as follows:

This information shall also be available to the system user in order to manage permissions.

Access token

An access token is needed to access the APIs of services. These tokens are issued as JWT based on RFC7523 (OAuth 2.0 profile for client authorization grants). The accessToken is issued to the client by the auth server after the policy checks described above have been successfully passed. The client then sends the token with each request where it is required. The recipient/service MUST deny any API access without a valid token being provided. The token's validity MUST be checked for each request. Additionally, after receiving a token for the first time, the service must subscribe to notifications of revocation for this token's identifier. The accessToken is a JWT-type token with a signature provided by the issuer. The token SHALL be as small as possible to avoid excessive communication overhead.

accessTokens are strictly bound to the system user identity who granted access (if any). This means that in a single user system they are only valid for the services of the currently active system user identity.

AccessToken validity must begin with issuance. AccessTokens shall be issued for a certain vehicle (VIN) and system user identity (uid). Expiration may be indefinite (until revocation) or shorter, based on the configured policy or user decision. It is important to note that meaningful expiration requires a reliable source of date and time information (authenticated time).

If an accessToken is not valid anymore, all API access MUST be prohibited. On expiration or revocation, the client MUST request a new accessToken and satisfy the corresponding auth server policy. An appropriate status code MUST be sent as a response.

Revocation

The vehicle token server shall maintain a list of access token identifiers issued based on a certain user decision (see [Requesting Permission from the User] above). Once an access decision is revoked, the vehicle token server must notifiy all services consuming these access tokens of the revocation. It is the responsibility of the service to register for revocation notification of known token identifiers.

Access Token Content

Note It is left to the client application to decide whether to request a single accessToken with multiple scopes multiple access accessTokens with just a single scope or anything in between, dependeing on client needs. Client developers need to be aware that each accessToken request might throw a dedicated popup.

Access Token Signature

The accessToken will be signed with the issuers public certificate. Therefore, the public key of the issuer needs to be accessible by any client during runtime.

API access

The client MUST send the accessToken with each request. API access MUST be denied if no token is given or it is found to be invalid for any reason.

Access Token Validation

Services MUST be able to perform validation steps for access tokens in isolation, i.e. without having to contact the auth server on every presentation of an access token. Therefore, services shall be able to parse and validate JWT-based access tokens.

The following properties of an access token shall be verified in the following order:

Once these validation steps are completed successfully, the service shall use the token identifier to subscribe to a revocation status for this identifier at the auth server. As long as local validation is successful and no revocation notification is sent by the auth server, the service shall assume that the token is valid. Once a revocation notification is sent, the service shall cache this information for an appropriate amount of time.

Token sequence overview

The following diagram shows a brief overview of the authorization flow, omitting details like the actual HTTPS calls and WebSocket message syntax.

Authorization workflow

A diagram would be great, if someone wants to draw one.

Interface

This chapter describes the different methods and its arguments that govern the communication between a service and a client.

Methods

A timeout for the response of all methods with responses MUST be defined. This timeout is transport protocol specific to reflect the normal behaviour of the transport protocol.

All methods should list the possible error types returned.

read

Purpose: obtain a representation of the value addressed by the given path

The service MUST expose a read method. The client MAY use the read method of the service to retrieve values managed by the service. If the service is able to satisfy the request it MUST return a content response. If the service is unable to fulfil the request, then the service MUST return an error response. The client MAY have to authenticate via the authenticate method before being able to access the values.

arguments:

  • path fully qualified path to a base node
  • filter selection criterias for specific values under the given path

responses:

  • content response fulfilling the request
  • error response describing what went wrong

update

Purpose: providing altered values to the service for a specified path

The service MAY expose an update method. The client MAY use the update method of the service to request a change to values managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.

arguments:

  • path fully qualified path to a base node
  • filter selection criterias for specific values under the given path
  • change new value that shall be applied

responses:

  • change response describing what went well
  • error response describing what went wrong

create

Purpose: providing new values to the service under a specified path

The service MAY expose a create method. The client MAY use the create method of the service to request new values to be managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.

arguments:

  • path fully qualified path to a base node
  • change new value that shall be added

responses:

  • change response describing what went well
  • error response describing what went wrong

delete

Purpose: removing all selected values under a specified path

The service MAY expose a delete method. The client MAY use the delete method of the service to request the deletion of existing values managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.

arguments:

  • path fully qualified path to a base node
  • filter selection criterias for specific values under the given path

responses:

  • change response describing what went well
  • error response describing what went wrong

subscribe

Purpose: monitor changes made to values under a specified path

The service MAY expose a subscribe method. The client MAY use the subscribe method of the service to request being informed of changes made to values managed by the service. The service MUST issue a notification if the equivalent read content response would change. If the service is able to satisfy the request it MUST return a subscription and contract response. If an error occurs the service MUST return an error response.

arguments:

  • path fully qualified path to a base node
  • filter selection criterias for specific values under the given path
  • contract describing the expectations for the client receiving notifications

responses:

  • subscription response describing the status of the subscription
  • contract describing the rules for the service sending notifications to the client
  • error response describing what went wrong

notify

Purpose: informs of changes made to values under a subscription

The client MUST expose a notify method if it uses the subscribe method of a service. The service MUST use the notify method of the client to inform of changes made to values managed by the service under the given subscription by sending a content response. The service MUST ignore any response from the client.

arguments:

responses: none

unsubscribe

Purpose: stop monitoring the changes made to values under a subscription

The service MUST expose a unsubscribe method if an subscribe method is exposed. The client MAY use the unsubscribe method of the service to cancel being informed of changes made to values managed by the service under the given subscription. The service MUST stop issuing notifications. If the service is able to satisfy the request it MUST return a subscription response. If an error occurs the service MUST return an error response.

arguments:

responses:

  • subscription response describing the status of the subscription
  • error response describing what went wrong

Arguments and Responses

content

  • Value: One or more values associated with the addressed VSS leaves.
  • Timestamp: A timestamp associated with the request.

filter

criterias to filter according to a query

path

see addressing

change

  • changed applied immediately or later
  • list changed paths

subscription

status of the subscription

contract

describing the rules for subscriptions/notifications

error

An error response MUST include the formal error type. An error response MAY include a textual form of the error type. An error response MUST include an error value if obligatory for the error type. An error response MUST include a timestamp. An error response MUST be actionable.

fieldobligationdescriptionformatexample
error type mandatory short handle describing the error. protocol specifc AuthorizationFailed
error description optional Information describing the error reason. ^[\w ]{5,255}$ Authorization failed for the method. Please set a valid AuthToken and AuthType.
error value conditional Send if set as mandatory for the error type. Describing more details to understand the error type. string, error type specific AuthToken valid; Access Level not sufficient.
timestamp mandatory The time when the error occured. date-time compliant 2005-11-12T12:01:42.123+01:00
Do we really need an error value as all method calls are directly mapped to error response.
How do we want to handle timestamps? Is this something that is signaled through the meta-data for the call of the method? Is this something every method must have?

Error Types

These error types MUST be implemented by a service. A transport protocol MAY define additional error types. A transport protocol MUST not alter these error types.

error typeTextual descriptionvaluesSolution/Action
InvalidToken The AuthToken is not recognized as valid. none Check if AuthType is set correctly. Get a new AuthToken.
AccessLevelNotSufficient The AuthToken is recognized but does not allow the execution of the requested method. none Get a token with a different access level.
InvalidPath The given path is not valid. none Check the path given in the arguments.
MissingArgument An mandatory argument is missing from the method execution. Missing Argument Add missing argument.
InvalidFilter Filter could not be parsed. Error Position Fix filter.
ValueNotPermited A value set by the client is not permited. value Set the value to a value permited by the service implementation.
ContractInvalid The contract submitted is not valid. Invalid contract statement Recall method with a valid contract.
SubscriptionUnknown The subscription is not known by the service. none Check subscription.
Would examples for the error types be helpful?
Where best to describe error types?

Meta-Data

The title for this chapter is not good.

For the communication between service and client several key/value pairs can be given to describe the environment in what the methods () are called. The string describing the key MUST be the same structure as name.

authorization

Purpose: authorization makes it possible for a client to authorize itself towards a service.

The authorization key/value pairs consists out of a AuthType and a AuthToken key/value pair. The client MAY use the authorization key/value pairs to transfer an authorization token to the service. The client MUST use either both key/value pairs or none of the two. The service MAY use the token transfered by the AuthToken key/value pair to authenticate the client. The client MUST set the type of the token with the AuthType key/value pair if AuthToken is set. This concept MAY be used for access control. A rejected authorization token MUST result in an error response. If the execution of a method on a service needs authorization the service MUST use the authorization key/value pair.

key AuthToken
value ^\w{1,1024}$
How long should the maximum length of a token be to be easily implemented by most protocols.
key AuthType
value name compliant

variant selection

Purpose: A client can express which schema variants it can support when executing a method. A service can express which schema variant it uses when communicating with the client.

The client MAY set multiple key/value pairs to describe all variants it supports. The client MAY not set any key/value pair. The service MUST set exactly one schema key/value pair to describe the used variant. The client MAY use the [[SemVer]] style to describe degrees of freedom in the version of the schema.

key Schema
value schema compliant
examplew3c.vehicle.v1.5.3

Appendix:Dynamic registry API

The dynamic reqistry API provides the functionality to dynamically add or delete branches of the VSS tree. A branch can only be deleted if it has been dynamically added. In the following an entity requesting dynamic registry services is called a "service manager", and the entity performing these requests is called the "core server", see the figure "Gen2 server reference architecure".