casdoor_sdk_rust/provider/
models.rs

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
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::Model;

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
#[serde(rename_all = "camelCase", default)]
pub struct Provider {
    owner: String,
    name: String,
    created_time: String,

    display_name: String,
    category: String,
    type_: String,
    sub_type: String,
    method: String,
    client_id: String,
    client_secret: String,
    client_id2: String,
    client_secret2: String,
    cert: String,
    custom_auth_url: String,
    custom_token_url: String,
    custom_user_info_url: String,
    custom_logo: String,
    scopes: String,
    user_mapping: HashMap<String, String>,

    host: String,
    port: i32,
    disable_ssl: bool, // If the provider type is WeChat, DisableSsl means EnableQRCode
    title: String,
    content: String, // If provider type is WeChat, Content means QRCode string by Base64 encoding
    receiver: String,

    region_id: String,
    sign_name: String,
    template_code: String,
    app_id: String,

    endpoint: String,
    intranet_endpoint: String,
    domain: String,
    bucket: String,
    path_prefix: String,

    metadata: String,
    idp: String,
    issuer_url: String,
    enable_sign_authn_request: bool,

    provider_url: String,
}

impl Model for Provider {
    fn ident() -> &'static str {
        "provider"
    }
    fn plural_ident() -> &'static str {
        "providers"
    }
    fn support_update_columns() -> bool {
        false
    }
    fn owner(&self) -> &str {
        &self.owner
    }
    fn name(&self) -> &str {
        &self.name
    }
}