Use map of identity_provider to accommodate env var enumerations.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2026-01-30 23:55:28 +00:00
parent 0474753333
commit 0b864801f5
6 changed files with 76 additions and 18 deletions

View File

@@ -52,7 +52,7 @@ pub(crate) async fn get_login_types_route(
let identity_providers: Vec<_> = services
.config
.identity_provider
.iter()
.values()
.filter(|_| list_idps)
.cloned()
.map(|config| IdentityProvider {

View File

@@ -90,9 +90,9 @@ pub(crate) async fn sso_login_route(
let default_idp_id = services
.config
.identity_provider
.iter()
.values()
.find(|idp| idp.default)
.or_else(|| services.config.identity_provider.iter().next())
.or_else(|| services.config.identity_provider.values().next())
.map(IdentityProvider::id)
.map(ToOwned::to_owned)
.unwrap_or_default();
@@ -419,7 +419,7 @@ pub(crate) async fn sso_callback_route(
let next_idp_url = services
.config
.identity_provider
.iter()
.values()
.filter(|idp| idp.default || services.config.single_sso)
.skip_while(|idp| idp.id() != idp_id)
.nth(1)