pub struct OAuthRegistry { /* private fields */ }Expand description
OAuth provider registry.
Implementations§
Source§impl OAuthRegistry
impl OAuthRegistry
pub fn new() -> Self
pub fn register(&mut self, config: OAuthConfig)
pub fn get(&self, provider: &str) -> Option<&OAuthConfig>
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build from environment variables.
For each builtin provider (and any oidc_issuer-configured
IdP), looks for PYLON_OAUTH_<PROVIDER>_CLIENT_ID /
_CLIENT_SECRET / _REDIRECT. Apple additionally requires
_TEAM_ID, _KEY_ID, _PRIVATE_KEY (PEM contents or path).
Microsoft accepts an optional _TENANT.
Generic OIDC: any env var matching
PYLON_OAUTH_<NAME>_OIDC_ISSUER registers a provider with id
<name> (lowercased) using the discovered endpoints. Useful
for Auth0, Okta, Keycloak, Cognito, Logto, Authentik, etc.
Sourcepub fn ids(&self) -> impl Iterator<Item = &str>
pub fn ids(&self) -> impl Iterator<Item = &str>
Iterate over registered provider ids — used by routes/auth.rs
to expose /api/auth/providers and to validate
/api/auth/login/<id> paths against the configured set.
Process-wide cached registry. Built once on first use from
from_env; subsequent calls are zero-cost. Routes use this
to avoid the ~150 syscalls from_env does per call.
Trade-off: env changes after server start aren’t picked up without a restart — same as every other Pylon env-var path.