Load a local identity by name, falling back to a case-insensitive match. Tenant slugs are lowercase (e.g. `aaron`), but locally stored identities are free-form and frequently mixed-case (e.g. `Aaron`). A subdomain-inferred name would therefore never match the local identity on a strict comparison. An exact match always wins; otherwise the first identity whose name matches case-insensitively is re
(store: &IdentityStore, name: &str)
| 140 | /// An exact match always wins; otherwise the first identity whose name matches |
| 141 | /// case-insensitively is returned. |
| 142 | fn load_identity_lenient(store: &IdentityStore, name: &str) -> Option<Identity> { |
| 143 | if let Ok(identity) = store.load_by_name(name) { |
| 144 | return Some(identity); |
| 145 | } |
| 146 | |
| 147 | let wanted = name.to_lowercase(); |
| 148 | store |
| 149 | .list() |
| 150 | .ok()? |
| 151 | .into_iter() |
| 152 | .find(|identity| identity.name.to_lowercase() == wanted) |
| 153 | } |
| 154 | |
| 155 | /// Attach a Bearer JWT auth header to the remote config. |
| 156 | /// |
no test coverage detected