mirror of
https://github.com/volatiletech/authboss.git
synced 2025-01-08 04:03:53 +02:00
Fix breakages from last commit
This commit is contained in:
parent
37ace55579
commit
634892e29c
@ -128,7 +128,7 @@ func TestAuthPostSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.auth.LoginPost(w, r); err != nil {
|
if err := h.auth.LoginPost(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -175,7 +175,7 @@ func TestAuthPostSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.auth.LoginPost(w, r); err != nil {
|
if err := h.auth.LoginPost(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -209,7 +209,7 @@ func TestAuthPostSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.auth.LoginPost(w, r); err != nil {
|
if err := h.auth.LoginPost(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -253,7 +253,7 @@ func TestAuthPostBadPassword(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
var afterCalled bool
|
var afterCalled bool
|
||||||
h.ab.Events.After(authboss.EventAuthFail, func(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
h.ab.Events.After(authboss.EventAuthFail, func(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
@ -288,7 +288,7 @@ func TestAuthPostBadPassword(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
var afterCalled bool
|
var afterCalled bool
|
||||||
h.ab.Events.After(authboss.EventAuthFail, func(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
h.ab.Events.After(authboss.EventAuthFail, func(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
@ -328,7 +328,7 @@ func TestAuthPostUserNotFound(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := harness.ab.NewResponse(resp, r)
|
w := harness.ab.NewResponse(resp)
|
||||||
|
|
||||||
// This event is really the only thing that separates "user not found" from "bad password"
|
// This event is really the only thing that separates "user not found" from "bad password"
|
||||||
var afterCalled bool
|
var afterCalled bool
|
||||||
|
@ -56,7 +56,7 @@ type ClientStateReadWriter interface {
|
|||||||
// any values in the current session, or any cookie in the request
|
// any values in the current session, or any cookie in the request
|
||||||
ReadState(*http.Request) (ClientState, error)
|
ReadState(*http.Request) (ClientState, error)
|
||||||
// WriteState can sometimes be called with a nil ClientState in the event
|
// WriteState can sometimes be called with a nil ClientState in the event
|
||||||
// that no ClientState was recovered from the request context.
|
// that no ClientState was read in from LoadClientState
|
||||||
WriteState(http.ResponseWriter, ClientState, []ClientStateEvent) error
|
WriteState(http.ResponseWriter, ClientState, []ClientStateEvent) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ func (c *Confirm) Init(ab *authboss.Authboss) (err error) {
|
|||||||
func (c *Confirm) PreventAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
func (c *Confirm) PreventAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
logger := c.Authboss.RequestLogger(r)
|
logger := c.Authboss.RequestLogger(r)
|
||||||
|
|
||||||
user, err := c.Authboss.CurrentUser(w, r)
|
user, err := c.Authboss.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ func (c *Confirm) PreventAuth(w http.ResponseWriter, r *http.Request, handled bo
|
|||||||
// StartConfirmationWeb hijacks a request and forces a user to be confirmed first
|
// StartConfirmationWeb hijacks a request and forces a user to be confirmed first
|
||||||
// it's assumed that the current user is loaded into the request context.
|
// it's assumed that the current user is loaded into the request context.
|
||||||
func (c *Confirm) StartConfirmationWeb(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
func (c *Confirm) StartConfirmationWeb(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
user, err := c.Authboss.CurrentUser(w, r)
|
user, err := c.Authboss.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ func (c *Confirm) Get(w http.ResponseWriter, r *http.Request) error {
|
|||||||
func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
|
func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
|
||||||
return func(next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
user := ab.LoadCurrentUserP(w, &r)
|
user := ab.LoadCurrentUserP(&r)
|
||||||
|
|
||||||
cu := authboss.MustBeConfirmable(user)
|
cu := authboss.MustBeConfirmable(user)
|
||||||
if cu.GetConfirmed() {
|
if cu.GetConfirmed() {
|
||||||
|
@ -195,7 +195,7 @@ func TestResponseRedirectNonAPI(t *testing.T) {
|
|||||||
ab := authboss.New()
|
ab := authboss.New()
|
||||||
ab.Config.Storage.SessionState = mocks.NewClientRW()
|
ab.Config.Storage.SessionState = mocks.NewClientRW()
|
||||||
ab.Config.Storage.CookieState = mocks.NewClientRW()
|
ab.Config.Storage.CookieState = mocks.NewClientRW()
|
||||||
aw := ab.NewResponse(w, r)
|
aw := ab.NewResponse(w)
|
||||||
|
|
||||||
ro := authboss.RedirectOptions{
|
ro := authboss.RedirectOptions{
|
||||||
Success: "success", Failure: "failure",
|
Success: "success", Failure: "failure",
|
||||||
@ -234,7 +234,7 @@ func TestResponseRedirectNonAPIFollowRedir(t *testing.T) {
|
|||||||
ab := authboss.New()
|
ab := authboss.New()
|
||||||
ab.Config.Storage.SessionState = mocks.NewClientRW()
|
ab.Config.Storage.SessionState = mocks.NewClientRW()
|
||||||
ab.Config.Storage.CookieState = mocks.NewClientRW()
|
ab.Config.Storage.CookieState = mocks.NewClientRW()
|
||||||
aw := ab.NewResponse(w, r)
|
aw := ab.NewResponse(w)
|
||||||
|
|
||||||
ro := authboss.RedirectOptions{
|
ro := authboss.RedirectOptions{
|
||||||
RedirectPath: "/redirect", FollowRedirParam: true,
|
RedirectPath: "/redirect", FollowRedirParam: true,
|
||||||
|
@ -22,7 +22,7 @@ func TestExpireIsExpired(t *testing.T) {
|
|||||||
r := httptest.NewRequest("GET", "/", nil)
|
r := httptest.NewRequest("GET", "/", nil)
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyPID, "primaryid"))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyPID, "primaryid"))
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, struct{}{}))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, struct{}{}))
|
||||||
w := ab.NewResponse(httptest.NewRecorder(), r)
|
w := ab.NewResponse(httptest.NewRecorder())
|
||||||
r, err := ab.LoadClientState(w, r)
|
r, err := ab.LoadClientState(w, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -79,7 +79,7 @@ func TestExpireNotExpired(t *testing.T) {
|
|||||||
r := httptest.NewRequest("GET", "/", nil)
|
r := httptest.NewRequest("GET", "/", nil)
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyPID, "primaryid"))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyPID, "primaryid"))
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, struct{}{}))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, struct{}{}))
|
||||||
w := ab.NewResponse(httptest.NewRecorder(), r)
|
w := ab.NewResponse(httptest.NewRecorder())
|
||||||
r, err = ab.LoadClientState(w, r)
|
r, err = ab.LoadClientState(w, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -144,7 +144,7 @@ func TestExpireRefreshExpiry(t *testing.T) {
|
|||||||
clientRW := mocks.NewClientRW()
|
clientRW := mocks.NewClientRW()
|
||||||
ab.Storage.SessionState = clientRW
|
ab.Storage.SessionState = clientRW
|
||||||
r := httptest.NewRequest("GET", "/", nil)
|
r := httptest.NewRequest("GET", "/", nil)
|
||||||
w := ab.NewResponse(httptest.NewRecorder(), r)
|
w := ab.NewResponse(httptest.NewRecorder())
|
||||||
|
|
||||||
RefreshExpiry(w, r)
|
RefreshExpiry(w, r)
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
|
@ -236,7 +236,7 @@ func NewClientRW() *ClientStateRW {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReadState from memory
|
// ReadState from memory
|
||||||
func (c *ClientStateRW) ReadState(http.ResponseWriter, *http.Request) (authboss.ClientState, error) {
|
func (c *ClientStateRW) ReadState(*http.Request) (authboss.ClientState, error) {
|
||||||
return &ClientState{Values: c.ClientValues}, nil
|
return &ClientState{Values: c.ClientValues}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ func (l *Lock) Init(ab *authboss.Authboss) error {
|
|||||||
|
|
||||||
// BeforeAuth ensures the account is not locked.
|
// BeforeAuth ensures the account is not locked.
|
||||||
func (l *Lock) BeforeAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
func (l *Lock) BeforeAuth(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
user, err := l.Authboss.CurrentUser(w, r)
|
user, err := l.Authboss.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ func (l *Lock) BeforeAuth(w http.ResponseWriter, r *http.Request, handled bool)
|
|||||||
|
|
||||||
// AfterAuthSuccess resets the attempt number field.
|
// AfterAuthSuccess resets the attempt number field.
|
||||||
func (l *Lock) AfterAuthSuccess(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
func (l *Lock) AfterAuthSuccess(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
user, err := l.Authboss.CurrentUser(w, r)
|
user, err := l.Authboss.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ func (l *Lock) AfterAuthSuccess(w http.ResponseWriter, r *http.Request, handled
|
|||||||
// AfterAuthFail adjusts the attempt number and time negatively
|
// AfterAuthFail adjusts the attempt number and time negatively
|
||||||
// and locks the user if they're beyond limits.
|
// and locks the user if they're beyond limits.
|
||||||
func (l *Lock) AfterAuthFail(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
func (l *Lock) AfterAuthFail(w http.ResponseWriter, r *http.Request, handled bool) (bool, error) {
|
||||||
user, err := l.Authboss.CurrentUser(w, r)
|
user, err := l.Authboss.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ func (l *Lock) Unlock(ctx context.Context, key string) error {
|
|||||||
func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
|
func Middleware(ab *authboss.Authboss) func(http.Handler) http.Handler {
|
||||||
return func(next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
user := ab.LoadCurrentUserP(w, &r)
|
user := ab.LoadCurrentUserP(&r)
|
||||||
|
|
||||||
lu := authboss.MustBeLockable(user)
|
lu := authboss.MustBeLockable(user)
|
||||||
if IsLocked(lu) {
|
if IsLocked(lu) {
|
||||||
|
@ -40,7 +40,7 @@ func (l *Logout) Logout(w http.ResponseWriter, r *http.Request) error {
|
|||||||
|
|
||||||
// TODO(aarondl): Evaluate this log messages usefulness, there's no other reason
|
// TODO(aarondl): Evaluate this log messages usefulness, there's no other reason
|
||||||
// to pull the user out of the context here.
|
// to pull the user out of the context here.
|
||||||
user, err := l.CurrentUser(w, r)
|
user, err := l.CurrentUser(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func TestLogoutLogout(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
// This enables the logging portion, which is debatable-y not useful in a log out method
|
// This enables the logging portion, which is debatable-y not useful in a log out method
|
||||||
user := &mocks.User{Email: "test@test.com"}
|
user := &mocks.User{Email: "test@test.com"}
|
||||||
|
@ -284,7 +284,7 @@ func TestEndPostSuccessLogin(t *testing.T) {
|
|||||||
r := mocks.Request("GET")
|
r := mocks.Request("GET")
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
if err := h.recover.EndPost(h.ab.NewResponse(w, r), r); err != nil {
|
if err := h.recover.EndPost(h.ab.NewResponse(w), r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ func TestRegisterPostSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.reg.Post(w, r); err != nil {
|
if err := h.reg.Post(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -161,7 +161,7 @@ func TestRegisterPostSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.reg.Post(w, r); err != nil {
|
if err := h.reg.Post(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -205,7 +205,7 @@ func TestRegisterPostValidationFailure(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.reg.Post(w, r); err != nil {
|
if err := h.reg.Post(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -256,7 +256,7 @@ func TestRegisterPostUserExists(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
resp := httptest.NewRecorder()
|
resp := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(resp, r)
|
w := h.ab.NewResponse(resp)
|
||||||
|
|
||||||
if err := h.reg.Post(w, r); err != nil {
|
if err := h.reg.Post(w, r); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -51,7 +51,7 @@ func (r *Remember) RememberAfterAuth(w http.ResponseWriter, req *http.Request, h
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
user := r.Authboss.CurrentUserP(w, req)
|
user := r.Authboss.CurrentUserP(req)
|
||||||
hash, token, err := GenerateToken(user.GetPID())
|
hash, token, err := GenerateToken(user.GetPID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -190,7 +190,7 @@ func Authenticate(ab *authboss.Authboss, w http.ResponseWriter, req *http.Reques
|
|||||||
// AfterPasswordReset is called after the password has been reset, since
|
// AfterPasswordReset is called after the password has been reset, since
|
||||||
// it should invalidate all tokens associated to that user.
|
// it should invalidate all tokens associated to that user.
|
||||||
func (r *Remember) AfterPasswordReset(w http.ResponseWriter, req *http.Request, handled bool) (bool, error) {
|
func (r *Remember) AfterPasswordReset(w http.ResponseWriter, req *http.Request, handled bool) (bool, error) {
|
||||||
user, err := r.Authboss.CurrentUser(w, req)
|
user, err := r.Authboss.CurrentUser(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ func TestRememberAfterAuth(t *testing.T) {
|
|||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyValues, mocks.Values{Remember: true}))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyValues, mocks.Values{Remember: true}))
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, user))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, user))
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
if handled, err := h.remember.RememberAfterAuth(w, r, false); err != nil {
|
if handled, err := h.remember.RememberAfterAuth(w, r, false); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -89,7 +89,7 @@ func TestRememberAfterAuthSkip(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
if handled, err := h.remember.RememberAfterAuth(w, r, false); err != nil {
|
if handled, err := h.remember.RememberAfterAuth(w, r, false); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -128,7 +128,7 @@ func TestMiddlewareAuth(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
r, err = h.ab.LoadClientState(w, r)
|
r, err = h.ab.LoadClientState(w, r)
|
||||||
@ -168,7 +168,7 @@ func TestAuthenticateSuccess(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
r, err = h.ab.LoadClientState(w, r)
|
r, err = h.ab.LoadClientState(w, r)
|
||||||
@ -213,7 +213,7 @@ func TestAuthenticateTokenNotFound(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
r, err = h.ab.LoadClientState(w, r)
|
r, err = h.ab.LoadClientState(w, r)
|
||||||
@ -246,7 +246,7 @@ func TestAuthenticateBadTokens(t *testing.T) {
|
|||||||
|
|
||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
r, err = h.ab.LoadClientState(w, r)
|
r, err = h.ab.LoadClientState(w, r)
|
||||||
@ -295,7 +295,7 @@ func TestAfterPasswordReset(t *testing.T) {
|
|||||||
r := mocks.Request("POST")
|
r := mocks.Request("POST")
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, user))
|
r = r.WithContext(context.WithValue(r.Context(), authboss.CTXKeyUser, user))
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
w := h.ab.NewResponse(rec, r)
|
w := h.ab.NewResponse(rec)
|
||||||
|
|
||||||
if handled, err := h.remember.AfterPasswordReset(w, r, false); err != nil {
|
if handled, err := h.remember.AfterPasswordReset(w, r, false); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user