Skip to content

Commit 0b204b4

Browse files
authored
feat: add authentication example with user certificates (#214)
1 parent 1befdec commit 0b204b4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

examples/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ crate-type = ["staticlib"]
3939
name = "persistent_subscriptions"
4040
path = "persistent_subscriptions.rs"
4141
crate-type = ["staticlib"]
42+
43+
[[example]]
44+
name = "user_certificates"
45+
path = "user_certificates.rs"
46+
crate-type = ["staticlib"]

examples/user_certificates.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#![allow(unused_attributes)]
2+
#![allow(unused_imports)]
3+
#![allow(unused_results)]
4+
#![allow(unused_variables)]
5+
#![allow(unreachable_code)]
6+
7+
use std::error::Error;
8+
use kurrentdb::Client;
9+
10+
type Result<A> = std::result::Result<A, Box<dyn Error>>;
11+
12+
pub async fn user_certificates() -> Result<()> {
13+
// region client-with-user-certificates
14+
let settings = "kurrentdb://admin:changeit@{endpoint}?tls=true&userCertFile={pathToCaFile}&userKeyFile={pathToKeyFile}".parse()?;
15+
let client = Client::new(settings)?;
16+
// endregion client-with-user-certificates
17+
18+
Ok(())
19+
}

0 commit comments

Comments
 (0)