ocm_types/token.rs
1// SPDX-FileCopyrightText: 2026 Matthias Kraus <info@opengeomesh.org>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5use serde::{Deserialize, Serialize};
6
7
8#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
9struct TokenRequest{
10
11 /// FQDN of the Receiving Server.
12 /// example: receiver.org
13 client_id: String,
14 /// Secret received in the Share Creation Notification
15 /// example: xyz
16 code: String,
17 /// Must be set to 'authorization_code'
18 /// example: authorization_code
19 grant_type: GrantType,
20 /// Optional parameter that MUST be ignored by the server
21 /// example: https://receiver.org/ocm/callback
22 redirect_uri: Option<String>
23}
24
25#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
26enum GrantType {
27 #[default]
28 AuthorizationCode
29}
30
31#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
32struct TokenResponse{
33 /// The bearer token to be used to access the protocol-specific API(s)
34 /// example: asdfgh
35 access_token: String,
36 /// Must be set to 'Bearer'
37 /// example: Bearer
38 token_type: TokenType,
39 /// Number of seconds before this access_token will need to be refreshed.
40 /// example: 300
41 expires_in: u64,
42}
43
44#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
45enum TokenType {
46 #[default]
47 Bearer
48}