(ctx context.Context, auth *coreauth.Auth)
| 329 | } |
| 330 | |
| 331 | func (h *Host) RefreshAuth(ctx context.Context, auth *coreauth.Auth) (refreshed *coreauth.Auth, handled bool, err error) { |
| 332 | if h == nil || auth == nil { |
| 333 | return nil, false, nil |
| 334 | } |
| 335 | record := h.authProviderRecord(authProvider(auth)) |
| 336 | if record == nil || record.plugin.Capabilities.AuthProvider == nil { |
| 337 | return nil, false, nil |
| 338 | } |
| 339 | if !h.recordCurrent(*record) { |
| 340 | return nil, false, nil |
| 341 | } |
| 342 | defer func() { |
| 343 | if recovered := recover(); recovered != nil { |
| 344 | h.fusePlugin(record.id, "AuthProvider.RefreshAuth", recovered) |
| 345 | refreshed = nil |
| 346 | handled = true |
| 347 | err = fmt.Errorf("auth provider refresh panic: %v", recovered) |
| 348 | } |
| 349 | }() |
| 350 | |
| 351 | pluginResp, errRefresh := record.plugin.Capabilities.AuthProvider.RefreshAuth(ctx, pluginapi.AuthRefreshRequest{ |
| 352 | AuthID: authID(auth), |
| 353 | AuthProvider: authProvider(auth), |
| 354 | StorageJSON: storageJSONFromAuth(auth), |
| 355 | Metadata: cloneAnyMap(authMetadata(auth)), |
| 356 | Attributes: authAttributes(auth), |
| 357 | Host: h.hostConfigSummary(), |
| 358 | HTTPClient: h.newHTTPClient(auth), |
| 359 | }) |
| 360 | if errRefresh != nil { |
| 361 | return nil, true, errRefresh |
| 362 | } |
| 363 | data := pluginResp.Auth |
| 364 | if strings.TrimSpace(data.Provider) == "" { |
| 365 | data.Provider = authProvider(auth) |
| 366 | } |
| 367 | if strings.TrimSpace(data.ID) == "" { |
| 368 | data.ID = authID(auth) |
| 369 | } |
| 370 | if strings.TrimSpace(data.FileName) == "" { |
| 371 | data.FileName = auth.FileName |
| 372 | } |
| 373 | if strings.TrimSpace(data.Label) == "" { |
| 374 | data.Label = auth.Label |
| 375 | } |
| 376 | if strings.TrimSpace(data.Prefix) == "" { |
| 377 | data.Prefix = auth.Prefix |
| 378 | } |
| 379 | if strings.TrimSpace(data.ProxyURL) == "" { |
| 380 | data.ProxyURL = auth.ProxyURL |
| 381 | } |
| 382 | if len(data.Metadata) == 0 { |
| 383 | data.Metadata = cloneAnyMap(auth.Metadata) |
| 384 | } |
| 385 | if len(data.Attributes) == 0 { |
| 386 | data.Attributes = cloneStringMap(auth.Attributes) |
| 387 | } |
| 388 | if len(data.StorageJSON) == 0 { |
nothing calls this directly
no test coverage detected