MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / resolveAuthPath

Method resolveAuthPath

sdk/auth/filestore.go:386–415  ·  view source on GitHub ↗
(auth *cliproxyauth.Auth)

Source from the content-addressed store, hash-verified

384}
385
386func (s *FileTokenStore) resolveAuthPath(auth *cliproxyauth.Auth) (string, error) {
387 if auth == nil {
388 return "", fmt.Errorf("auth filestore: auth is nil")
389 }
390 if auth.Attributes != nil {
391 if p := strings.TrimSpace(auth.Attributes["path"]); p != "" {
392 return p, nil
393 }
394 }
395 if fileName := strings.TrimSpace(auth.FileName); fileName != "" {
396 if filepath.IsAbs(fileName) {
397 return fileName, nil
398 }
399 if dir := s.baseDirSnapshot(); dir != "" {
400 return filepath.Join(dir, fileName), nil
401 }
402 return fileName, nil
403 }
404 if auth.ID == "" {
405 return "", fmt.Errorf("auth filestore: missing id")
406 }
407 if filepath.IsAbs(auth.ID) {
408 return auth.ID, nil
409 }
410 dir := s.baseDirSnapshot()
411 if dir == "" {
412 return "", fmt.Errorf("auth filestore: directory not configured")
413 }
414 return filepath.Join(dir, auth.ID), nil
415}
416
417func (s *FileTokenStore) labelFor(metadata map[string]any) string {
418 if metadata == nil {

Callers 1

SaveMethod · 0.95

Calls 1

baseDirSnapshotMethod · 0.95

Tested by

no test coverage detected