1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use url::Url;
use webauthn_rs::base64_data::Base64UrlSafeData;
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum CodeChallengeMethod {
S256,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct AuthorisationRequest {
pub response_type: String,
pub client_id: String,
pub state: Base64UrlSafeData,
pub code_challenge: Base64UrlSafeData,
pub code_challenge_method: CodeChallengeMethod,
pub redirect_uri: Url,
pub scope: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ConsentRequest {
pub client_name: String,
pub scopes: Vec<String>,
pub consent_token: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct AccessTokenRequest {
pub grant_type: String,
pub code: String,
pub redirect_uri: Url,
pub client_id: Option<String>,
pub code_verifier: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct AccessTokenResponse {
pub access_token: String,
pub token_type: String,
pub expires_in: u32,
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scope: Option<String>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ErrorResponse {
pub error: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_uri: Option<Url>,
}