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

Method AuthSourceKind

sdk/cliproxy/auth/classification.go:46–74  ·  view source on GitHub ↗

AuthSourceKind returns where the Auth entry came from at runtime.

()

Source from the content-addressed store, hash-verified

44
45// AuthSourceKind returns where the Auth entry came from at runtime.
46func (a *Auth) AuthSourceKind() string {
47 if a == nil {
48 return ""
49 }
50 if strings.EqualFold(authAttribute(a, AttributeRuntimeOnly), "true") {
51 return AuthSourceMemory
52 }
53 if source := normalizeAuthSourceKind(authAttribute(a, AttributeSourceBackend)); source != "" {
54 return source
55 }
56 source := authAttribute(a, AttributeSource)
57 if source != "" {
58 sourceLower := strings.ToLower(source)
59 if strings.HasPrefix(sourceLower, AuthSourceConfig+":") {
60 return AuthSourceConfig
61 }
62 if normalized := normalizeAuthSourceKind(source); normalized != "" {
63 return normalized
64 }
65 return AuthSourceFile
66 }
67 if authAttribute(a, AttributePath) != "" {
68 return AuthSourceFile
69 }
70 if strings.TrimSpace(a.FileName) != "" {
71 return AuthSourceFile
72 }
73 return ""
74}
75
76func normalizeAuthKind(kind string) string {
77 switch strings.ToLower(strings.TrimSpace(kind)) {

Callers 2

IsConfigAPIKeyAuthFunction · 0.80
TestAuthSourceKindFunction · 0.80

Calls 2

normalizeAuthSourceKindFunction · 0.85
authAttributeFunction · 0.70

Tested by 1

TestAuthSourceKindFunction · 0.64