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

Function get_client

chirpstack/src/api/oidc.rs:185–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

183}
184
185async fn get_client() -> Result<Client> {
186 let conf = config::get();
187
188 if conf.user_authentication.enabled != "openid_connect" {
189 return Err(anyhow!("OIDC is not enabled"));
190 }
191
192 let http_client = reqwest::ClientBuilder::new()
193 .redirect(reqwest::redirect::Policy::none())
194 .build()?;
195
196 let provider_metadata = CoreProviderMetadata::discover_async(
197 IssuerUrl::new(conf.user_authentication.openid_connect.provider_url.clone())?,
198 &http_client,
199 )
200 .await?;
201
202 let client = CoreClient::from_provider_metadata(
203 provider_metadata,
204 ClientId::new(conf.user_authentication.openid_connect.client_id.clone()),
205 Some(ClientSecret::new(
206 conf.user_authentication
207 .openid_connect
208 .client_secret
209 .clone(),
210 )),
211 )
212 .set_redirect_uri(RedirectUrl::new(
213 conf.user_authentication.openid_connect.redirect_url.clone(),
214 )?);
215
216 Ok(client)
217}

Callers 2

login_handlerFunction · 0.70
get_userFunction · 0.70

Calls 1

getFunction · 0.50

Tested by

no test coverage detected