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

welovemedia / ffmate / 18133447417

30 Sep 2025 02:30PM UTC coverage: 63.929% (-0.05%) from 63.979%
18133447417

push

github

YoSev
feat: add basic-auth support

39 of 55 new or added lines in 9 files covered. (70.91%)

2226 of 3482 relevant lines covered (63.93%)

13.19 hits per line

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

60.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, _ *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": err.Error(),
×
NEW
16
        })
×
NEW
17
}
×
18

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

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

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

© 2026 Coveralls, Inc