Skip to content

Commit

Permalink
Revert "Fix etcd device requests (dexidp#3119)"
Browse files Browse the repository at this point in the history
This reverts commit dddbe19.
  • Loading branch information
mdpradeep committed Oct 20, 2023
1 parent 03e446a commit 17941fb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ jobs:
services:
postgres:
image: postgres:10.8
env:
TZ: UTC
ports:
- 5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

postgres-ent:
image: postgres:10.8
env:
TZ: UTC
ports:
- 5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand Down
10 changes: 1 addition & 9 deletions storage/conformance/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/kylelemons/godebug/pretty"
"github.com/stretchr/testify/require"
"golang.org/x/crypto/bcrypt"
jose "gopkg.in/square/go-jose.v2"

Expand Down Expand Up @@ -981,7 +980,7 @@ func testDeviceRequestCRUD(t *testing.T, s storage.Storage) {
ClientID: "client1",
ClientSecret: "secret1",
Scopes: []string{"openid", "email"},
Expiry: neverExpire.Round(time.Second),
Expiry: neverExpire,
}

if err := s.CreateDeviceRequest(d1); err != nil {
Expand All @@ -992,13 +991,6 @@ func testDeviceRequestCRUD(t *testing.T, s storage.Storage) {
err := s.CreateDeviceRequest(d1)
mustBeErrAlreadyExists(t, "device request", err)

got, err := s.GetDeviceRequest(d1.UserCode)
if err != nil {
t.Fatalf("failed to get device request: %v", err)
}

require.Equal(t, d1, got)

// No manual deletes for device requests, will be handled by garbage collection routines
// see testGC
}
Expand Down
7 changes: 2 additions & 5 deletions storage/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,8 @@ func (c *conn) CreateDeviceRequest(d storage.DeviceRequest) error {
func (c *conn) GetDeviceRequest(userCode string) (r storage.DeviceRequest, err error) {
ctx, cancel := context.WithTimeout(context.Background(), defaultStorageTimeout)
defer cancel()
var dr DeviceRequest
if err = c.getKey(ctx, keyID(deviceRequestPrefix, userCode), &dr); err == nil {
r = toStorageDeviceRequest(dr)
}
return
err = c.getKey(ctx, keyID(deviceRequestPrefix, userCode), &r)
return r, err
}

func (c *conn) listDeviceRequests(ctx context.Context) (requests []DeviceRequest, err error) {
Expand Down
11 changes: 0 additions & 11 deletions storage/etcd/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,6 @@ func fromStorageDeviceRequest(d storage.DeviceRequest) DeviceRequest {
}
}

func toStorageDeviceRequest(d DeviceRequest) storage.DeviceRequest {
return storage.DeviceRequest{
UserCode: d.UserCode,
DeviceCode: d.DeviceCode,
ClientID: d.ClientID,
ClientSecret: d.ClientSecret,
Scopes: d.Scopes,
Expiry: d.Expiry,
}
}

// DeviceToken is a mirrored struct from storage with JSON struct tags
type DeviceToken struct {
DeviceCode string `json:"device_code"`
Expand Down

0 comments on commit 17941fb

Please sign in to comment.