|
|
@@ -199,7 +199,7 @@ func TestUserChangePassword(t *testing.T) {
|
|
|
as, tearDown := setupAuthStore(t)
|
|
|
defer tearDown(t)
|
|
|
|
|
|
- ctx1 := context.WithValue(context.WithValue(context.TODO(), "index", uint64(1)), "simpleToken", "dummy")
|
|
|
+ ctx1 := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
|
|
|
_, err := as.Authenticate(ctx1, "foo", "bar")
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
@@ -210,7 +210,7 @@ func TestUserChangePassword(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
|
- ctx2 := context.WithValue(context.WithValue(context.TODO(), "index", uint64(2)), "simpleToken", "dummy")
|
|
|
+ ctx2 := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(2)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
|
|
|
_, err = as.Authenticate(ctx2, "foo", "baz")
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
@@ -461,7 +461,7 @@ func TestAuthInfoFromCtx(t *testing.T) {
|
|
|
t.Errorf("expected (nil, nil), got (%v, %v)", ai, err)
|
|
|
}
|
|
|
|
|
|
- ctx = context.WithValue(context.WithValue(context.TODO(), "index", uint64(1)), "simpleToken", "dummy")
|
|
|
+ ctx = context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
|
|
|
resp, err := as.Authenticate(ctx, "foo", "bar")
|
|
|
if err != nil {
|
|
|
t.Error(err)
|
|
|
@@ -494,7 +494,7 @@ func TestAuthDisable(t *testing.T) {
|
|
|
defer tearDown(t)
|
|
|
|
|
|
as.AuthDisable()
|
|
|
- ctx := context.WithValue(context.WithValue(context.TODO(), "index", uint64(2)), "simpleToken", "dummy")
|
|
|
+ ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(2)), AuthenticateParamSimpleTokenPrefix{}, "dummy")
|
|
|
_, err := as.Authenticate(ctx, "foo", "bar")
|
|
|
if err != ErrAuthNotEnabled {
|
|
|
t.Errorf("expected %v, got %v", ErrAuthNotEnabled, err)
|
|
|
@@ -642,7 +642,7 @@ func TestHammerSimpleAuthenticate(t *testing.T) {
|
|
|
go func(user string) {
|
|
|
defer wg.Done()
|
|
|
token := fmt.Sprintf("%s(%d)", user, i)
|
|
|
- ctx := context.WithValue(context.WithValue(context.TODO(), "index", uint64(1)), "simpleToken", token)
|
|
|
+ ctx := context.WithValue(context.WithValue(context.TODO(), AuthenticateParamIndex{}, uint64(1)), AuthenticateParamSimpleTokenPrefix{}, token)
|
|
|
if _, err := as.Authenticate(ctx, user, "123"); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|