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.
|
// Use NewBasicRequestAuthenticator for sane defaults.
|
||||||
type BasicRequestAuthenticator struct {
|
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 enables HTTP Basic Auth (Authorization: Basic …).
|
||||||
BasicAuth bool
|
BasicAuth bool
|
||||||
|
|
||||||
@ -46,10 +50,6 @@ type BasicRequestAuthenticator struct {
|
|||||||
// }
|
// }
|
||||||
BasicRealm string
|
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>".
|
// AuthorizationSchemes lists accepted schemes for "Authorization: <scheme> <token>".
|
||||||
// nil or an empty slice skips the Authorization header entirely;
|
// nil or an empty slice skips the Authorization header entirely;
|
||||||
// ["*"] accepts any scheme; ["Bearer", "Token"] restricts to those schemes.
|
// ["*"] accepts any scheme; ["Bearer", "Token"] restricts to those schemes.
|
||||||
@ -76,8 +76,9 @@ type BasicRequestAuthenticator struct {
|
|||||||
// http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
// http.Error(w, "Unauthorized", http.StatusUnauthorized)
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
func NewBasicRequestAuthenticator() *BasicRequestAuthenticator {
|
func NewBasicRequestAuthenticator(auth BasicAuthenticator) *BasicRequestAuthenticator {
|
||||||
return &BasicRequestAuthenticator{
|
return &BasicRequestAuthenticator{
|
||||||
|
Authenticator: auth,
|
||||||
BasicAuth: true,
|
BasicAuth: true,
|
||||||
BasicRealm: "Basic",
|
BasicRealm: "Basic",
|
||||||
AuthorizationSchemes: []string{"Bearer", "Token"},
|
AuthorizationSchemes: []string{"Bearer", "Token"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user