diff options
| author | ivar <i@oiee.no> | 2026-04-03 14:19:55 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2026-04-03 14:19:55 +0200 |
| commit | a8914a8f18c345e934bce93b37845a9dfe0ad73e (patch) | |
| tree | 09f23ff0398c4ecf7d1c4296cf69150ec977f415 /.gitmodules | |
| parent | 6797cafba0059558da475426f9ca69299dd956b5 (diff) | |
| download | nebbet.no-a8914a8f18c345e934bce93b37845a9dfe0ad73e.tar.xz nebbet.no-a8914a8f18c345e934bce93b37845a9dfe0ad73e.zip | |
refactor: implement auth middleware for Gin
Replace the old checkAuth() method with a Gin middleware function that validates
Basic Auth credentials. The authMiddleware() now handles authentication at the
middleware level rather than per-handler, supporting graceful degradation when
no auth file is configured.
The middleware:
- Skips auth if AuthFile is empty or doesn't exist
- Extracts Basic Auth credentials from the request
- Verifies credentials using the auth package
- Returns 401 with WWW-Authenticate header on failure
- Calls c.Next() to pass control to handlers on success
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to '.gitmodules')
0 files changed, 0 insertions, 0 deletions
