MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / provision_user

Method provision_user

chirpstack/src/api/internal.rs:71–106  ·  view source on GitHub ↗
(&self, user_id: &Uuid, user_info: &S)

Source from the content-addressed store, hash-verified

69 }
70
71 async fn provision_user<S>(&self, user_id: &Uuid, user_info: &S) -> Result<()>
72 where
73 S: Serialize,
74 {
75 let conf = config::get();
76 if conf
77 .user_authentication
78 .openid_connect
79 .registration_callback_url
80 .is_empty()
81 {
82 return Ok(());
83 }
84
85 let client = Client::builder().timeout(Duration::from_secs(5)).build()?;
86 let mut headers = HeaderMap::new();
87 headers.insert(CONTENT_TYPE, "application/json".parse().unwrap());
88
89 let res = client
90 .post(
91 &conf
92 .user_authentication
93 .openid_connect
94 .registration_callback_url,
95 )
96 .json(user_info)
97 .query(&[("user_id", user_id.to_string())])
98 .headers(headers)
99 .send()
100 .await?;
101
102 match res.error_for_status().context("Provision request error") {
103 Ok(_) => Ok(()),
104 Err(e) => Err(e),
105 }
106 }
107}
108
109pub struct DropReceiver<T> {

Callers 1

Calls 5

insertMethod · 0.80
unwrapMethod · 0.80
postMethod · 0.80
to_stringMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected