• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

welovemedia / ffmate / 18131843139

30 Sep 2025 01:37PM UTC coverage: 63.561% (-0.4%) from 63.979%
18131843139

Pull #24

github

YoSev
feat: add basic-auth support
Pull Request #24: feat: add basic-auth support

20 of 46 new or added lines in 6 files covered. (43.48%)

6 existing lines in 1 file now uncovered.

2210 of 3477 relevant lines covered (63.56%)

12.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/middleware/basicAuth.go
1
package middleware
2

3
import (
4
        "goyave.dev/goyave/v5"
5
        "goyave.dev/goyave/v5/auth"
6
)
7

8
type CustomConfigBasicAuthenticator struct {
9
        auth.Authenticator[auth.BasicUser] // interface
10
}
11

NEW
12
func (a *CustomConfigBasicAuthenticator) OnUnauthorized(response *goyave.Response, request *goyave.Request, err error) {
×
NEW
13
        response.Header().Add("WWW-Authenticate", `Basic realm="ffmate"`)
×
NEW
14
        response.JSON(401, map[string]any{
×
NEW
15
                "error": "missing basic authorization header or provided invalid credentials",
×
NEW
16
        })
×
NEW
17
}
×
18

NEW
19
func ConfigCustomBasicAuth() *auth.Handler[auth.BasicUser] {
×
NEW
20
        handler := auth.ConfigBasicAuth()
×
NEW
21

×
NEW
22
        handler.Authenticator = &CustomConfigBasicAuthenticator{
×
NEW
23
                Authenticator: auth.ConfigBasicAuth(),
×
NEW
24
        }
×
NEW
25

×
NEW
26
        return handler
×
NEW
27
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc