From 921090f05f994d4a04928ff21e23200937bb7eaa Mon Sep 17 00:00:00 2001 From: rithu john Date: Fri, 17 Mar 2017 15:01:21 -0700 Subject: [PATCH] api: Update timestamp type for RefreshTokenRef to int64. --- api/api.pb.go | 110 ++++++++++++++++++++++++--------------------- api/api.proto | 4 +- server/api.go | 6 +-- server/api_test.go | 13 +++++- 4 files changed, 75 insertions(+), 58 deletions(-) diff --git a/api/api.pb.go b/api/api.pb.go index 43bb6247..0671884d 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -115,7 +115,7 @@ func (m *DeleteClientReq) String() string { return proto.CompactTextS func (*DeleteClientReq) ProtoMessage() {} func (*DeleteClientReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } -// DeleteClientResp determines if the. +// DeleteClientResp determines if the client is deleted successfully. type DeleteClientResp struct { NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound" json:"not_found,omitempty"` } @@ -263,8 +263,8 @@ type RefreshTokenRef struct { // ID of the refresh token. Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId" json:"client_id,omitempty"` - CreatedAt string `protobuf:"bytes,3,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` - LastUsed string `protobuf:"bytes,4,opt,name=last_used,json=lastUsed" json:"last_used,omitempty"` + CreatedAt int64 `protobuf:"varint,5,opt,name=created_at,json=createdAt" json:"created_at,omitempty"` + LastUsed int64 `protobuf:"varint,6,opt,name=last_used,json=lastUsed" json:"last_used,omitempty"` } func (m *RefreshTokenRef) Reset() { *m = RefreshTokenRef{} } @@ -300,6 +300,7 @@ func (m *ListRefreshResp) GetRefreshTokens() []*RefreshTokenRef { return nil } +// RevokeRefreshReq is a request to revoke the refresh token of the user-client pair. type RevokeRefreshReq struct { // The "sub" claim returned in the ID Token. UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"` @@ -311,7 +312,9 @@ func (m *RevokeRefreshReq) String() string { return proto.CompactText func (*RevokeRefreshReq) ProtoMessage() {} func (*RevokeRefreshReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +// RevokeRefreshResp determines if the refresh token is revoked successfully. type RevokeRefreshResp struct { + // Set to true is refresh token was not found and token could not be revoked. NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound" json:"not_found,omitempty"` } @@ -372,6 +375,7 @@ type DexClient interface { // ListRefresh lists all the refresh token entries for a particular user. ListRefresh(ctx context.Context, in *ListRefreshReq, opts ...grpc.CallOption) (*ListRefreshResp, error) // RevokeRefresh revokes the refresh token for the provided user-client pair. + // // Note that each user-client pair can have only one refresh token at a time. RevokeRefresh(ctx context.Context, in *RevokeRefreshReq, opts ...grpc.CallOption) (*RevokeRefreshResp, error) } @@ -485,6 +489,7 @@ type DexServer interface { // ListRefresh lists all the refresh token entries for a particular user. ListRefresh(context.Context, *ListRefreshReq) (*ListRefreshResp, error) // RevokeRefresh revokes the refresh token for the provided user-client pair. + // // Note that each user-client pair can have only one refresh token at a time. RevokeRefresh(context.Context, *RevokeRefreshReq) (*RevokeRefreshResp, error) } @@ -703,54 +708,55 @@ var _Dex_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("api/api.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 781 bytes of a gzipped FileDescriptorProto + // 786 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x55, 0x6d, 0x4f, 0xdb, 0x48, - 0x10, 0xce, 0x1b, 0x89, 0x33, 0x79, 0xdf, 0xe3, 0xc5, 0x04, 0x9d, 0x04, 0x8b, 0x4e, 0x02, 0x9d, - 0x04, 0x07, 0x27, 0xb5, 0x52, 0x51, 0x69, 0x2b, 0x68, 0x0b, 0x52, 0x55, 0x21, 0xab, 0xe9, 0xc7, - 0x5a, 0x26, 0x1e, 0x60, 0x85, 0xb1, 0xdd, 0xdd, 0x0d, 0xa1, 0xfd, 0x77, 0x55, 0xff, 0x58, 0xb5, - 0xeb, 0x4d, 0xb0, 0x9d, 0xb4, 0xe1, 0x9b, 0xe7, 0xd9, 0x99, 0x67, 0x76, 0x9e, 0x9d, 0x19, 0x43, - 0xcb, 0x8b, 0xd9, 0xbe, 0x17, 0xb3, 0xbd, 0x98, 0x47, 0x32, 0x22, 0x65, 0x2f, 0x66, 0xf4, 0x47, - 0x11, 0xaa, 0x27, 0x01, 0xc3, 0x50, 0x92, 0x36, 0x94, 0x98, 0x6f, 0x17, 0x37, 0x8b, 0x3b, 0x75, - 0xa7, 0xc4, 0x7c, 0xb2, 0x0a, 0x55, 0x81, 0x43, 0x8e, 0xd2, 0x2e, 0x69, 0xcc, 0x58, 0x64, 0x1b, - 0x5a, 0x1c, 0x7d, 0xc6, 0x71, 0x28, 0xdd, 0x11, 0x67, 0xc2, 0x2e, 0x6f, 0x96, 0x77, 0xea, 0x4e, - 0x73, 0x02, 0x0e, 0x38, 0x13, 0xca, 0x49, 0xf2, 0x91, 0x90, 0xe8, 0xbb, 0x31, 0x22, 0x17, 0x76, - 0x25, 0x71, 0x32, 0xe0, 0x85, 0xc2, 0x54, 0x86, 0x78, 0x74, 0x19, 0xb0, 0xa1, 0xbd, 0xb4, 0x59, - 0xdc, 0xb1, 0x1c, 0x63, 0x11, 0x02, 0x95, 0xd0, 0xbb, 0x43, 0xbb, 0xaa, 0xf3, 0xea, 0x6f, 0xb2, - 0x0e, 0x56, 0x10, 0x5d, 0x47, 0xee, 0x88, 0x07, 0x76, 0x4d, 0xe3, 0x35, 0x65, 0x0f, 0x78, 0x40, - 0x9f, 0x41, 0xe7, 0x84, 0xa3, 0x27, 0x31, 0x29, 0xc4, 0xc1, 0xaf, 0x64, 0x1b, 0xaa, 0x43, 0x6d, - 0xe8, 0x7a, 0x1a, 0x87, 0x8d, 0x3d, 0x55, 0xb7, 0x39, 0x37, 0x47, 0xf4, 0x0b, 0x74, 0xb3, 0x71, - 0x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0x8f, 0x02, 0xd0, - 0xff, 0xa0, 0x97, 0x63, 0x5a, 0xd0, 0x0d, 0x87, 0x3f, 0x2b, 0x50, 0x3e, 0xc5, 0x07, 0xf2, 0x12, - 0x9a, 0xe9, 0x5d, 0x45, 0x92, 0x8b, 0xe7, 0xd6, 0x5e, 0x7f, 0x65, 0x0e, 0x2a, 0x62, 0x5a, 0x50, - 0xe1, 0xe9, 0x3d, 0x63, 0xc2, 0x73, 0xdb, 0xc9, 0x84, 0xe7, 0x17, 0x12, 0x2d, 0x90, 0x13, 0x68, - 0x67, 0x47, 0x99, 0xac, 0xa6, 0x32, 0xa5, 0x5a, 0xb5, 0xbf, 0x36, 0x17, 0x9f, 0x90, 0x64, 0x27, - 0xcd, 0x90, 0xcc, 0xcc, 0xb9, 0x21, 0x99, 0x1d, 0xcb, 0x84, 0x24, 0x3b, 0x50, 0x86, 0x64, 0x66, - 0x20, 0x0d, 0xc9, 0xec, 0xf4, 0xd1, 0x02, 0x39, 0x86, 0x56, 0x7a, 0x9e, 0x84, 0x91, 0x23, 0x37, - 0x76, 0x46, 0x8e, 0xfc, 0xe4, 0xd1, 0x02, 0x39, 0x00, 0x78, 0x8f, 0xd2, 0xcc, 0x10, 0xe9, 0x68, - 0xb7, 0xc7, 0xf9, 0xea, 0x77, 0xb3, 0x80, 0x0e, 0x79, 0x01, 0x8d, 0x54, 0x4f, 0x92, 0xbf, 0xa6, - 0xd4, 0x8f, 0x3d, 0xd5, 0x5f, 0x9e, 0x05, 0x75, 0xec, 0x6b, 0x68, 0x65, 0xba, 0x86, 0xac, 0x98, - 0xae, 0xcd, 0xf6, 0x64, 0x7f, 0x75, 0x1e, 0xac, 0x18, 0x2e, 0xab, 0xfa, 0x8f, 0xff, 0xff, 0xaf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x08, 0x02, 0xa2, 0x47, 0x02, 0x08, 0x00, 0x00, + 0x10, 0x4e, 0xe2, 0x90, 0x38, 0x93, 0xf7, 0x3d, 0x5e, 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x1a, 0xb2, 0x66, 0xba, 0x36, 0xdf, 0x93, 0x83, 0xf5, 0x45, 0xb0, 0x62, 0xb8, 0xae, + 0xe9, 0x3f, 0xfe, 0xef, 0xdf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x1f, 0x5a, 0x3e, 0x02, 0x08, + 0x00, 0x00, } diff --git a/api/api.proto b/api/api.proto index 5be7b337..e356cb79 100644 --- a/api/api.proto +++ b/api/api.proto @@ -105,8 +105,8 @@ message RefreshTokenRef { // ID of the refresh token. string id = 1; string client_id = 2; - string created_at = 3; - string last_used = 4; + int64 created_at = 5; + int64 last_used = 6; } // ListRefreshReq is a request to enumerate the refresh tokens of a user. diff --git a/server/api.go b/server/api.go index 0e7c5b2f..738966a2 100644 --- a/server/api.go +++ b/server/api.go @@ -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) } diff --git a/server/api_test.go b/server/api_test.go index 0d0381d9..9d0d8bdf 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -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,