api: Update timestamp type for RefreshTokenRef to int64.
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
// apiVersion increases every time a new call is added to the API. Clients should use this info
|
||||
// to determine if the server supports specific features.
|
||||
const apiVersion = 1
|
||||
const apiVersion = 2
|
||||
|
||||
// NewAPI returns a server which implements the gRPC API interface.
|
||||
func NewAPI(s storage.Storage, logger logrus.FieldLogger) api.DexServer {
|
||||
@@ -226,8 +226,8 @@ func (d dexAPI) ListRefresh(ctx context.Context, req *api.ListRefreshReq) (*api.
|
||||
r := api.RefreshTokenRef{
|
||||
Id: session.ID,
|
||||
ClientId: session.ClientID,
|
||||
CreatedAt: session.CreatedAt.String(),
|
||||
LastUsed: session.LastUsed.String(),
|
||||
CreatedAt: session.CreatedAt.Unix(),
|
||||
LastUsed: session.LastUsed.Unix(),
|
||||
}
|
||||
refreshTokenRefs = append(refreshTokenRefs, &r)
|
||||
}
|
||||
|
@@ -146,10 +146,21 @@ func TestRefreshToken(t *testing.T) {
|
||||
UserId: subjectString,
|
||||
}
|
||||
|
||||
if _, err := serv.ListRefresh(ctx, &listReq); err != nil {
|
||||
listResp, err := serv.ListRefresh(ctx, &listReq)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to list refresh tokens for user: %v", err)
|
||||
}
|
||||
|
||||
for _, tok := range listResp.RefreshTokens {
|
||||
if tok.CreatedAt != r.CreatedAt.Unix() {
|
||||
t.Errorf("Expected CreatedAt timestamp %v, got %v", r.CreatedAt.Unix(), tok.CreatedAt)
|
||||
}
|
||||
|
||||
if tok.LastUsed != r.LastUsed.Unix() {
|
||||
t.Errorf("Expected LastUsed timestamp %v, got %v", r.LastUsed.Unix(), tok.LastUsed)
|
||||
}
|
||||
}
|
||||
|
||||
revokeReq := api.RevokeRefreshReq{
|
||||
UserId: subjectString,
|
||||
ClientId: r.ClientID,
|
||||
|
Reference in New Issue
Block a user