Crates.io | casdoor-rs-sdk |
lib.rs | casdoor-rs-sdk |
version | 2.5.4 |
source | src |
created_at | 2024-10-23 07:32:29.654408 |
updated_at | 2024-11-05 06:15:34.715886 |
description | A Casdoor SDK (contain APIs) with more complete interfaces and better usability. |
homepage | https://casdoor.org |
repository | https://github.com/andeya/casdoor-rs-sdk |
max_upload_size | |
id | 1419798 |
size | 98,912 |
A Casdoor SDK (contain APIs) with more complete interfaces and better usability.
Run the following Cargo command in your project directory:
cargo add casdoor-rs-sdk
Or add the following line to your Cargo.toml:
casdoor-rs-sdk = "2"
#[cfg(test)]
mod tests {
use casdoor_rs_sdk::*;
#[test]
fn example() {
let endpoint = "http://localhost:8000";
let client_id = "0e6ad201d317fb74fe9d";
let client_secret = "1fc847b0fdb3cb3f067c15ee383dee6213bd3fde";
let certificate = r###"
-----BEGIN CERTIFICATE-----
MIIE+TCCAuGgAwIBAgIDAeJAMA0GCSqGSIb3DQEBCwUAMDYxHTAbBgNVBAoTFENh
c2Rvb3IgT3JnYW5pemF0aW9uMRUwEwYDVQQDEwxDYXNkb29yIENlcnQwHhcNMjEx
MDE1MDgxMTUyWhcNNDExMDE1MDgxMTUyWjA2MR0wGwYDVQQKExRDYXNkb29yIE9y
Z2FuaXphdGlvbjEVMBMGA1UEAxMMQ2FzZG9vciBDZXJ0MIICIjANBgkqhkiG9w0B
AQEFAAOCAg8AMIICCgKCAgEAsInpb5E1/ym0f1RfSDSSE8IR7y+lw+RJjI74e5ej
rq4b8zMYk7HeHCyZr/hmNEwEVXnhXu1P0mBeQ5ypp/QGo8vgEmjAETNmzkI1NjOQ
CjCYwUrasO/f/MnI1C0j13vx6mV1kHZjSrKsMhYY1vaxTEP3+VB8Hjg3MHFWrb07
uvFMCJe5W8+0rKErZCKTR8+9VB3janeBz//zQePFVh79bFZate/hLirPK0Go9P1g
OvwIoC1A3sarHTP4Qm/LQRt0rHqZFybdySpyWAQvhNaDFE7mTstRSBb/wUjNCUBD
PTSLVjC04WllSf6Nkfx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IWSalADosHAgMWfXuWP+h
8XKXmzlxuHbTMQYtZPDgspS5aK+S4Q9wb8RRAYo=
-----END CERTIFICATE-----
"###;
let org_name = "built-in";
let app_name = "myapp";
let sdk = Config::new(endpoint, client_id, client_secret, certificate, org_name, Some(app_name.to_owned())).into_sdk();
println!("{:?}", sdk);
println!("{:?}", sdk.authn());
}
}