MCPcopy
hub / github.com/tinyauthapp/tinyauth / SearchUser

Method SearchUser

internal/service/auth_service.go:118–145  ·  view source on GitHub ↗
(username string)

Source from the content-addressed store, hash-verified

116}
117
118func (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
147func (auth *AuthService) VerifyUser(search config.UserSearch, password string) bool {
148 switch search.Type {

Callers 2

MiddlewareMethod · 0.80
loginHandlerMethod · 0.80

Calls 3

GetLocalUserMethod · 0.95
GetUserDNMethod · 0.80
IsConfiguredMethod · 0.45

Tested by

no test coverage detected