-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Context.BasicAuth() convenience method #56
Copy link
Copy link
Closed
Labels
area/apiPublic-facing API surfacePublic-facing API surfaceenhancementNew feature or requestNew feature or requestsize/S~1 day of work~1 day of work
Milestone
Description
Summary
Add Context.BasicAuth() (username, password string, ok bool) that parses the Authorization: Basic <base64> header.
Motivation
While users can already do c.Header("authorization") + manual base64 decode, this is a common enough pattern that a convenience method improves DX. Gin, Echo, and the standard library all provide this.
Scope
- Parse
authorizationheader forBasicscheme. - Base64-decode and split on
:. - Return
(username, password, true)or("", "", false)if not present/invalid. - Implementation: ~10 lines, mirrors
net/http.Request.BasicAuth().
Non-breaking
Additive method on Context. No existing API changes required.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/apiPublic-facing API surfacePublic-facing API surfaceenhancementNew feature or requestNew feature or requestsize/S~1 day of work~1 day of work