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

Function AuthConfigured

internal/pluginstore/auth.go:76–93  ·  view source on GitHub ↗
(auth []AuthConfig, requestURL string, kind string)

Source from the content-addressed store, hash-verified

74}
75
76func AuthConfigured(auth []AuthConfig, requestURL string, kind string) bool {
77 item, ok := matchingAuthConfig(auth, requestURL, kind)
78 if !ok {
79 return false
80 }
81 switch strings.ToLower(strings.TrimSpace(item.Type)) {
82 case AuthTypeNone:
83 return false
84 case AuthTypeBearer, AuthTypeGitHubToken:
85 return strings.TrimSpace(os.Getenv(item.TokenEnv)) != ""
86 case AuthTypeBasic:
87 return strings.TrimSpace(os.Getenv(item.UsernameEnv)) != "" && strings.TrimSpace(os.Getenv(item.PasswordEnv)) != ""
88 case AuthTypeHeader:
89 return item.HeaderName != "" && strings.TrimSpace(os.Getenv(item.HeaderValueEnv)) != ""
90 default:
91 return false
92 }
93}
94
95func PluginAuthConfigured(source Source, plugin Plugin, auth []AuthConfig) bool {
96 if AuthConfigured(auth, source.URL, RequestKindRegistry) {

Callers 3

PluginAuthConfiguredFunction · 0.70

Calls 1

matchingAuthConfigFunction · 0.85

Tested by

no test coverage detected