(auth *Auth, provider string, accountInfo string)
| 5692 | } |
| 5693 | |
| 5694 | func formatOauthIdentity(auth *Auth, provider string, accountInfo string) string { |
| 5695 | if auth == nil { |
| 5696 | return "" |
| 5697 | } |
| 5698 | // Prefer the auth's provider when available. |
| 5699 | providerName := strings.TrimSpace(auth.Provider) |
| 5700 | if providerName == "" { |
| 5701 | providerName = strings.TrimSpace(provider) |
| 5702 | } |
| 5703 | // Only log the basename to avoid leaking host paths. |
| 5704 | // FileName may be unset for some auth backends; fall back to ID. |
| 5705 | authFile := strings.TrimSpace(auth.FileName) |
| 5706 | if authFile == "" { |
| 5707 | authFile = strings.TrimSpace(auth.ID) |
| 5708 | } |
| 5709 | if authFile != "" { |
| 5710 | authFile = filepath.Base(authFile) |
| 5711 | } |
| 5712 | parts := make([]string, 0, 3) |
| 5713 | if providerName != "" { |
| 5714 | parts = append(parts, "provider="+providerName) |
| 5715 | } |
| 5716 | if authFile != "" { |
| 5717 | parts = append(parts, "auth_file="+authFile) |
| 5718 | } |
| 5719 | if len(parts) == 0 { |
| 5720 | return accountInfo |
| 5721 | } |
| 5722 | return strings.Join(parts, " ") |
| 5723 | } |
| 5724 | |
| 5725 | // InjectCredentials delegates per-provider HTTP request preparation when supported. |
| 5726 | // If the registered executor for the auth provider implements RequestPreparer, |
no outgoing calls
no test coverage detected