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

welovemedia / ffmate / 18131968375

30 Sep 2025 01:42PM UTC coverage: 63.368% (-0.6%) from 63.979%
18131968375

Pull #24

github

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

20 of 47 new or added lines in 7 files covered. (42.55%)

10 existing lines in 1 file now uncovered.

2209 of 3486 relevant lines covered (63.37%)

12.92 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, _ *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

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