diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index 2bc5f70e4..40200b8ea 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -2120,9 +2120,117 @@ "controller.api.services.v1.UserService" ] } + }, + "/v1/orgs/{org_id}:authenticate": { + "post": { + "summary": "Authenticate a user to an Organization and retrieve an authentication token.", + "operationId": "OrganizationService_Authenticate", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/controller.api.resources.authtokens.v1.AuthToken" + } + } + }, + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/controller.api.services.v1.AuthenticateRequest" + } + } + ], + "tags": [ + "controller.api.services.v1.OrganizationService" + ] + } + }, + "/v1/orgs/{org_id}:deauthenticate": { + "post": { + "summary": "Deauthenticate an authentication token from an Organization.", + "operationId": "OrganizationService_Deauthenticate", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/controller.api.services.v1.DeauthenticateResponse" + } + } + }, + "parameters": [ + { + "name": "org_id", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "controller.api.services.v1.OrganizationService" + ] + } } }, "definitions": { + "controller.api.resources.authtokens.v1.AuthToken": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of the AuthToken\nOutput only.", + "readOnly": true + }, + "token": { + "type": "string", + "description": "The token. This will only be populated after login and is only ever visible to the end user whose login\nrequest resulted in this auth token being created.\nOutput only.", + "readOnly": true + }, + "user_id": { + "type": "string", + "description": "The id of the user of this AuthToken.\nOutput only.", + "readOnly": true + }, + "auth_method_id": { + "type": "string", + "description": "The id of the user of this AuthToken.\nOutput only.", + "readOnly": true + }, + "created_time": { + "type": "string", + "format": "date-time", + "description": "The time this resource was created\nOutput only.", + "readOnly": true + }, + "updated_time": { + "type": "string", + "format": "date-time", + "description": "The time this resource was last updated.\nOutput only.", + "readOnly": true + }, + "approximate_last_used_time": { + "type": "string", + "format": "date-time", + "description": "The approximate time this AuthToken was last used.\nOutput only.", + "readOnly": true + }, + "expiration_time": { + "type": "string", + "format": "date-time", + "description": "The time this AuthToken expires.\nOutput only.", + "readOnly": true + } + }, + "title": "AuthToken contains all fields related to an AuthToken resource" + }, "controller.api.resources.groups.v1.Group": { "type": "object", "properties": { @@ -2443,6 +2551,33 @@ "controller.api.services.v1.AddToHostSetResponse": { "type": "object" }, + "controller.api.services.v1.AuthenticateRequest": { + "type": "object", + "properties": { + "org_id": { + "type": "string" + }, + "auth_method_id": { + "type": "string", + "description": "The id to the authmethod in the system being used for authentication. The auth method must be in the org\nbeing logged in to." + }, + "token_type": { + "type": "string", + "description": "This can be \"cookie\" or \"token\". If not provided, \"token\" will be used. For now only type \"token\" is returned." + }, + "password_credential": { + "$ref": "#/definitions/controller.api.services.v1.PasswordCredential" + } + } + }, + "controller.api.services.v1.AuthenticateResponse": { + "type": "object", + "properties": { + "item": { + "$ref": "#/definitions/controller.api.resources.authtokens.v1.AuthToken" + } + } + }, "controller.api.services.v1.CreateGroupResponse": { "type": "object", "properties": { @@ -2520,6 +2655,9 @@ } } }, + "controller.api.services.v1.DeauthenticateResponse": { + "type": "object" + }, "controller.api.services.v1.DeleteGroupResponse": { "type": "object", "properties": { @@ -2735,6 +2873,17 @@ } } }, + "controller.api.services.v1.PasswordCredential": { + "type": "object", + "properties": { + "login_name": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, "controller.api.services.v1.RemoveFromHostSetResponse": { "type": "object" }, diff --git a/internal/gen/controller/api/resources/authtokens/authtoken.pb.go b/internal/gen/controller/api/resources/authtokens/authtoken.pb.go new file mode 100644 index 000000000..97f5e06d6 --- /dev/null +++ b/internal/gen/controller/api/resources/authtokens/authtoken.pb.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.24.0 +// protoc v3.12.3 +// source: controller/api/resources/authtokens/v1/authtoken.proto + +package authtokens + +import ( + proto "github.com/golang/protobuf/proto" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/golang/protobuf/ptypes/wrappers" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// AuthToken contains all fields related to an AuthToken resource +type AuthToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The ID of the AuthToken + // Output only. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The token. This will only be populated after login and is only ever visible to the end user whose login + // request resulted in this auth token being created. + // Output only. + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + // The id of the user of this AuthToken. + // Output only. + UserId string `protobuf:"bytes,4,opt,name=user_id,proto3" json:"user_id,omitempty"` + // The id of the user of this AuthToken. + // Output only. + AuthMethodId string `protobuf:"bytes,5,opt,name=auth_method_id,proto3" json:"auth_method_id,omitempty"` + // The time this resource was created + // Output only. + CreatedTime *timestamp.Timestamp `protobuf:"bytes,6,opt,name=created_time,proto3" json:"created_time,omitempty"` + // The time this resource was last updated. + // Output only. + UpdatedTime *timestamp.Timestamp `protobuf:"bytes,7,opt,name=updated_time,proto3" json:"updated_time,omitempty"` + // The approximate time this AuthToken was last used. + // Output only. + ApproximateLastUsedTime *timestamp.Timestamp `protobuf:"bytes,8,opt,name=approximate_last_used_time,proto3" json:"approximate_last_used_time,omitempty"` + // The time this AuthToken expires. + // Output only. + ExpirationTime *timestamp.Timestamp `protobuf:"bytes,9,opt,name=expiration_time,proto3" json:"expiration_time,omitempty"` +} + +func (x *AuthToken) Reset() { + *x = AuthToken{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_resources_authtokens_v1_authtoken_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthToken) ProtoMessage() {} + +func (x *AuthToken) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_resources_authtokens_v1_authtoken_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthToken.ProtoReflect.Descriptor instead. +func (*AuthToken) Descriptor() ([]byte, []int) { + return file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescGZIP(), []int{0} +} + +func (x *AuthToken) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AuthToken) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *AuthToken) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *AuthToken) GetAuthMethodId() string { + if x != nil { + return x.AuthMethodId + } + return "" +} + +func (x *AuthToken) GetCreatedTime() *timestamp.Timestamp { + if x != nil { + return x.CreatedTime + } + return nil +} + +func (x *AuthToken) GetUpdatedTime() *timestamp.Timestamp { + if x != nil { + return x.UpdatedTime + } + return nil +} + +func (x *AuthToken) GetApproximateLastUsedTime() *timestamp.Timestamp { + if x != nil { + return x.ApproximateLastUsedTime + } + return nil +} + +func (x *AuthToken) GetExpirationTime() *timestamp.Timestamp { + if x != nil { + return x.ExpirationTime + } + return nil +} + +var File_controller_api_resources_authtokens_v1_authtoken_proto protoreflect.FileDescriptor + +var file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = []byte{ + 0x0a, 0x36, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x26, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2e, 0x76, 0x31, + 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x95, 0x03, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, + 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3e, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x5a, 0x0a, 0x1a, 0x61, 0x70, 0x70, 0x72, 0x6f, + 0x78, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x64, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x1a, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x78, 0x69, + 0x6d, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x5d, 0x5a, 0x5b, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, + 0x70, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x74, 0x6f, 0x77, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x3b, 0x61, 0x75, + 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescOnce sync.Once + file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescData = file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc +) + +func file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescGZIP() []byte { + file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescOnce.Do(func() { + file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescData) + }) + return file_controller_api_resources_authtokens_v1_authtoken_proto_rawDescData +} + +var file_controller_api_resources_authtokens_v1_authtoken_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_controller_api_resources_authtokens_v1_authtoken_proto_goTypes = []interface{}{ + (*AuthToken)(nil), // 0: controller.api.resources.authtokens.v1.AuthToken + (*timestamp.Timestamp)(nil), // 1: google.protobuf.Timestamp +} +var file_controller_api_resources_authtokens_v1_authtoken_proto_depIdxs = []int32{ + 1, // 0: controller.api.resources.authtokens.v1.AuthToken.created_time:type_name -> google.protobuf.Timestamp + 1, // 1: controller.api.resources.authtokens.v1.AuthToken.updated_time:type_name -> google.protobuf.Timestamp + 1, // 2: controller.api.resources.authtokens.v1.AuthToken.approximate_last_used_time:type_name -> google.protobuf.Timestamp + 1, // 3: controller.api.resources.authtokens.v1.AuthToken.expiration_time:type_name -> google.protobuf.Timestamp + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_controller_api_resources_authtokens_v1_authtoken_proto_init() } +func file_controller_api_resources_authtokens_v1_authtoken_proto_init() { + if File_controller_api_resources_authtokens_v1_authtoken_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_controller_api_resources_authtokens_v1_authtoken_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_controller_api_resources_authtokens_v1_authtoken_proto_goTypes, + DependencyIndexes: file_controller_api_resources_authtokens_v1_authtoken_proto_depIdxs, + MessageInfos: file_controller_api_resources_authtokens_v1_authtoken_proto_msgTypes, + }.Build() + File_controller_api_resources_authtokens_v1_authtoken_proto = out.File + file_controller_api_resources_authtokens_v1_authtoken_proto_rawDesc = nil + file_controller_api_resources_authtokens_v1_authtoken_proto_goTypes = nil + file_controller_api_resources_authtokens_v1_authtoken_proto_depIdxs = nil +} diff --git a/internal/gen/controller/api/services/organization_service.pb.go b/internal/gen/controller/api/services/organization_service.pb.go index d05bf04bf..d9f5532f2 100644 --- a/internal/gen/controller/api/services/organization_service.pb.go +++ b/internal/gen/controller/api/services/organization_service.pb.go @@ -10,6 +10,7 @@ import ( context "context" proto "github.com/golang/protobuf/proto" _ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options" + authtokens "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/authtokens" scopes "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/scopes" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" @@ -228,6 +229,267 @@ func (x *ListOrganizationsResponse) GetItems() []*scopes.Organization { return nil } +type PasswordCredential struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LoginName string `protobuf:"bytes,1,opt,name=login_name,json=loginName,proto3" json:"login_name,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *PasswordCredential) Reset() { + *x = PasswordCredential{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PasswordCredential) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PasswordCredential) ProtoMessage() {} + +func (x *PasswordCredential) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PasswordCredential.ProtoReflect.Descriptor instead. +func (*PasswordCredential) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_organization_service_proto_rawDescGZIP(), []int{4} +} + +func (x *PasswordCredential) GetLoginName() string { + if x != nil { + return x.LoginName + } + return "" +} + +func (x *PasswordCredential) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type AuthenticateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrgId string `protobuf:"bytes,1,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"` + // The id to the authmethod in the system being used for authentication. The auth method must be in the org + // being logged in to. + AuthMethodId string `protobuf:"bytes,2,opt,name=auth_method_id,json=authMethodId,proto3" json:"auth_method_id,omitempty"` + // This can be "cookie" or "token". If not provided, "token" will be used. For now only type "token" is returned. + TokenType string `protobuf:"bytes,3,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` + PasswordCredential *PasswordCredential `protobuf:"bytes,4,opt,name=password_credential,json=passwordCredential,proto3" json:"password_credential,omitempty"` +} + +func (x *AuthenticateRequest) Reset() { + *x = AuthenticateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthenticateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticateRequest) ProtoMessage() {} + +func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthenticateRequest.ProtoReflect.Descriptor instead. +func (*AuthenticateRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_organization_service_proto_rawDescGZIP(), []int{5} +} + +func (x *AuthenticateRequest) GetOrgId() string { + if x != nil { + return x.OrgId + } + return "" +} + +func (x *AuthenticateRequest) GetAuthMethodId() string { + if x != nil { + return x.AuthMethodId + } + return "" +} + +func (x *AuthenticateRequest) GetTokenType() string { + if x != nil { + return x.TokenType + } + return "" +} + +func (x *AuthenticateRequest) GetPasswordCredential() *PasswordCredential { + if x != nil { + return x.PasswordCredential + } + return nil +} + +type AuthenticateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Item *authtokens.AuthToken `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` +} + +func (x *AuthenticateResponse) Reset() { + *x = AuthenticateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthenticateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticateResponse) ProtoMessage() {} + +func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthenticateResponse.ProtoReflect.Descriptor instead. +func (*AuthenticateResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_organization_service_proto_rawDescGZIP(), []int{6} +} + +func (x *AuthenticateResponse) GetItem() *authtokens.AuthToken { + if x != nil { + return x.Item + } + return nil +} + +type DeauthenticateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrgId string `protobuf:"bytes,1,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"` +} + +func (x *DeauthenticateRequest) Reset() { + *x = DeauthenticateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeauthenticateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeauthenticateRequest) ProtoMessage() {} + +func (x *DeauthenticateRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeauthenticateRequest.ProtoReflect.Descriptor instead. +func (*DeauthenticateRequest) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_organization_service_proto_rawDescGZIP(), []int{7} +} + +func (x *DeauthenticateRequest) GetOrgId() string { + if x != nil { + return x.OrgId + } + return "" +} + +type DeauthenticateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeauthenticateResponse) Reset() { + *x = DeauthenticateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeauthenticateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeauthenticateResponse) ProtoMessage() {} + +func (x *DeauthenticateResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_api_services_v1_organization_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeauthenticateResponse.ProtoReflect.Descriptor instead. +func (*DeauthenticateResponse) Descriptor() ([]byte, []int) { + return file_controller_api_services_v1_organization_service_proto_rawDescGZIP(), []int{8} +} + var File_controller_api_services_v1_organization_service_proto protoreflect.FileDescriptor var file_controller_api_services_v1_organization_service_proto_rawDesc = []byte{ @@ -244,56 +506,118 @@ var file_controller_api_services_v1_organization_service_proto_rawDesc = []byte{ 0x35, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3c, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x76, 0x69, 0x65, 0x77, 0x22, 0x5f, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x44, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2e, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x63, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, - 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x32, 0xff, 0x02, 0x0a, 0x13, 0x4f, - 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0xb6, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, - 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x1c, 0x12, - 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4f, - 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0xae, 0x01, 0x0a, 0x11, - 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x73, - 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x4f, - 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x4f, 0x5a, 0x4d, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, - 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x74, 0x6f, 0x77, 0x65, 0x72, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x36, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2f, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3c, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x5f, 0x0a, 0x17, + 0x47, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2e, 0x0a, + 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x69, 0x65, + 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x63, 0x0a, + 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4f, + 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x22, 0x4f, 0x0a, 0x12, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x69, + 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, + 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x22, 0xd2, 0x01, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x6f, + 0x72, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x72, 0x67, + 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5f, 0x0a, 0x13, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x52, 0x12, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x43, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x5d, 0x0a, 0x14, 0x41, 0x75, 0x74, 0x68, + 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x45, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x22, 0x2e, 0x0a, 0x15, 0x44, 0x65, 0x61, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x15, 0x0a, 0x06, 0x6f, 0x72, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x72, 0x67, 0x49, 0x64, 0x22, 0x18, 0x0a, 0x16, 0x44, 0x65, 0x61, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0xdb, 0x06, 0x0a, 0x13, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb6, 0x01, 0x0a, 0x0f, 0x47, 0x65, + 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x72, + 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x0d, + 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, + 0x74, 0x65, 0x6d, 0x92, 0x41, 0x1c, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, + 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0xae, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, + 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, + 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, + 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x73, 0x92, 0x41, 0x19, 0x12, 0x17, 0x4c, 0x69, 0x73, 0x74, + 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0xf4, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x80, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, + 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x73, 0x2f, 0x7b, 0x6f, 0x72, 0x67, 0x5f, + 0x69, 0x64, 0x7d, 0x3a, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x4e, 0x12, 0x4c, 0x41, 0x75, + 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x75, 0x73, 0x65, + 0x72, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6e, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, + 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2e, 0x12, 0xe2, 0x01, 0x0a, 0x0e, 0x44, + 0x65, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x31, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x61, 0x75, 0x74, + 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x32, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x69, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x22, 0x20, 0x2f, 0x76, + 0x31, 0x2f, 0x6f, 0x72, 0x67, 0x73, 0x2f, 0x7b, 0x6f, 0x72, 0x67, 0x5f, 0x69, 0x64, 0x7d, 0x3a, + 0x64, 0x65, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x92, 0x41, + 0x3e, 0x12, 0x3c, 0x44, 0x65, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x20, 0x61, 0x6e, 0x20, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x61, + 0x6e, 0x20, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x42, + 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, + 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x77, 0x61, 0x74, 0x63, 0x68, 0x74, 0x6f, 0x77, + 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -308,26 +632,38 @@ func file_controller_api_services_v1_organization_service_proto_rawDescGZIP() [] return file_controller_api_services_v1_organization_service_proto_rawDescData } -var file_controller_api_services_v1_organization_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_controller_api_services_v1_organization_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_controller_api_services_v1_organization_service_proto_goTypes = []interface{}{ (*GetOrganizationRequest)(nil), // 0: controller.api.services.v1.GetOrganizationRequest (*GetOrganizationResponse)(nil), // 1: controller.api.services.v1.GetOrganizationResponse (*ListOrganizationsRequest)(nil), // 2: controller.api.services.v1.ListOrganizationsRequest (*ListOrganizationsResponse)(nil), // 3: controller.api.services.v1.ListOrganizationsResponse - (*scopes.Organization)(nil), // 4: controller.api.resources.scopes.v1.Organization + (*PasswordCredential)(nil), // 4: controller.api.services.v1.PasswordCredential + (*AuthenticateRequest)(nil), // 5: controller.api.services.v1.AuthenticateRequest + (*AuthenticateResponse)(nil), // 6: controller.api.services.v1.AuthenticateResponse + (*DeauthenticateRequest)(nil), // 7: controller.api.services.v1.DeauthenticateRequest + (*DeauthenticateResponse)(nil), // 8: controller.api.services.v1.DeauthenticateResponse + (*scopes.Organization)(nil), // 9: controller.api.resources.scopes.v1.Organization + (*authtokens.AuthToken)(nil), // 10: controller.api.resources.authtokens.v1.AuthToken } var file_controller_api_services_v1_organization_service_proto_depIdxs = []int32{ - 4, // 0: controller.api.services.v1.GetOrganizationResponse.item:type_name -> controller.api.resources.scopes.v1.Organization - 4, // 1: controller.api.services.v1.ListOrganizationsResponse.items:type_name -> controller.api.resources.scopes.v1.Organization - 0, // 2: controller.api.services.v1.OrganizationService.GetOrganization:input_type -> controller.api.services.v1.GetOrganizationRequest - 2, // 3: controller.api.services.v1.OrganizationService.ListOrganizations:input_type -> controller.api.services.v1.ListOrganizationsRequest - 1, // 4: controller.api.services.v1.OrganizationService.GetOrganization:output_type -> controller.api.services.v1.GetOrganizationResponse - 3, // 5: controller.api.services.v1.OrganizationService.ListOrganizations:output_type -> controller.api.services.v1.ListOrganizationsResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 9, // 0: controller.api.services.v1.GetOrganizationResponse.item:type_name -> controller.api.resources.scopes.v1.Organization + 9, // 1: controller.api.services.v1.ListOrganizationsResponse.items:type_name -> controller.api.resources.scopes.v1.Organization + 4, // 2: controller.api.services.v1.AuthenticateRequest.password_credential:type_name -> controller.api.services.v1.PasswordCredential + 10, // 3: controller.api.services.v1.AuthenticateResponse.item:type_name -> controller.api.resources.authtokens.v1.AuthToken + 0, // 4: controller.api.services.v1.OrganizationService.GetOrganization:input_type -> controller.api.services.v1.GetOrganizationRequest + 2, // 5: controller.api.services.v1.OrganizationService.ListOrganizations:input_type -> controller.api.services.v1.ListOrganizationsRequest + 5, // 6: controller.api.services.v1.OrganizationService.Authenticate:input_type -> controller.api.services.v1.AuthenticateRequest + 7, // 7: controller.api.services.v1.OrganizationService.Deauthenticate:input_type -> controller.api.services.v1.DeauthenticateRequest + 1, // 8: controller.api.services.v1.OrganizationService.GetOrganization:output_type -> controller.api.services.v1.GetOrganizationResponse + 3, // 9: controller.api.services.v1.OrganizationService.ListOrganizations:output_type -> controller.api.services.v1.ListOrganizationsResponse + 6, // 10: controller.api.services.v1.OrganizationService.Authenticate:output_type -> controller.api.services.v1.AuthenticateResponse + 8, // 11: controller.api.services.v1.OrganizationService.Deauthenticate:output_type -> controller.api.services.v1.DeauthenticateResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_controller_api_services_v1_organization_service_proto_init() } @@ -384,6 +720,66 @@ func file_controller_api_services_v1_organization_service_proto_init() { return nil } } + file_controller_api_services_v1_organization_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PasswordCredential); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_organization_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthenticateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_organization_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthenticateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_organization_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeauthenticateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_api_services_v1_organization_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeauthenticateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -391,7 +787,7 @@ func file_controller_api_services_v1_organization_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_api_services_v1_organization_service_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, @@ -423,6 +819,10 @@ type OrganizationServiceClient interface { GetOrganization(ctx context.Context, in *GetOrganizationRequest, opts ...grpc.CallOption) (*GetOrganizationResponse, error) // ListOrganizations returns a list of stored organizations which exist in watchtower. ListOrganizations(ctx context.Context, in *ListOrganizationsRequest, opts ...grpc.CallOption) (*ListOrganizationsResponse, error) + // Authenticate validates credentials provided and returns an auth token. + Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) + // Logout terminates a user's current session. + Deauthenticate(ctx context.Context, in *DeauthenticateRequest, opts ...grpc.CallOption) (*DeauthenticateResponse, error) } type organizationServiceClient struct { @@ -451,6 +851,24 @@ func (c *organizationServiceClient) ListOrganizations(ctx context.Context, in *L return out, nil } +func (c *organizationServiceClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { + out := new(AuthenticateResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.OrganizationService/Authenticate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *organizationServiceClient) Deauthenticate(ctx context.Context, in *DeauthenticateRequest, opts ...grpc.CallOption) (*DeauthenticateResponse, error) { + out := new(DeauthenticateResponse) + err := c.cc.Invoke(ctx, "/controller.api.services.v1.OrganizationService/Deauthenticate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // OrganizationServiceServer is the server API for OrganizationService service. type OrganizationServiceServer interface { // GetOrganization returns a stored Organization if present. The provided request @@ -459,6 +877,10 @@ type OrganizationServiceServer interface { GetOrganization(context.Context, *GetOrganizationRequest) (*GetOrganizationResponse, error) // ListOrganizations returns a list of stored organizations which exist in watchtower. ListOrganizations(context.Context, *ListOrganizationsRequest) (*ListOrganizationsResponse, error) + // Authenticate validates credentials provided and returns an auth token. + Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) + // Logout terminates a user's current session. + Deauthenticate(context.Context, *DeauthenticateRequest) (*DeauthenticateResponse, error) } // UnimplementedOrganizationServiceServer can be embedded to have forward compatible implementations. @@ -471,6 +893,12 @@ func (*UnimplementedOrganizationServiceServer) GetOrganization(context.Context, func (*UnimplementedOrganizationServiceServer) ListOrganizations(context.Context, *ListOrganizationsRequest) (*ListOrganizationsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListOrganizations not implemented") } +func (*UnimplementedOrganizationServiceServer) Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") +} +func (*UnimplementedOrganizationServiceServer) Deauthenticate(context.Context, *DeauthenticateRequest) (*DeauthenticateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deauthenticate not implemented") +} func RegisterOrganizationServiceServer(s *grpc.Server, srv OrganizationServiceServer) { s.RegisterService(&_OrganizationService_serviceDesc, srv) @@ -512,6 +940,42 @@ func _OrganizationService_ListOrganizations_Handler(srv interface{}, ctx context return interceptor(ctx, in, info, handler) } +func _OrganizationService_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthenticateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).Authenticate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.OrganizationService/Authenticate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).Authenticate(ctx, req.(*AuthenticateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _OrganizationService_Deauthenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeauthenticateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OrganizationServiceServer).Deauthenticate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.api.services.v1.OrganizationService/Deauthenticate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OrganizationServiceServer).Deauthenticate(ctx, req.(*DeauthenticateRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _OrganizationService_serviceDesc = grpc.ServiceDesc{ ServiceName: "controller.api.services.v1.OrganizationService", HandlerType: (*OrganizationServiceServer)(nil), @@ -524,6 +988,14 @@ var _OrganizationService_serviceDesc = grpc.ServiceDesc{ MethodName: "ListOrganizations", Handler: _OrganizationService_ListOrganizations_Handler, }, + { + MethodName: "Authenticate", + Handler: _OrganizationService_Authenticate_Handler, + }, + { + MethodName: "Deauthenticate", + Handler: _OrganizationService_Deauthenticate_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "controller/api/services/v1/organization_service.proto", diff --git a/internal/gen/controller/api/services/organization_service.pb.gw.go b/internal/gen/controller/api/services/organization_service.pb.gw.go index ec5cd43f0..30c4beb95 100644 --- a/internal/gen/controller/api/services/organization_service.pb.gw.go +++ b/internal/gen/controller/api/services/organization_service.pb.gw.go @@ -139,6 +139,130 @@ func local_request_OrganizationService_ListOrganizations_0(ctx context.Context, } +func request_OrganizationService_Authenticate_0(ctx context.Context, marshaler runtime.Marshaler, client OrganizationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuthenticateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["org_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "org_id") + } + + protoReq.OrgId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "org_id", err) + } + + msg, err := client.Authenticate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_OrganizationService_Authenticate_0(ctx context.Context, marshaler runtime.Marshaler, server OrganizationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AuthenticateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["org_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "org_id") + } + + protoReq.OrgId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "org_id", err) + } + + msg, err := server.Authenticate(ctx, &protoReq) + return msg, metadata, err + +} + +func request_OrganizationService_Deauthenticate_0(ctx context.Context, marshaler runtime.Marshaler, client OrganizationServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeauthenticateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["org_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "org_id") + } + + protoReq.OrgId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "org_id", err) + } + + msg, err := client.Deauthenticate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_OrganizationService_Deauthenticate_0(ctx context.Context, marshaler runtime.Marshaler, server OrganizationServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeauthenticateRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["org_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "org_id") + } + + protoReq.OrgId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "org_id", err) + } + + msg, err := server.Deauthenticate(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterOrganizationServiceHandlerServer registers the http handlers for service OrganizationService to "mux". // UnaryRPC :call OrganizationServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -184,6 +308,46 @@ func RegisterOrganizationServiceHandlerServer(ctx context.Context, mux *runtime. }) + mux.Handle("POST", pattern_OrganizationService_Authenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OrganizationService_Authenticate_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_OrganizationService_Authenticate_0(ctx, mux, outboundMarshaler, w, req, response_OrganizationService_Authenticate_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_OrganizationService_Deauthenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_OrganizationService_Deauthenticate_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_OrganizationService_Deauthenticate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -265,6 +429,46 @@ func RegisterOrganizationServiceHandlerClient(ctx context.Context, mux *runtime. }) + mux.Handle("POST", pattern_OrganizationService_Authenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OrganizationService_Authenticate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_OrganizationService_Authenticate_0(ctx, mux, outboundMarshaler, w, req, response_OrganizationService_Authenticate_0{resp}, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_OrganizationService_Deauthenticate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_OrganizationService_Deauthenticate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_OrganizationService_Deauthenticate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -277,14 +481,31 @@ func (m response_OrganizationService_GetOrganization_0) XXX_ResponseBody() inter return response.Item } +type response_OrganizationService_Authenticate_0 struct { + proto.Message +} + +func (m response_OrganizationService_Authenticate_0) XXX_ResponseBody() interface{} { + response := m.Message.(*AuthenticateResponse) + return response.Item +} + var ( pattern_OrganizationService_GetOrganization_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "orgs", "id"}, "", runtime.AssumeColonVerbOpt(true))) pattern_OrganizationService_ListOrganizations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "orgs"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_OrganizationService_Authenticate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "orgs", "org_id"}, "authenticate", runtime.AssumeColonVerbOpt(true))) + + pattern_OrganizationService_Deauthenticate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "orgs", "org_id"}, "deauthenticate", runtime.AssumeColonVerbOpt(true))) ) var ( forward_OrganizationService_GetOrganization_0 = runtime.ForwardResponseMessage forward_OrganizationService_ListOrganizations_0 = runtime.ForwardResponseMessage + + forward_OrganizationService_Authenticate_0 = runtime.ForwardResponseMessage + + forward_OrganizationService_Deauthenticate_0 = runtime.ForwardResponseMessage ) diff --git a/internal/proto/local/controller/api/resources/authtokens/v1/authtoken.proto b/internal/proto/local/controller/api/resources/authtokens/v1/authtoken.proto new file mode 100644 index 000000000..9170e7001 --- /dev/null +++ b/internal/proto/local/controller/api/resources/authtokens/v1/authtoken.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package controller.api.resources.authtokens.v1; + +option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/authtokens;authtokens"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +// AuthToken contains all fields related to an AuthToken resource +message AuthToken { + // The ID of the AuthToken + // Output only. + string id = 1; + + // The token. This will only be populated after login and is only ever visible to the end user whose login + // request resulted in this auth token being created. + // Output only. + string token = 2; + + // The id of the user of this AuthToken. + // Output only. + string user_id = 4 [json_name="user_id"]; + + // The id of the user of this AuthToken. + // Output only. + string auth_method_id = 5 [json_name="auth_method_id"]; + + // The time this resource was created + // Output only. + google.protobuf.Timestamp created_time = 6 [json_name="created_time"]; + + // The time this resource was last updated. + // Output only. + google.protobuf.Timestamp updated_time = 7 [json_name="updated_time"]; + + // The approximate time this AuthToken was last used. + // Output only. + google.protobuf.Timestamp approximate_last_used_time = 8 [json_name = "approximate_last_used_time"]; + + // The time this AuthToken expires. + // Output only. + google.protobuf.Timestamp expiration_time = 9 [json_name="expiration_time"]; +} diff --git a/internal/proto/local/controller/api/services/v1/organization_service.proto b/internal/proto/local/controller/api/services/v1/organization_service.proto index 74d277246..e654f8961 100644 --- a/internal/proto/local/controller/api/services/v1/organization_service.proto +++ b/internal/proto/local/controller/api/services/v1/organization_service.proto @@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api import "protoc-gen-swagger/options/annotations.proto"; import "google/api/annotations.proto"; import "controller/api/resources/scopes/v1/organization.proto"; +import "controller/api/resources/authtokens/v1/authtoken.proto"; service OrganizationService { @@ -32,6 +33,28 @@ service OrganizationService { summary: "Lists all Organizations" }; } + + // Authenticate validates credentials provided and returns an auth token. + rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) { + option (google.api.http) = { + post: "/v1/orgs/{org_id}:authenticate" + body: "*" + response_body: "item" + }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + summary: "Authenticate a user to an Organization and retrieve an authentication token." + }; + } + + // Logout terminates a user's current session. + rpc Deauthenticate(DeauthenticateRequest) returns (DeauthenticateResponse) { + option (google.api.http) = { + post: "/v1/orgs/{org_id}:deauthenticate" + }; + option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { + summary: "Deauthenticate an authentication token from an Organization." + }; + } } message GetOrganizationRequest { @@ -50,3 +73,28 @@ message ListOrganizationsRequest { message ListOrganizationsResponse { repeated resources.scopes.v1.Organization items = 1; } + +message PasswordCredential { + string login_name = 1; + string password = 2; +} + +message AuthenticateRequest { + string org_id = 1; + // The id to the authmethod in the system being used for authentication. The auth method must be in the org + // being logged in to. + string auth_method_id = 2; + // This can be "cookie" or "token". If not provided, "token" will be used. For now only type "token" is returned. + string token_type = 3; + + PasswordCredential password_credential = 4; +} + +message AuthenticateResponse { + resources.authtokens.v1.AuthToken item = 1; +} + +message DeauthenticateRequest { + string org_id = 1; +} +message DeauthenticateResponse {} \ No newline at end of file diff --git a/internal/servers/controller/handlers/organizations/organization_service.go b/internal/servers/controller/handlers/organizations/organization_service.go index 4c79fa386..bddbcfa67 100644 --- a/internal/servers/controller/handlers/organizations/organization_service.go +++ b/internal/servers/controller/handlers/organizations/organization_service.go @@ -12,6 +12,8 @@ import ( "github.com/hashicorp/watchtower/internal/servers/controller/common" "github.com/hashicorp/watchtower/internal/servers/controller/handlers" "github.com/hashicorp/watchtower/internal/types/scope" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -57,6 +59,16 @@ func (s Service) GetOrganization(ctx context.Context, req *pbs.GetOrganizationRe return &pbs.GetOrganizationResponse{Item: o}, nil } +// Authenticate implements the interface pbs.OrganizationServiceServer. +func (s Service) Authenticate(ctx context.Context, req *pbs.AuthenticateRequest) (*pbs.AuthenticateResponse, error) { + return nil, status.Error(codes.Unimplemented, "Requested method is unimplemented for Organization.") +} + +// Deauthenticate implements the interface pbs.OrganizationServiceServer. +func (s Service) Deauthenticate(ctx context.Context, req *pbs.DeauthenticateRequest) (*pbs.DeauthenticateResponse, error) { + return nil, status.Error(codes.Unimplemented, "Requested method is unimplemented for Organization.") +} + func (s Service) getFromRepo(ctx context.Context, id string) (*pb.Organization, error) { repo, err := s.repo() if err != nil {