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