(inlineArgs []string, cfg *config.Map)
| 62 | } |
| 63 | |
| 64 | func (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 | |
| 94 | func (ea *ExternalAuth) AuthPlain(username, password string) error { |
| 95 | accountName, ok := auth.CheckDomainAuth(username, ea.perDomain, ea.domains) |
nothing calls this directly
no test coverage detected