MCPcopy Create free account
hub / github.com/foxcpp/maddy / Configure

Method Configure

internal/auth/external/externalauth.go:64–92  ·  view source on GitHub ↗
(inlineArgs []string, cfg *config.Map)

Source from the content-addressed store, hash-verified

62}
63
64func (ea *ExternalAuth) Configure(inlineArgs []string, cfg *config.Map) error {
65 if len(inlineArgs) != 0 {
66 return errors.New("external: inline arguments are not used")
67 }
68
69 cfg.Bool("debug", false, false, &ea.log.Debug)
70 cfg.Bool("perdomain", false, false, &ea.perDomain)
71 cfg.StringList("domains", false, false, nil, &ea.domains)
72 cfg.String("helper", false, false, "", &ea.helperPath)
73 if _, err := cfg.Process(); err != nil {
74 return err
75 }
76 if ea.perDomain && ea.domains == nil {
77 return errors.New("auth_domains must be set if auth_perdomain is used")
78 }
79
80 if ea.helperPath != "" {
81 ea.log.Debugln("using helper:", ea.helperPath)
82 } else {
83 ea.helperPath = filepath.Join(config.LibexecDirectory, "maddy-auth-helper")
84 }
85 if _, err := os.Stat(ea.helperPath); err != nil {
86 return fmt.Errorf("%s doesn't exist", ea.helperPath)
87 }
88
89 ea.log.Debugln("using helper:", ea.helperPath)
90
91 return nil
92}
93
94func (ea *ExternalAuth) AuthPlain(username, password string) error {
95 accountName, ok := auth.CheckDomainAuth(username, ea.perDomain, ea.domains)

Callers

nothing calls this directly

Calls 5

BoolMethod · 0.80
StringListMethod · 0.80
ProcessMethod · 0.80
DebuglnMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected