mirror of
https://github.com/therootcompany/golib.git
synced 2026-03-13 12:27:59 +00:00
fix(auth): add missing arg to NewBasicRequestAuthenticator
This commit is contained in:
parent
846d14baf5
commit
92f865912a
@ -29,6 +29,10 @@ var ErrNoCredentials = errors.New("no credentials provided")
|
||||
//
|
||||
// Use NewBasicRequestAuthenticator for sane defaults.
|
||||
type BasicRequestAuthenticator struct {
|
||||
// Authenticator is the credential verifier called with the extracted
|
||||
// username/password or token. Must be set before calling Authenticate.
|
||||
Authenticator BasicAuthenticator
|
||||
|
||||
// BasicAuth enables HTTP Basic Auth (Authorization: Basic …).
|
||||
BasicAuth bool
|
||||
|
||||
@ -46,10 +50,6 @@ type BasicRequestAuthenticator struct {
|
||||
// }
|
||||
BasicRealm string
|
||||
|
||||
// Authenticator is the credential verifier called with the extracted
|
||||
// username/password or token. Must be set before calling Authenticate.
|
||||
Authenticator BasicAuthenticator
|
||||
|
||||
// AuthorizationSchemes lists accepted schemes for "Authorization: <scheme> <token>".
|
||||
// nil or an empty slice skips the Authorization header entirely;
|
||||
// ["*"] accepts any scheme; ["Bearer", "Token"] restricts to those schemes.
|
||||
@ -76,8 +76,9 @@ type BasicRequestAuthenticator struct {
|
||||
// http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||
// return
|
||||
// }
|
||||
func NewBasicRequestAuthenticator() *BasicRequestAuthenticator {
|
||||
func NewBasicRequestAuthenticator(auth BasicAuthenticator) *BasicRequestAuthenticator {
|
||||
return &BasicRequestAuthenticator{
|
||||
Authenticator: auth,
|
||||
BasicAuth: true,
|
||||
BasicRealm: "Basic",
|
||||
AuthorizationSchemes: []string{"Bearer", "Token"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user