(username string)
| 116 | } |
| 117 | |
| 118 | func (auth *AuthService) SearchUser(username string) config.UserSearch { |
| 119 | if auth.GetLocalUser(username).Username != "" { |
| 120 | return config.UserSearch{ |
| 121 | Username: username, |
| 122 | Type: "local", |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | if auth.ldap.IsConfigured() { |
| 127 | userDN, err := auth.ldap.GetUserDN(username) |
| 128 | |
| 129 | if err != nil { |
| 130 | tlog.App.Warn().Err(err).Str("username", username).Msg("Failed to search for user in LDAP") |
| 131 | return config.UserSearch{ |
| 132 | Type: "unknown", |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | return config.UserSearch{ |
| 137 | Username: userDN, |
| 138 | Type: "ldap", |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | return config.UserSearch{ |
| 143 | Type: "unknown", |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | func (auth *AuthService) VerifyUser(search config.UserSearch, password string) bool { |
| 148 | switch search.Type { |
no test coverage detected