casdoor_sdk_rust/application/
models.rs1use serde::{Deserialize, Serialize};
2
3use crate::{Cert, IsQueryArgs, Model, Organization, Provider, ThemeData};
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
6#[serde(rename_all = "camelCase", default)]
7pub struct Application {
8 owner: String,
9 name: String,
10 created_time: String,
11
12 display_name: String,
13 logo: String,
14 homepage_url: String,
15 description: String,
16 organization: String,
17 cert: String,
18 header_html: String,
19 enable_password: bool,
20 enable_sign_up: bool,
21 enable_signin_session: bool,
22 enable_auto_signin: bool,
23 enable_code_signin: bool,
24 enable_saml_compress: bool,
25 enable_saml_c14n10: bool,
26 enable_saml_post_binding: bool,
27 use_email_as_saml_name_id: bool,
28 enable_web_authn: bool,
29 enable_link_with_email: bool,
30 org_choice_mode: String,
31 saml_reply_url: String,
32 providers: Vec<ProviderItem>,
33 signin_methods: Vec<SigninMethod>,
34 signup_items: Vec<SignupItem>,
35 signin_items: Vec<SigninItem>,
36 grant_types: Vec<String>,
37 organization_obj: Option<Organization>,
38 cert_public_key: String,
39 tags: Vec<String>,
40 saml_attributes: Vec<SamlItem>,
41 is_shared: bool,
42
43 client_id: String,
44 client_secret: String,
45 redirect_uris: Vec<String>,
46 token_format: String,
47 token_signing_method: String,
48 token_fields: Vec<String>,
49 expire_in_hours: i32,
50 refresh_expire_in_hours: i32,
51 signup_url: String,
52 signin_url: String,
53 forget_url: String,
54 affiliation_url: String,
55 terms_of_use: String,
56 signup_html: String,
57 signin_html: String,
58 theme_data: Option<ThemeData>,
59 footer_html: String,
60 form_css: String,
61 form_css_mobile: String,
62 form_offset: i32,
63 form_side_html: String,
64 form_background_url: String,
65
66 failed_signin_limit: i32,
67 failed_signin_frozen_time: i32,
68
69 cert_obj: Option<Cert>,
70}
71
72
73#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
74#[serde(rename_all = "camelCase", default)]
75pub struct ProviderItem {
76 owner: String,
77 name: String,
78
79 can_sign_up: bool,
80 can_sign_in: bool,
81 can_unlink: bool,
82 prompted: bool,
83 alert_type: String,
84 rule: String,
85 provider: Option<Provider>,
86}
87
88
89#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
90#[serde(rename_all = "camelCase", default)]
91pub struct SignupItem {
92 name: String,
93 visible: bool,
94 required: bool,
95 prompted: bool,
96 custom_css: String,
97 label: String,
98 placeholder: String,
99 regex: String,
100 rule: String,
101}
102
103
104#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
105#[serde(rename_all = "camelCase", default)]
106pub struct SigninMethod {
107 name: String,
108 display_name: String,
109 rule: String,
110}
111
112
113#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
114#[serde(rename_all = "camelCase", default)]
115pub struct SigninItem {
116 name: String,
117 visible: bool,
118 label: String,
119 custom_css: String,
120 placeholder: String,
121 rule: String,
122 is_custom: bool,
123}
124
125
126#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
127#[serde(rename_all = "camelCase", default)]
128pub struct SamlItem {
129 name: String,
130 name_format: String,
131 value: String,
132}
133
134impl Model for Application {
135 fn ident() -> &'static str {
136 "application"
137 }
138 fn plural_ident() -> &'static str {
139 "applications"
140 }
141 fn support_update_columns() -> bool {
142 false
143 }
144 fn owner(&self) -> &str {
145 &self.owner
146 }
147 fn name(&self) -> &str {
148 &self.name
149 }
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
153pub struct ApplicationQueryArgs {
154 #[serde(rename = "pageSize", skip_serializing_if = "Option::is_none")]
155 pub page_size: Option<i32>,
156 #[serde(rename = "p", skip_serializing_if = "Option::is_none")]
157 pub page: Option<i32>,
158 #[serde(rename = "field", skip_serializing_if = "Option::is_none")]
159 pub field: Option<String>,
160 #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
161 pub value: Option<String>,
162 #[serde(rename = "sortField", skip_serializing_if = "Option::is_none")]
163 pub sort_field: Option<String>,
164 #[serde(rename = "sortOrder", skip_serializing_if = "Option::is_none")]
165 pub sort_order: Option<String>,
166 pub organization_name: Option<String>,
167}
168
169impl IsQueryArgs for ApplicationQueryArgs {}