From 9926a0dcedef25d397e7c55b53f811afc7a72fc3 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Wed, 8 Aug 2018 17:21:02 +0200 Subject: [PATCH 1/8] Extend the API with a function which updates the client configuration --- api/api.pb.go | 252 ++++++++++++++++++++++++++++++++++++-------------- api/api.proto | 17 ++++ server/api.go | 32 +++++++ 3 files changed, 233 insertions(+), 68 deletions(-) diff --git a/api/api.pb.go b/api/api.pb.go index 83d6bd09..a89f7a67 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -13,6 +13,8 @@ It has these top-level messages: CreateClientResp DeleteClientReq DeleteClientResp + UpdateClientReq + UpdateClientResp Password CreatePasswordReq CreatePasswordResp @@ -194,6 +196,80 @@ func (m *DeleteClientResp) GetNotFound() bool { return false } +// UpdateClientReq is a request to update an exisitng client. +type UpdateClientReq struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + RedirectUris []string `protobuf:"bytes,2,rep,name=redirect_uris,json=redirectUris" json:"redirect_uris,omitempty"` + TrustedPeers []string `protobuf:"bytes,3,rep,name=trusted_peers,json=trustedPeers" json:"trusted_peers,omitempty"` + Public bool `protobuf:"varint,4,opt,name=public" json:"public,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name" json:"name,omitempty"` + LogoUrl string `protobuf:"bytes,6,opt,name=logo_url,json=logoUrl" json:"logo_url,omitempty"` +} + +func (m *UpdateClientReq) Reset() { *m = UpdateClientReq{} } +func (m *UpdateClientReq) String() string { return proto.CompactTextString(m) } +func (*UpdateClientReq) ProtoMessage() {} +func (*UpdateClientReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *UpdateClientReq) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *UpdateClientReq) GetRedirectUris() []string { + if m != nil { + return m.RedirectUris + } + return nil +} + +func (m *UpdateClientReq) GetTrustedPeers() []string { + if m != nil { + return m.TrustedPeers + } + return nil +} + +func (m *UpdateClientReq) GetPublic() bool { + if m != nil { + return m.Public + } + return false +} + +func (m *UpdateClientReq) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *UpdateClientReq) GetLogoUrl() string { + if m != nil { + return m.LogoUrl + } + return "" +} + +// UpdateClientResp returns the reponse form updating a client. +type UpdateClientResp struct { + NotFound bool `protobuf:"varint,1,opt,name=not_found,json=notFound" json:"not_found,omitempty"` +} + +func (m *UpdateClientResp) Reset() { *m = UpdateClientResp{} } +func (m *UpdateClientResp) String() string { return proto.CompactTextString(m) } +func (*UpdateClientResp) ProtoMessage() {} +func (*UpdateClientResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *UpdateClientResp) GetNotFound() bool { + if m != nil { + return m.NotFound + } + return false +} + // Password is an email for password mapping managed by the storage. type Password struct { Email string `protobuf:"bytes,1,opt,name=email" json:"email,omitempty"` @@ -206,7 +282,7 @@ type Password struct { func (m *Password) Reset() { *m = Password{} } func (m *Password) String() string { return proto.CompactTextString(m) } func (*Password) ProtoMessage() {} -func (*Password) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (*Password) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *Password) GetEmail() string { if m != nil { @@ -244,7 +320,7 @@ type CreatePasswordReq struct { func (m *CreatePasswordReq) Reset() { *m = CreatePasswordReq{} } func (m *CreatePasswordReq) String() string { return proto.CompactTextString(m) } func (*CreatePasswordReq) ProtoMessage() {} -func (*CreatePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (*CreatePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *CreatePasswordReq) GetPassword() *Password { if m != nil { @@ -261,7 +337,7 @@ type CreatePasswordResp struct { func (m *CreatePasswordResp) Reset() { *m = CreatePasswordResp{} } func (m *CreatePasswordResp) String() string { return proto.CompactTextString(m) } func (*CreatePasswordResp) ProtoMessage() {} -func (*CreatePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*CreatePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *CreatePasswordResp) GetAlreadyExists() bool { if m != nil { @@ -281,7 +357,7 @@ type UpdatePasswordReq struct { func (m *UpdatePasswordReq) Reset() { *m = UpdatePasswordReq{} } func (m *UpdatePasswordReq) String() string { return proto.CompactTextString(m) } func (*UpdatePasswordReq) ProtoMessage() {} -func (*UpdatePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*UpdatePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *UpdatePasswordReq) GetEmail() string { if m != nil { @@ -312,7 +388,7 @@ type UpdatePasswordResp struct { func (m *UpdatePasswordResp) Reset() { *m = UpdatePasswordResp{} } func (m *UpdatePasswordResp) String() string { return proto.CompactTextString(m) } func (*UpdatePasswordResp) ProtoMessage() {} -func (*UpdatePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*UpdatePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *UpdatePasswordResp) GetNotFound() bool { if m != nil { @@ -329,7 +405,7 @@ type DeletePasswordReq struct { func (m *DeletePasswordReq) Reset() { *m = DeletePasswordReq{} } func (m *DeletePasswordReq) String() string { return proto.CompactTextString(m) } func (*DeletePasswordReq) ProtoMessage() {} -func (*DeletePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*DeletePasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *DeletePasswordReq) GetEmail() string { if m != nil { @@ -346,7 +422,7 @@ type DeletePasswordResp struct { func (m *DeletePasswordResp) Reset() { *m = DeletePasswordResp{} } func (m *DeletePasswordResp) String() string { return proto.CompactTextString(m) } func (*DeletePasswordResp) ProtoMessage() {} -func (*DeletePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*DeletePasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *DeletePasswordResp) GetNotFound() bool { if m != nil { @@ -362,7 +438,7 @@ type ListPasswordReq struct { func (m *ListPasswordReq) Reset() { *m = ListPasswordReq{} } func (m *ListPasswordReq) String() string { return proto.CompactTextString(m) } func (*ListPasswordReq) ProtoMessage() {} -func (*ListPasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*ListPasswordReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } // ListPasswordResp returns a list of passwords. type ListPasswordResp struct { @@ -372,7 +448,7 @@ type ListPasswordResp struct { func (m *ListPasswordResp) Reset() { *m = ListPasswordResp{} } func (m *ListPasswordResp) String() string { return proto.CompactTextString(m) } func (*ListPasswordResp) ProtoMessage() {} -func (*ListPasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*ListPasswordResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (m *ListPasswordResp) GetPasswords() []*Password { if m != nil { @@ -388,7 +464,7 @@ type VersionReq struct { func (m *VersionReq) Reset() { *m = VersionReq{} } func (m *VersionReq) String() string { return proto.CompactTextString(m) } func (*VersionReq) ProtoMessage() {} -func (*VersionReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*VersionReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } // VersionResp holds the version info of components. type VersionResp struct { @@ -402,7 +478,7 @@ type VersionResp struct { func (m *VersionResp) Reset() { *m = VersionResp{} } func (m *VersionResp) String() string { return proto.CompactTextString(m) } func (*VersionResp) ProtoMessage() {} -func (*VersionResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*VersionResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } func (m *VersionResp) GetServer() string { if m != nil { @@ -430,7 +506,7 @@ type RefreshTokenRef struct { func (m *RefreshTokenRef) Reset() { *m = RefreshTokenRef{} } func (m *RefreshTokenRef) String() string { return proto.CompactTextString(m) } func (*RefreshTokenRef) ProtoMessage() {} -func (*RefreshTokenRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*RefreshTokenRef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } func (m *RefreshTokenRef) GetId() string { if m != nil { @@ -469,7 +545,7 @@ type ListRefreshReq struct { func (m *ListRefreshReq) Reset() { *m = ListRefreshReq{} } func (m *ListRefreshReq) String() string { return proto.CompactTextString(m) } func (*ListRefreshReq) ProtoMessage() {} -func (*ListRefreshReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*ListRefreshReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } func (m *ListRefreshReq) GetUserId() string { if m != nil { @@ -486,7 +562,7 @@ type ListRefreshResp struct { func (m *ListRefreshResp) Reset() { *m = ListRefreshResp{} } func (m *ListRefreshResp) String() string { return proto.CompactTextString(m) } func (*ListRefreshResp) ProtoMessage() {} -func (*ListRefreshResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } +func (*ListRefreshResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } func (m *ListRefreshResp) GetRefreshTokens() []*RefreshTokenRef { if m != nil { @@ -505,7 +581,7 @@ type RevokeRefreshReq struct { func (m *RevokeRefreshReq) Reset() { *m = RevokeRefreshReq{} } func (m *RevokeRefreshReq) String() string { return proto.CompactTextString(m) } func (*RevokeRefreshReq) ProtoMessage() {} -func (*RevokeRefreshReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } +func (*RevokeRefreshReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } func (m *RevokeRefreshReq) GetUserId() string { if m != nil { @@ -530,7 +606,7 @@ type RevokeRefreshResp struct { func (m *RevokeRefreshResp) Reset() { *m = RevokeRefreshResp{} } func (m *RevokeRefreshResp) String() string { return proto.CompactTextString(m) } func (*RevokeRefreshResp) ProtoMessage() {} -func (*RevokeRefreshResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } +func (*RevokeRefreshResp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } func (m *RevokeRefreshResp) GetNotFound() bool { if m != nil { @@ -545,6 +621,8 @@ func init() { proto.RegisterType((*CreateClientResp)(nil), "api.CreateClientResp") proto.RegisterType((*DeleteClientReq)(nil), "api.DeleteClientReq") proto.RegisterType((*DeleteClientResp)(nil), "api.DeleteClientResp") + proto.RegisterType((*UpdateClientReq)(nil), "api.UpdateClientReq") + proto.RegisterType((*UpdateClientResp)(nil), "api.UpdateClientResp") proto.RegisterType((*Password)(nil), "api.Password") proto.RegisterType((*CreatePasswordReq)(nil), "api.CreatePasswordReq") proto.RegisterType((*CreatePasswordResp)(nil), "api.CreatePasswordResp") @@ -576,6 +654,8 @@ const _ = grpc.SupportPackageIsVersion4 type DexClient interface { // CreateClient creates a client. CreateClient(ctx context.Context, in *CreateClientReq, opts ...grpc.CallOption) (*CreateClientResp, error) + // UpdateClient updates an exisitng client + UpdateClient(ctx context.Context, in *UpdateClientReq, opts ...grpc.CallOption) (*UpdateClientResp, error) // DeleteClient deletes the provided client. DeleteClient(ctx context.Context, in *DeleteClientReq, opts ...grpc.CallOption) (*DeleteClientResp, error) // CreatePassword creates a password. @@ -613,6 +693,15 @@ func (c *dexClient) CreateClient(ctx context.Context, in *CreateClientReq, opts return out, nil } +func (c *dexClient) UpdateClient(ctx context.Context, in *UpdateClientReq, opts ...grpc.CallOption) (*UpdateClientResp, error) { + out := new(UpdateClientResp) + err := grpc.Invoke(ctx, "/api.Dex/UpdateClient", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *dexClient) DeleteClient(ctx context.Context, in *DeleteClientReq, opts ...grpc.CallOption) (*DeleteClientResp, error) { out := new(DeleteClientResp) err := grpc.Invoke(ctx, "/api.Dex/DeleteClient", in, out, c.cc, opts...) @@ -690,6 +779,8 @@ func (c *dexClient) RevokeRefresh(ctx context.Context, in *RevokeRefreshReq, opt type DexServer interface { // CreateClient creates a client. CreateClient(context.Context, *CreateClientReq) (*CreateClientResp, error) + // UpdateClient updates an exisitng client + UpdateClient(context.Context, *UpdateClientReq) (*UpdateClientResp, error) // DeleteClient deletes the provided client. DeleteClient(context.Context, *DeleteClientReq) (*DeleteClientResp, error) // CreatePassword creates a password. @@ -732,6 +823,24 @@ func _Dex_CreateClient_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Dex_UpdateClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateClientReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DexServer).UpdateClient(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/api.Dex/UpdateClient", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DexServer).UpdateClient(ctx, req.(*UpdateClientReq)) + } + return interceptor(ctx, in, info, handler) +} + func _Dex_DeleteClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteClientReq) if err := dec(in); err != nil { @@ -884,6 +993,10 @@ var _Dex_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateClient", Handler: _Dex_CreateClient_Handler, }, + { + MethodName: "UpdateClient", + Handler: _Dex_UpdateClient_Handler, + }, { MethodName: "DeleteClient", Handler: _Dex_DeleteClient_Handler, @@ -924,56 +1037,59 @@ var _Dex_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("api/api.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 801 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x6d, 0x4f, 0xe3, 0x46, - 0x10, 0x4e, 0xe2, 0x90, 0x38, 0x93, 0xf7, 0x6d, 0x00, 0x13, 0x54, 0x09, 0x16, 0x55, 0x02, 0x55, - 0x0a, 0x85, 0x4a,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e1, 0xa9, 0xe9, 0x49, 0x75, 0xf5, 0xb9, 0x64, 0x03, 0x2d, - 0x59, 0xa1, 0x28, 0xb7, 0xcd, 0x33, 0x80, 0xa0, 0x57, 0xd0, 0x73, 0xf1, 0x39, 0x7e, 0xc4, 0x37, - 0x24, 0xff, 0xac, 0x00, 0xf4, 0x1b, 0xe8, 0x17, 0x98, 0xd6, 0x74, 0xc3, 0xe9, 0x87, 0x2a, 0x58, - 0x97, 0xf8, 0x42, 0x7e, 0x84, 0x56, 0x76, 0x57, 0x91, 0xf4, 0xe2, 0x85, 0xb5, 0x37, 0xdc, 0x5c, - 0x81, 0x8a, 0x84, 0x96, 0x54, 0x78, 0x76, 0xcf, 0x98, 0xf0, 0xc2, 0x76, 0x32, 0xe1, 0xc5, 0x85, - 0x44, 0x4b, 0xe4, 0x02, 0x3a, 0xf9, 0x51, 0x26, 0x5b, 0x99, 0x4c, 0x99, 0x56, 0x1d, 0x6e, 0xaf, - 0xc4, 0xe7, 0x24, 0xf9, 0x49, 0x33, 0x24, 0x4b, 0x73, 0x6e, 0x48, 0x96, 0xc7, 0x32, 0x25, 0xc9, - 0x0f, 0x94, 0x21, 0x59, 0x1a, 0x48, 0x43, 0xb2, 0x3c, 0x7d, 0xb4, 0x44, 0xce, 0xa1, 0x9d, 0x9d, - 0x27, 0x61, 0xe4, 0x28, 0x8c, 0x9d, 0x91, 0xa3, 0x38, 0x79, 0xb4, 0x44, 0x4e, 0x00, 0xfe, 0x40, - 0x69, 0x66, 0x88, 0x74, 0xb5, 0xdb, 0xeb, 0x7c, 0x0d, 0x7b, 0x79, 0x40, 0x87, 0xfc, 0x00, 0xcd, - 0x4c, 0x4f, 0x92, 0x2f, 0x16, 0xd4, 0xaf, 0x3d, 0x35, 0x1c, 0x2c, 0x83, 0x3a, 0xf6, 0x67, 0x68, - 0xe7, 0xba, 0x86, 0x6c, 0x9a, 0xae, 0xcd, 0xf7, 0xe4, 0x70, 0x6b, 0x15, 0xac, 0x18, 0x7e, 0x1d, - 0x00, 0x99, 0xc4, 0x4f, 0xa3, 0x49, 0xcc, 0x31, 0x16, 0xa3, 0x00, 0x5f, 0x94, 0xe7, 0x6d, 0x4d, - 0xff, 0x07, 0x7c, 0xfb, 0x31, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x6a, 0x64, 0xe2, 0x18, 0x08, 0x00, - 0x00, + // 851 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdb, 0x4e, 0xf3, 0x46, + 0x10, 0x4e, 0x62, 0x92, 0x38, 0x93, 0xf3, 0x36, 0x3f, 0x84, 0xa0, 0x4a, 0xb0, 0xa8, 0x12, 0xa8, + 0x52, 0x28, 0x54, 0x6a, 0xa5, 0xa2, 0xd2, 0x03, 0xb4, 0x05, 0xa9, 0xaa, 0x90, 0xd5, 0xf4, 0xb2, + 0x96, 0x89, 0x07, 0x58, 0x61, 0x6c, 0x77, 0x77, 0x43, 0x68, 0x2f, 0xfb, 0x48, 0x7d, 0x83, 0xbe, + 0xd9, 0xaf, 0x5d, 0x6f, 0x82, 0x0f, 0x81, 0x70, 0xe7, 0xf9, 0x76, 0xe6, 0x9b, 0xf3, 0xc8, 0xd0, + 0xf6, 0x62, 0x76, 0xe4, 0xc5, 0x6c, 0x1c, 0xf3, 0x48, 0x46, 0xc4, 0xf2, 0x62, 0x46, 0xff, 0x2f, + 0x43, 0xed, 0x3c, 0x60, 0x18, 0x4a, 0xd2, 0x81, 0x0a, 0xf3, 0x87, 0xe5, 0xdd, 0xf2, 0x41, 0xc3, + 0xa9, 0x30, 0x9f, 0x6c, 0x42, 0x4d, 0xe0, 0x94, 0xa3, 0x1c, 0x56, 0x34, 0x66, 0x24, 0xb2, 0x0f, + 0x6d, 0x8e, 0x3e, 0xe3, 0x38, 0x95, 0xee, 0x8c, 0x33, 0x31, 0xb4, 0x76, 0xad, 0x83, 0x86, 0xd3, + 0x5a, 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 0xfe, 0x20, 0x25, 0xe6, 0xe9, 0x63, 0x6c, 0xcc, 0x73, 0x27, 0xdc, 0x98, 0xe7, + 0xaf, 0x36, 0x2d, 0x91, 0x73, 0xe8, 0x64, 0x2f, 0x01, 0xd9, 0x4c, 0x05, 0x9a, 0x9a, 0xf4, 0xd1, + 0xd6, 0x4a, 0x7c, 0x41, 0x92, 0x5d, 0x54, 0x43, 0x52, 0x38, 0x13, 0x86, 0xa4, 0xb8, 0xd5, 0x09, + 0x49, 0x76, 0x1f, 0x0d, 0x49, 0x61, 0x9f, 0x0d, 0x49, 0x71, 0x79, 0x69, 0x89, 0x9c, 0x41, 0x3b, + 0xbd, 0x8e, 0xc2, 0x94, 0x23, 0xb7, 0xb5, 0xa6, 0x1c, 0xf9, 0xc5, 0xa5, 0x25, 0x72, 0x0c, 0xf0, + 0x0b, 0x4a, 0xb3, 0x82, 0xa4, 0xab, 0xd5, 0x5e, 0xd6, 0x73, 0xd4, 0xcb, 0x02, 0xda, 0xe4, 0x1b, + 0x68, 0xa6, 0x46, 0x9a, 0x7c, 0xb2, 0xa4, 0x7e, 0x19, 0xc9, 0xd1, 0xa0, 0x08, 0x6a, 0xdb, 0xef, + 0xa1, 0x9d, 0x19, 0x3a, 0xf2, 0xc1, 0x0c, 0x7d, 0x76, 0xa4, 0x47, 0x9b, 0xab, 0x60, 0xc5, 0xf0, + 0xe3, 0x00, 0xc8, 0x34, 0x7a, 0x1c, 0x4f, 0x23, 0x8e, 0x91, 0x18, 0xfb, 0xf8, 0xac, 0x34, 0x6f, + 0x6a, 0xfa, 0x67, 0xe9, 0xcb, 0x8f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x39, 0xfe, 0xc5, 0x3d, + 0x09, 0x00, 0x00, } diff --git a/api/api.proto b/api/api.proto index 45f6020f..3f587a51 100644 --- a/api/api.proto +++ b/api/api.proto @@ -36,6 +36,21 @@ message DeleteClientResp { bool not_found = 1; } +// UpdateClientReq is a request to update an exisitng client. +message UpdateClientReq { + string id = 1; + repeated string redirect_uris = 2; + repeated string trusted_peers = 3; + bool public = 4; + string name = 5; + string logo_url = 6; +} + +// UpdateClientResp returns the reponse form updating a client. +message UpdateClientResp { + bool not_found = 1; +} + // TODO(ericchiang): expand this. // Password is an email for password mapping managed by the storage. @@ -138,6 +153,8 @@ message RevokeRefreshResp { service Dex { // CreateClient creates a client. rpc CreateClient(CreateClientReq) returns (CreateClientResp) {}; + // UpdateClient updates an exisitng client + rpc UpdateClient(UpdateClientReq) returns (UpdateClientResp) {}; // DeleteClient deletes the provided client. rpc DeleteClient(DeleteClientReq) returns (DeleteClientResp) {}; // CreatePassword creates a password. diff --git a/server/api.go b/server/api.go index 3367ac80..f59be4ea 100644 --- a/server/api.go +++ b/server/api.go @@ -80,6 +80,38 @@ func (d dexAPI) CreateClient(ctx context.Context, req *api.CreateClientReq) (*ap }, nil } +func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*api.UpdateClientResp, error) { + if req.Id == "" { + return nil, errors.New("update client: no client ID supplied") + } + + err := d.s.UpdateClient(req.Id, func(old storage.Client) (storage.Client, error) { + if req.RedirectUris != nil && len(req.RedirectUris) > 0 { + old.RedirectURIs = req.RedirectUris + } + if req.TrustedPeers != nil && len(req.TrustedPeers) > 0 { + old.TrustedPeers = req.TrustedPeers + } + old.Public = req.Public + if req.Name != "" { + old.Name = req.Name + } + if req.LogoUrl != "" { + old.LogoURL = req.LogoUrl + } + return old, nil + }) + + if err != nil { + if err == storage.ErrNotFound { + return &api.UpdateClientResp{NotFound: true}, nil + } + d.logger.Errorf("api: failed to update the client: %v", err) + return nil, fmt.Errorf("update client: %v", err) + } + return &api.UpdateClientResp{}, nil +} + func (d dexAPI) DeleteClient(ctx context.Context, req *api.DeleteClientReq) (*api.DeleteClientResp, error) { err := d.s.DeleteClient(req.Id) if err != nil { From 6531b256e2f05b15188cbd774c8f8745d07d02f9 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 12 Nov 2018 17:34:13 +0100 Subject: [PATCH 2/8] Fix typo --- api/api.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/api.proto b/api/api.proto index 3f587a51..fbb9537a 100644 --- a/api/api.proto +++ b/api/api.proto @@ -153,7 +153,7 @@ message RevokeRefreshResp { service Dex { // CreateClient creates a client. rpc CreateClient(CreateClientReq) returns (CreateClientResp) {}; - // UpdateClient updates an exisitng client + // UpdateClient updates an existing client rpc UpdateClient(UpdateClientReq) returns (UpdateClientResp) {}; // DeleteClient deletes the provided client. rpc DeleteClient(DeleteClientReq) returns (DeleteClientResp) {}; From c9b18b2785aa6538fbe108d197d3eee23e11f498 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 12 Nov 2018 18:43:48 +0100 Subject: [PATCH 3/8] Add tests for UpateClient API --- server/api_test.go | 171 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/server/api_test.go b/server/api_test.go index aabfde8b..7e77a010 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -290,3 +290,174 @@ func TestRefreshToken(t *testing.T) { t.Fatalf("Refresh token returned inspite of revoking it.") } } + +func TestUpdateClient(t *testing.T) { + logger := &logrus.Logger{ + Out: os.Stderr, + Formatter: &logrus.TextFormatter{DisableColors: true}, + Level: logrus.DebugLevel, + } + + s := memory.New(logger) + client := newAPI(s, logger, t) + defer client.Close() + ctx := context.Background() + + createClient := func(t *testing.T, clientId string) { + resp, err := client.CreateClient(ctx, &api.CreateClientReq{ + Client: &api.Client{ + Id: clientId, + Secret: "", + RedirectUris: []string{}, + TrustedPeers: nil, + Public: true, + Name: "", + LogoUrl: "", + }, + }) + if err != nil { + t.Fatalf("unable to create the client: %v", err) + } + + if resp == nil { + t.Fatalf("create client returned no response") + } + if resp.AlreadyExists { + t.Error("existing client was found") + } + + if resp.Client == nil { + t.Fatalf("no client created") + } + } + + deleteClient := func(t *testing.T, clientId string) { + resp, err := client.DeleteClient(ctx, &api.DeleteClientReq{ + Id: clientId, + }) + if err != nil { + t.Fatalf("unable to delete the client: %v", err) + } + if resp == nil { + t.Fatalf("delete client delete client returned no response") + } + } + + tests := map[string]struct { + setup func(t *testing.T, clientId string) + cleanup func(t *testing.T, clientId string) + req *api.UpdateClientReq + wantErr bool + want *api.UpdateClientResp + }{ + "update client": { + setup: createClient, + cleanup: deleteClient, + req: &api.UpdateClientReq{ + Id: "test", + RedirectUris: []string{"https://redirect"}, + TrustedPeers: []string{"test"}, + Public: true, + Name: "test", + LogoUrl: "https://logout", + }, + wantErr: false, + want: &api.UpdateClientResp{ + NotFound: false, + }, + }, + "update client without ID": { + setup: createClient, + cleanup: deleteClient, + req: &api.UpdateClientReq{ + Id: "", + RedirectUris: nil, + TrustedPeers: nil, + Public: false, + Name: "test", + LogoUrl: "test", + }, + wantErr: true, + want: &api.UpdateClientResp{ + NotFound: false, + }, + }, + "update client which not exists ": { + req: &api.UpdateClientReq{ + Id: "test", + RedirectUris: nil, + TrustedPeers: nil, + Public: false, + Name: "test", + LogoUrl: "test", + }, + wantErr: true, + want: &api.UpdateClientResp{ + NotFound: false, + }, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + if tc.setup != nil { + tc.setup(t, tc.req.Id) + } + resp, err := client.UpdateClient(ctx, tc.req) + if err != nil && !tc.wantErr { + t.Fatalf("failed to update the client: %v", err) + } + + if !tc.wantErr { + if resp == nil { + t.Fatalf("update client response not found") + } + + if tc.want.NotFound != resp.NotFound { + t.Errorf("expected in response NotFound: %t", tc.want.NotFound) + } + + client, err := s.GetClient(tc.req.Id) + if err != nil { + t.Errorf("no client found in the storage: %v", err) + } + + if tc.req.Id != client.ID { + t.Errorf("expected stored client with ID: %s, found %s", tc.req.Id, client.ID) + } + if tc.req.Name != client.Name { + t.Errorf("expected stored client with Name: %s, found %s", tc.req.Name, client.Name) + } + if tc.req.LogoUrl != client.LogoURL { + t.Errorf("expected stored client with LogoURL: %s, found %s", tc.req.LogoUrl, client.LogoURL) + } + for _, redirectURI := range tc.req.RedirectUris { + found := find(redirectURI, client.RedirectURIs) + if !found { + t.Errorf("expected redirect URI: %s", redirectURI) + } + } + for _, peer := range tc.req.TrustedPeers { + found := find(peer, client.TrustedPeers) + if !found { + t.Errorf("expected trusted peer: %s", peer) + } + } + } + + if tc.cleanup != nil { + tc.cleanup(t, tc.req.Id) + } + + }) + } +} + +func find(item string, items []string) bool { + for _, i := range items { + if item == i { + return true + } + } + return false +} From 6536d9781225cfb8b8dd2d738747cd06da7d6a81 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 12 Nov 2018 18:50:12 +0100 Subject: [PATCH 4/8] Regeneated the gRPC API in order to update the comment --- api/api.pb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api.pb.go b/api/api.pb.go index a89f7a67..fa7e8c21 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -654,7 +654,7 @@ const _ = grpc.SupportPackageIsVersion4 type DexClient interface { // CreateClient creates a client. CreateClient(ctx context.Context, in *CreateClientReq, opts ...grpc.CallOption) (*CreateClientResp, error) - // UpdateClient updates an exisitng client + // UpdateClient updates an existing client UpdateClient(ctx context.Context, in *UpdateClientReq, opts ...grpc.CallOption) (*UpdateClientResp, error) // DeleteClient deletes the provided client. DeleteClient(ctx context.Context, in *DeleteClientReq, opts ...grpc.CallOption) (*DeleteClientResp, error) @@ -779,7 +779,7 @@ func (c *dexClient) RevokeRefresh(ctx context.Context, in *RevokeRefreshReq, opt type DexServer interface { // CreateClient creates a client. CreateClient(context.Context, *CreateClientReq) (*CreateClientResp, error) - // UpdateClient updates an exisitng client + // UpdateClient updates an existing client UpdateClient(context.Context, *UpdateClientReq) (*UpdateClientResp, error) // DeleteClient deletes the provided client. DeleteClient(context.Context, *DeleteClientReq) (*DeleteClientResp, error) From 49fa5ee6e8271d433cd9a3b00c3533495e285c3e Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 12 Nov 2018 21:48:14 +0100 Subject: [PATCH 5/8] Avoid overwriting exiting redirect URI and trusted peers when updating the client Also skip configure the Public field. --- server/api.go | 22 +++++++++++++++++++--- server/api_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/server/api.go b/server/api.go index f59be4ea..20b645d1 100644 --- a/server/api.go +++ b/server/api.go @@ -87,12 +87,11 @@ func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*ap err := d.s.UpdateClient(req.Id, func(old storage.Client) (storage.Client, error) { if req.RedirectUris != nil && len(req.RedirectUris) > 0 { - old.RedirectURIs = req.RedirectUris + old.RedirectURIs = mergeSlice(old.RedirectURIs, req.RedirectUris) } if req.TrustedPeers != nil && len(req.TrustedPeers) > 0 { - old.TrustedPeers = req.TrustedPeers + old.TrustedPeers = mergeSlice(old.TrustedPeers, req.TrustedPeers) } - old.Public = req.Public if req.Name != "" { old.Name = req.Name } @@ -112,6 +111,23 @@ func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*ap return &api.UpdateClientResp{}, nil } +func mergeSlice(s1 []string, s2 []string) []string { + isPresent := func(i string, s []string) bool { + for _, j := range s { + if j == i { + return true + } + } + return false + } + for _, i := range s2 { + if !isPresent(i, s1) { + s1 = append(s1, i) + } + } + return s1 +} + func (d dexAPI) DeleteClient(ctx context.Context, req *api.DeleteClientReq) (*api.DeleteClientResp, error) { err := d.s.DeleteClient(req.Id) if err != nil { diff --git a/server/api_test.go b/server/api_test.go index 7e77a010..209dabd6 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -461,3 +461,42 @@ func find(item string, items []string) bool { } return false } + +func TestMergeSlice(t *testing.T) { + tests := map[string]struct { + s1 []string + s2 []string + want []string + }{ + "merge slice": { + s1: []string{"t1", "t2"}, + s2: []string{"t3"}, + want: []string{"t1", "t2", "t3"}, + }, + "merge slice with duplicates": { + s1: []string{"t1", "t2"}, + s2: []string{"t3", "t2"}, + want: []string{"t1", "t2", "t3"}, + }, + "merge slice with empty slice": { + s1: []string{"t1", "t2"}, + s2: []string{}, + want: []string{"t1", "t2"}, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + got := mergeSlice(tc.s1, tc.s2) + if len(got) != len(tc.want) { + t.Errorf("expected equal slice") + } + for _, want := range tc.want { + found := find(want, got) + if !found { + t.Errorf("missing element: %s", want) + } + } + }) + } +} From 9d1ec6c36b4a83d2e1f07c9609489b5732f857ec Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 13 Nov 2018 09:58:17 +0100 Subject: [PATCH 6/8] Revert "Avoid overwriting exiting redirect URI and trusted peers when updating the client" This reverts commit 49fa5ee6e8271d433cd9a3b00c3533495e285c3e. --- server/api.go | 22 +++------------------- server/api_test.go | 39 --------------------------------------- 2 files changed, 3 insertions(+), 58 deletions(-) diff --git a/server/api.go b/server/api.go index 20b645d1..f59be4ea 100644 --- a/server/api.go +++ b/server/api.go @@ -87,11 +87,12 @@ func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*ap err := d.s.UpdateClient(req.Id, func(old storage.Client) (storage.Client, error) { if req.RedirectUris != nil && len(req.RedirectUris) > 0 { - old.RedirectURIs = mergeSlice(old.RedirectURIs, req.RedirectUris) + old.RedirectURIs = req.RedirectUris } if req.TrustedPeers != nil && len(req.TrustedPeers) > 0 { - old.TrustedPeers = mergeSlice(old.TrustedPeers, req.TrustedPeers) + old.TrustedPeers = req.TrustedPeers } + old.Public = req.Public if req.Name != "" { old.Name = req.Name } @@ -111,23 +112,6 @@ func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*ap return &api.UpdateClientResp{}, nil } -func mergeSlice(s1 []string, s2 []string) []string { - isPresent := func(i string, s []string) bool { - for _, j := range s { - if j == i { - return true - } - } - return false - } - for _, i := range s2 { - if !isPresent(i, s1) { - s1 = append(s1, i) - } - } - return s1 -} - func (d dexAPI) DeleteClient(ctx context.Context, req *api.DeleteClientReq) (*api.DeleteClientResp, error) { err := d.s.DeleteClient(req.Id) if err != nil { diff --git a/server/api_test.go b/server/api_test.go index 209dabd6..7e77a010 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -461,42 +461,3 @@ func find(item string, items []string) bool { } return false } - -func TestMergeSlice(t *testing.T) { - tests := map[string]struct { - s1 []string - s2 []string - want []string - }{ - "merge slice": { - s1: []string{"t1", "t2"}, - s2: []string{"t3"}, - want: []string{"t1", "t2", "t3"}, - }, - "merge slice with duplicates": { - s1: []string{"t1", "t2"}, - s2: []string{"t3", "t2"}, - want: []string{"t1", "t2", "t3"}, - }, - "merge slice with empty slice": { - s1: []string{"t1", "t2"}, - s2: []string{}, - want: []string{"t1", "t2"}, - }, - } - - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - got := mergeSlice(tc.s1, tc.s2) - if len(got) != len(tc.want) { - t.Errorf("expected equal slice") - } - for _, want := range tc.want { - found := find(want, got) - if !found { - t.Errorf("missing element: %s", want) - } - } - }) - } -} From 281ec271188d3ae254c9d4700d9bba76074e4553 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 13 Nov 2018 09:59:45 +0100 Subject: [PATCH 7/8] Update also to a list of empty redirect URIs and Peers --- server/api.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/api.go b/server/api.go index f59be4ea..c1107e4c 100644 --- a/server/api.go +++ b/server/api.go @@ -86,13 +86,12 @@ func (d dexAPI) UpdateClient(ctx context.Context, req *api.UpdateClientReq) (*ap } err := d.s.UpdateClient(req.Id, func(old storage.Client) (storage.Client, error) { - if req.RedirectUris != nil && len(req.RedirectUris) > 0 { + if req.RedirectUris != nil { old.RedirectURIs = req.RedirectUris } - if req.TrustedPeers != nil && len(req.TrustedPeers) > 0 { + if req.TrustedPeers != nil { old.TrustedPeers = req.TrustedPeers } - old.Public = req.Public if req.Name != "" { old.Name = req.Name } From 01c6b9dd915c2fdbbd802e2bcf70aaf2793307c8 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Mon, 26 Nov 2018 19:07:59 +0100 Subject: [PATCH 8/8] Remove the 'public' field from UpdateClientReq proto message --- api/api.pb.go | 85 +++++++++++++++++++++------------------------- api/api.proto | 5 ++- server/api_test.go | 3 -- 3 files changed, 40 insertions(+), 53 deletions(-) diff --git a/api/api.pb.go b/api/api.pb.go index fa7e8c21..9395f484 100644 --- a/api/api.pb.go +++ b/api/api.pb.go @@ -201,9 +201,8 @@ type UpdateClientReq struct { Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` RedirectUris []string `protobuf:"bytes,2,rep,name=redirect_uris,json=redirectUris" json:"redirect_uris,omitempty"` TrustedPeers []string `protobuf:"bytes,3,rep,name=trusted_peers,json=trustedPeers" json:"trusted_peers,omitempty"` - Public bool `protobuf:"varint,4,opt,name=public" json:"public,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name" json:"name,omitempty"` - LogoUrl string `protobuf:"bytes,6,opt,name=logo_url,json=logoUrl" json:"logo_url,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` + LogoUrl string `protobuf:"bytes,5,opt,name=logo_url,json=logoUrl" json:"logo_url,omitempty"` } func (m *UpdateClientReq) Reset() { *m = UpdateClientReq{} } @@ -232,13 +231,6 @@ func (m *UpdateClientReq) GetTrustedPeers() []string { return nil } -func (m *UpdateClientReq) GetPublic() bool { - if m != nil { - return m.Public - } - return false -} - func (m *UpdateClientReq) GetName() string { if m != nil { return m.Name @@ -1037,11 +1029,11 @@ var _Dex_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("api/api.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 851 bytes of a gzipped FileDescriptorProto + // 848 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdb, 0x4e, 0xf3, 0x46, 0x10, 0x4e, 0x62, 0x92, 0x38, 0x93, 0xf3, 0x36, 0x3f, 0x84, 0xa0, 0x4a, 0xb0, 0xa8, 0x12, 0xa8, 0x52, 0x28, 0x54, 0x6a, 0xa5, 0xa2, 0xd2, 0x03, 0xb4, 0x05, 0xa9, 0xaa, 0x90, 0xd5, 0xf4, 0xb2, - 0x96, 0x89, 0x07, 0x58, 0x61, 0x6c, 0x77, 0x77, 0x43, 0x68, 0x2f, 0xfb, 0x48, 0x7d, 0x83, 0xbe, + 0x96, 0x89, 0x07, 0x58, 0x61, 0x6c, 0x77, 0x77, 0x43, 0x68, 0x2f, 0xfb, 0x18, 0x7d, 0x9b, 0xbe, 0xd9, 0xaf, 0x5d, 0x6f, 0x82, 0x0f, 0x81, 0x70, 0xe7, 0xf9, 0x76, 0xe6, 0x9b, 0xf3, 0xc8, 0xd0, 0xf6, 0x62, 0x76, 0xe4, 0xc5, 0x6c, 0x1c, 0xf3, 0x48, 0x46, 0xc4, 0xf2, 0x62, 0x46, 0xff, 0x2f, 0x43, 0xed, 0x3c, 0x60, 0x18, 0x4a, 0xd2, 0x81, 0x0a, 0xf3, 0x87, 0xe5, 0xdd, 0xf2, 0x41, 0xc3, @@ -1057,39 +1049,38 @@ var fileDescriptor0 = []byte{ 0x04, 0xb6, 0xd3, 0x36, 0xe8, 0x4f, 0x1a, 0x4c, 0xf1, 0x57, 0x5e, 0xe7, 0xdf, 0x83, 0xee, 0x05, 0x06, 0x98, 0x8e, 0x2b, 0x57, 0x63, 0x7a, 0x04, 0xbd, 0xac, 0x8a, 0x88, 0xc9, 0x0e, 0x34, 0xc2, 0x48, 0xba, 0xb7, 0xd1, 0x2c, 0xf4, 0x8d, 0x77, 0x3b, 0x8c, 0xe4, 0xcf, 0x4a, 0xa6, 0xff, 0x95, - 0xa1, 0x3b, 0x89, 0x7d, 0xef, 0x0d, 0xd2, 0x62, 0x83, 0x2a, 0xef, 0x69, 0x90, 0xf5, 0x66, 0x83, - 0x36, 0x56, 0x36, 0xa8, 0xfa, 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0x1a, 0xf3, + 0xfc, 0x41, 0x4a, 0xcc, 0xd3, 0x47, 0xd7, 0x98, 0xe7, 0x4e, 0xb5, 0x31, 0xcf, 0x5f, 0x67, 0x5a, + 0x22, 0xe7, 0xd0, 0xc9, 0x5e, 0x02, 0xb2, 0x99, 0x0a, 0x34, 0x35, 0xe9, 0xa3, 0xad, 0x95, 0xf8, + 0x82, 0x24, 0xbb, 0xa8, 0x86, 0xa4, 0x70, 0x26, 0x0c, 0x49, 0x71, 0xab, 0x13, 0x92, 0xec, 0x3e, + 0x1a, 0x92, 0xc2, 0x3e, 0x1b, 0x92, 0xe2, 0xf2, 0xd2, 0x12, 0x39, 0x83, 0x76, 0x7a, 0x1d, 0x85, + 0x29, 0x47, 0x6e, 0x6b, 0x4d, 0x39, 0xf2, 0x8b, 0x4b, 0x4b, 0xe4, 0x18, 0xe0, 0x17, 0x94, 0x66, + 0x05, 0x49, 0x57, 0xab, 0xbd, 0xac, 0xe7, 0xa8, 0x97, 0x05, 0xb4, 0xc9, 0x37, 0xd0, 0x4c, 0x8d, + 0x34, 0xf9, 0x64, 0x49, 0xfd, 0x32, 0x92, 0xa3, 0x41, 0x11, 0xd4, 0xb6, 0xdf, 0x43, 0x3b, 0x33, + 0x74, 0xe4, 0x83, 0x19, 0xfa, 0xec, 0x48, 0x8f, 0x36, 0x57, 0xc1, 0x8a, 0xe1, 0xc7, 0x01, 0x90, + 0x69, 0xf4, 0x38, 0x9e, 0x46, 0x1c, 0x23, 0x31, 0xf6, 0xf1, 0x59, 0x69, 0xde, 0xd4, 0xf4, 0x4f, + 0xd1, 0x97, 0x1f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x00, 0x08, 0xae, 0x25, 0x09, 0x00, 0x00, } diff --git a/api/api.proto b/api/api.proto index fbb9537a..7b91e822 100644 --- a/api/api.proto +++ b/api/api.proto @@ -41,9 +41,8 @@ message UpdateClientReq { string id = 1; repeated string redirect_uris = 2; repeated string trusted_peers = 3; - bool public = 4; - string name = 5; - string logo_url = 6; + string name = 4; + string logo_url = 5; } // UpdateClientResp returns the reponse form updating a client. diff --git a/server/api_test.go b/server/api_test.go index 7e77a010..14759e63 100644 --- a/server/api_test.go +++ b/server/api_test.go @@ -357,7 +357,6 @@ func TestUpdateClient(t *testing.T) { Id: "test", RedirectUris: []string{"https://redirect"}, TrustedPeers: []string{"test"}, - Public: true, Name: "test", LogoUrl: "https://logout", }, @@ -373,7 +372,6 @@ func TestUpdateClient(t *testing.T) { Id: "", RedirectUris: nil, TrustedPeers: nil, - Public: false, Name: "test", LogoUrl: "test", }, @@ -387,7 +385,6 @@ func TestUpdateClient(t *testing.T) { Id: "test", RedirectUris: nil, TrustedPeers: nil, - Public: false, Name: "test", LogoUrl: "test", },