MCPcopy Index your code
hub / github.com/foxcpp/maddy / AuthPlain

Method AuthPlain

internal/auth/shadow/module.go:113–139  ·  view source on GitHub ↗
(username, password string)

Source from the content-addressed store, hash-verified

111}
112
113func (a *Auth) AuthPlain(username, password string) error {
114 if a.useHelper {
115 return external.AuthUsingHelper(a.helperPath, username, password)
116 }
117
118 ent, err := Lookup(username)
119 if err != nil {
120 return err
121 }
122
123 if !ent.IsAccountValid() {
124 return fmt.Errorf("shadow: account is expired")
125 }
126
127 if !ent.IsPasswordValid() {
128 return fmt.Errorf("shadow: password is expired")
129 }
130
131 if err := ent.VerifyPassword(password); err != nil {
132 if errors.Is(err, ErrWrongPassword) {
133 return module.ErrUnknownCredentials
134 }
135 return err
136 }
137
138 return nil
139}
140
141func init() {
142 modules.Register("auth.shadow", New)

Callers

nothing calls this directly

Calls 5

AuthUsingHelperFunction · 0.92
LookupFunction · 0.85
IsAccountValidMethod · 0.80
IsPasswordValidMethod · 0.80
VerifyPasswordMethod · 0.80

Tested by

no test coverage detected