Updates based on dexidp pr

Signed-off-by: justin-slowik <justin.slowik@thermofisher.com>
This commit is contained in:
justin-slowik 2020-06-02 14:39:30 -04:00
parent f91f294385
commit 1404477326
4 changed files with 7 additions and 5 deletions

View File

@ -31,6 +31,7 @@ var requiredTmpls = []string{
tmplOOB,
tmplError,
tmplDevice,
tmplDeviceSuccess,
}
type templates struct {

View File

@ -1027,9 +1027,9 @@ func testDeviceTokenCRUD(t *testing.T, s storage.Storage) {
//Validate expected result set
if got.Status != "complete" {
t.Fatalf("update failed, wanted token status=%#v got %#v", "complete", got.Status)
t.Fatalf("update failed, wanted token status=%v got %v", "complete", got.Status)
}
if got.Token != "token data" {
t.Fatalf("update failed, wanted token =%#v got %#v", "token data", got.Token)
t.Fatalf("update failed, wanted token =%v got %v", "token data", got.Token)
}
}

View File

@ -243,7 +243,7 @@ var migrations = []migration{
create table device_token (
device_code text not null primary key,
status text not null,
token text,
token bytea,
expiry timestamptz not null,
last_request timestamptz not null,
poll_interval integer not null

View File

@ -39,7 +39,7 @@ func NewID() string {
}
func newSecureID(len int) string {
buff := make([]byte, len) // 128 bit random ID.
buff := make([]byte, len) // random ID.
if _, err := io.ReadFull(rand.Reader, buff); err != nil {
panic(err)
}
@ -122,7 +122,8 @@ type Storage interface {
UpdateConnector(id string, updater func(c Connector) (Connector, error)) error
UpdateDeviceToken(deviceCode string, updater func(t DeviceToken) (DeviceToken, error)) error
// GarbageCollect deletes all expired AuthCodes,AuthRequests, DeviceRequests, and DeviceTokens.
// GarbageCollect deletes all expired AuthCodes,
// AuthRequests, DeviceRequests, and DeviceTokens.
GarbageCollect(now time.Time) (GCResult, error)
}