MCPcopy
hub / github.com/gotify/server / userFromBasicAuth

Method userFromBasicAuth

auth/authentication.go:132–141  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

130}
131
132func (a *Auth) userFromBasicAuth(ctx *gin.Context) (*model.User, error) {
133 if name, pass, ok := ctx.Request.BasicAuth(); ok {
134 if user, err := a.DB.GetUserByName(name); err != nil {
135 return nil, err
136 } else if user != nil && password.ComparePassword(user.Pass, []byte(pass)) {
137 return user, nil
138 }
139 }
140 return nil, nil
141}
142
143func (a *Auth) requireToken(auth authenticate) gin.HandlerFunc {
144 return func(ctx *gin.Context) {

Callers 2

requireTokenMethod · 0.95
OptionalMethod · 0.95

Calls 2

ComparePasswordFunction · 0.92
GetUserByNameMethod · 0.65

Tested by

no test coverage detected