MCPcopy Index your code
hub / github.com/filebrowser/filebrowser / getJSONAuth

Function getJSONAuth

cmd/config.go:117–154  ·  view source on GitHub ↗
(flags *pflag.FlagSet, defaultAuther map[string]interface{})

Source from the content-addressed store, hash-verified

115}
116
117func getJSONAuth(flags *pflag.FlagSet, defaultAuther map[string]interface{}) (auth.Auther, error) {
118 jsonAuth := &auth.JSONAuth{}
119 host, err := flags.GetString("recaptcha.host")
120 if err != nil {
121 return nil, err
122 }
123
124 key, err := flags.GetString("recaptcha.key")
125 if err != nil {
126 return nil, err
127 }
128
129 secret, err := flags.GetString("recaptcha.secret")
130 if err != nil {
131 return nil, err
132 }
133
134 if key == "" {
135 if kmap, ok := defaultAuther["recaptcha"].(map[string]interface{}); ok {
136 key = kmap["key"].(string)
137 }
138 }
139
140 if secret == "" {
141 if smap, ok := defaultAuther["recaptcha"].(map[string]interface{}); ok {
142 secret = smap["secret"].(string)
143 }
144 }
145
146 if key != "" && secret != "" {
147 jsonAuth.ReCaptcha = &auth.ReCaptcha{
148 Host: host,
149 Key: key,
150 Secret: secret,
151 }
152 }
153 return jsonAuth, nil
154}
155
156func getHookAuth(flags *pflag.FlagSet, defaultAuther map[string]interface{}) (auth.Auther, error) {
157 command, err := flags.GetString("auth.command")

Callers 1

getAuthenticationFunction · 0.85

Calls 1

GetStringMethod · 0.80

Tested by

no test coverage detected