aster_forge_external_auth/
lib.rs1#![cfg_attr(
12 not(test),
13 deny(
14 clippy::unwrap_used,
15 clippy::unreachable,
16 clippy::expect_used,
17 clippy::panic,
18 clippy::unimplemented,
19 clippy::todo
20 )
21)]
22
23pub mod driver;
24mod error;
25pub mod normalize;
26pub mod providers;
27pub mod registry;
28pub mod types;
29
30pub use driver::{
31 ExternalAuthAuthorizationStart, ExternalAuthCallback, ExternalAuthProfile,
32 ExternalAuthProviderConfig, ExternalAuthProviderDescriptor, ExternalAuthProviderDriver,
33 ExternalAuthProviderTestCheck, ExternalAuthProviderTestResult,
34};
35pub use error::{ExternalAuthError, MapExternalAuthErr, Result};
36pub use registry::{ExternalAuthProviderRegistry, default_registry};
37pub use types::{
38 EXTERNAL_AUTH_TYPE_STORAGE_LEN, ExternalAuthProtocol, ExternalAuthProviderKind,
39 ExternalAuthProviderOptions, MicrosoftExternalAuthProviderOptions,
40 parse_external_auth_provider_options, serialize_external_auth_provider_options,
41};
42
43#[cfg(any(feature = "oauth2", feature = "oidc"))]
44pub(crate) const OUTBOUND_HTTP_USER_AGENT: &str =
45 concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
46
47#[cfg(any(feature = "oauth2", feature = "oidc"))]
48pub(crate) fn outbound_http_user_agent(provider: &driver::ExternalAuthProviderConfig) -> &str {
49 provider
50 .outbound_http_user_agent
51 .as_deref()
52 .map(str::trim)
53 .filter(|value| !value.is_empty())
54 .unwrap_or(OUTBOUND_HTTP_USER_AGENT)
55}