Updates based on dexidp pr
Signed-off-by: justin-slowik <justin.slowik@thermofisher.com>
This commit is contained in:
parent
f91f294385
commit
1404477326
4 changed files with 7 additions and 5 deletions
|
@ -31,6 +31,7 @@ var requiredTmpls = []string{
|
||||||
tmplOOB,
|
tmplOOB,
|
||||||
tmplError,
|
tmplError,
|
||||||
tmplDevice,
|
tmplDevice,
|
||||||
|
tmplDeviceSuccess,
|
||||||
}
|
}
|
||||||
|
|
||||||
type templates struct {
|
type templates struct {
|
||||||
|
|
|
@ -1027,9 +1027,9 @@ func testDeviceTokenCRUD(t *testing.T, s storage.Storage) {
|
||||||
|
|
||||||
//Validate expected result set
|
//Validate expected result set
|
||||||
if got.Status != "complete" {
|
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" {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ var migrations = []migration{
|
||||||
create table device_token (
|
create table device_token (
|
||||||
device_code text not null primary key,
|
device_code text not null primary key,
|
||||||
status text not null,
|
status text not null,
|
||||||
token text,
|
token bytea,
|
||||||
expiry timestamptz not null,
|
expiry timestamptz not null,
|
||||||
last_request timestamptz not null,
|
last_request timestamptz not null,
|
||||||
poll_interval integer not null
|
poll_interval integer not null
|
||||||
|
|
|
@ -39,7 +39,7 @@ func NewID() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSecureID(len int) 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 {
|
if _, err := io.ReadFull(rand.Reader, buff); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,8 @@ type Storage interface {
|
||||||
UpdateConnector(id string, updater func(c Connector) (Connector, error)) error
|
UpdateConnector(id string, updater func(c Connector) (Connector, error)) error
|
||||||
UpdateDeviceToken(deviceCode string, updater func(t DeviceToken) (DeviceToken, 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)
|
GarbageCollect(now time.Time) (GCResult, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue