From cd55d2d1daba2f823bb431a261ff6fee60fb1e0d Mon Sep 17 00:00:00 2001 From: Abhijit Mukherjee Date: Mon, 26 Dec 2022 11:55:19 +0530 Subject: [PATCH] record user.login event by kratos hooks (#111) * record user.login event by kratos hooks Signed-off-by: mabhi * added test case for create login auditlog Signed-off-by: mabhi * updated change log Signed-off-by: mabhi --- CHANGELOG.md | 3 + gen/openapi/proto/rpc/user/user.swagger.json | 378 +++++++++++----- main.go | 1 + pkg/service/audit_utils.go | 19 + pkg/service/user.go | 23 + pkg/service/user_test.go | 45 ++ proto/rpc/user/user.pb.go | 435 ++++++++++++------- proto/rpc/user/user.pb.gw.go | 347 ++++++++++----- proto/rpc/user/user.proto | 12 + proto/rpc/user/user_grpc.pb.go | 36 ++ server/user.go | 4 + 11 files changed, 934 insertions(+), 369 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9a69dc..685ccce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. ## Unreleased +## Added +- Enhance: record user.login event via kratos hooks [mabhi](https://github.com/mabhi) + ## Fixed - Fix modify userinfo service to include scope in response [mabhi](https://github.com/mabhi) diff --git a/gen/openapi/proto/rpc/user/user.swagger.json b/gen/openapi/proto/rpc/user/user.swagger.json index d8b2638..dee057f 100644 --- a/gen/openapi/proto/rpc/user/user.swagger.json +++ b/gen/openapi/proto/rpc/user/user.swagger.json @@ -57,6 +57,49 @@ ] } }, + "/auth/v3/user/auditlog": { + "post": { + "operationId": "UserService_AuditLogWebhook", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v3UserLoginAuditResponse" + } + }, + "403": { + "description": "Returned when the user does not have permission to access the resource.", + "schema": {} + }, + "404": { + "description": "Returned when the resource does not exist.", + "schema": { + "type": "string", + "format": "string" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v3UserLoginAuditRequest" + } + } + ], + "tags": [ + "UserService" + ] + } + }, "/auth/v3/user/{metadata.name}": { "get": { "operationId": "UserService_GetUser", @@ -95,51 +138,51 @@ }, { "name": "apiVersion", - "description": "API Version. API Version of the user resource", + "description": "API Version\n\nAPI Version of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "system.k8smgmt.io/v3" }, { "name": "kind", - "description": "Kind. Kind of the user resource", + "description": "Kind\n\nKind of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "User" }, { "name": "metadata.displayName", - "description": "Display Name. display name of the resource", + "description": "Display Name\n\ndisplay name of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.description", - "description": "Description. description of the resource", + "description": "Description\n\ndescription of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.project", - "description": "Project. Project of the resource", + "description": "Project\n\nProject of the resource", "in": "query", - "required": false, + "required": true, "type": "string" }, { "name": "metadata.organization", - "description": "Organization. Organization to which the resource belongs", + "description": "Organization\n\nOrganization to which the resource belongs", "in": "query", "required": false, "type": "string" }, { "name": "metadata.partner", - "description": "Partner. Partner to which the resource belongs", + "description": "Partner\n\nPartner to which the resource belongs", "in": "query", "required": false, "type": "string" @@ -172,92 +215,94 @@ }, { "name": "spec.firstName", - "description": "FirstName. First name of the user", + "description": "FirstName\n\nFirst name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastName", - "description": "LastName. Last name of the user", + "description": "LastName\n\nLast name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.phone", - "description": "Phone. Phone number of the user", + "description": "Phone\n\nPhone number of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.password", - "description": "Password. Password of the user", + "description": "Password\n\nPassword of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.groups", - "description": "Group. Groups the user belongs to", + "description": "Group\n\nGroups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.idpGroups", - "description": "Idp Group. Idp Groups the user belongs to", + "description": "Idp Group\n\nIdp Groups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.emailVerified", - "description": "EmailVerified. Flag to show if the email of the user was verified", + "description": "EmailVerified\n\nFlag to show if the email of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.phoneVerified", - "description": "PhoneVerified. Flag to show if phone number of the user was verified", + "description": "PhoneVerified\n\nFlag to show if phone number of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.recoveryUrl", - "description": "Recovery Url. Initial signup URL returned after user creation", + "description": "Recovery Url\n\nInitial signup URL returned after user creation", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastLogin", - "description": "LastLogin. Last access date time in RFC3339 format.", + "description": "LastLogin\n\nLast access date time in RFC3339 format.", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionType", - "description": "Condition Type. type of the status condition", + "description": "Condition Type\n\ntype of the status condition", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionStatus", - "description": "Condition Status. status of the condition", + "description": "Condition Status\n\nstatus of the condition", "in": "query", "required": false, "type": "string", @@ -271,7 +316,7 @@ }, { "name": "status.lastUpdated", - "description": "Last Updated. when the condition status is last updated", + "description": "Last Updated\n\nwhen the condition status is last updated", "in": "query", "required": false, "type": "string", @@ -279,7 +324,7 @@ }, { "name": "status.reason", - "description": "Reason. reason of the last condition status", + "description": "Reason\n\nreason of the last condition status", "in": "query", "required": false, "type": "string" @@ -330,51 +375,51 @@ }, { "name": "apiVersion", - "description": "API Version. API Version of the user resource", + "description": "API Version\n\nAPI Version of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "system.k8smgmt.io/v3" }, { "name": "kind", - "description": "Kind. Kind of the user resource", + "description": "Kind\n\nKind of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "User" }, { "name": "metadata.displayName", - "description": "Display Name. display name of the resource", + "description": "Display Name\n\ndisplay name of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.description", - "description": "Description. description of the resource", + "description": "Description\n\ndescription of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.project", - "description": "Project. Project of the resource", + "description": "Project\n\nProject of the resource", "in": "query", - "required": false, + "required": true, "type": "string" }, { "name": "metadata.organization", - "description": "Organization. Organization to which the resource belongs", + "description": "Organization\n\nOrganization to which the resource belongs", "in": "query", "required": false, "type": "string" }, { "name": "metadata.partner", - "description": "Partner. Partner to which the resource belongs", + "description": "Partner\n\nPartner to which the resource belongs", "in": "query", "required": false, "type": "string" @@ -407,92 +452,94 @@ }, { "name": "spec.firstName", - "description": "FirstName. First name of the user", + "description": "FirstName\n\nFirst name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastName", - "description": "LastName. Last name of the user", + "description": "LastName\n\nLast name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.phone", - "description": "Phone. Phone number of the user", + "description": "Phone\n\nPhone number of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.password", - "description": "Password. Password of the user", + "description": "Password\n\nPassword of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.groups", - "description": "Group. Groups the user belongs to", + "description": "Group\n\nGroups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.idpGroups", - "description": "Idp Group. Idp Groups the user belongs to", + "description": "Idp Group\n\nIdp Groups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.emailVerified", - "description": "EmailVerified. Flag to show if the email of the user was verified", + "description": "EmailVerified\n\nFlag to show if the email of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.phoneVerified", - "description": "PhoneVerified. Flag to show if phone number of the user was verified", + "description": "PhoneVerified\n\nFlag to show if phone number of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.recoveryUrl", - "description": "Recovery Url. Initial signup URL returned after user creation", + "description": "Recovery Url\n\nInitial signup URL returned after user creation", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastLogin", - "description": "LastLogin. Last access date time in RFC3339 format.", + "description": "LastLogin\n\nLast access date time in RFC3339 format.", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionType", - "description": "Condition Type. type of the status condition", + "description": "Condition Type\n\ntype of the status condition", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionStatus", - "description": "Condition Status. status of the condition", + "description": "Condition Status\n\nstatus of the condition", "in": "query", "required": false, "type": "string", @@ -506,7 +553,7 @@ }, { "name": "status.lastUpdated", - "description": "Last Updated. when the condition status is last updated", + "description": "Last Updated\n\nwhen the condition status is last updated", "in": "query", "required": false, "type": "string", @@ -514,7 +561,7 @@ }, { "name": "status.reason", - "description": "Reason. reason of the last condition status", + "description": "Reason\n\nreason of the last condition status", "in": "query", "required": false, "type": "string" @@ -564,7 +611,111 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v3User" + "type": "object", + "properties": { + "apiVersion": { + "type": "string", + "default": "system.k8smgmt.io/v3", + "description": "API Version of the user resource", + "title": "API Version" + }, + "kind": { + "type": "string", + "default": "User", + "description": "Kind of the user resource", + "title": "Kind" + }, + "metadata": { + "type": "object", + "example": { + "name": "some-name", + "project": "defaultproject" + }, + "properties": { + "displayName": { + "type": "string", + "description": "display name of the resource", + "title": "Display Name" + }, + "description": { + "type": "string", + "description": "description of the resource", + "title": "Description" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "labels of the resource", + "title": "Labels" + }, + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "annotations of the resource", + "title": "Annotations" + }, + "project": { + "type": "string", + "description": "Project of the resource", + "title": "Project" + }, + "organization": { + "type": "string", + "description": "Organization to which the resource belongs", + "title": "Organization" + }, + "partner": { + "type": "string", + "description": "Partner to which the resource belongs", + "title": "Partner" + }, + "id": { + "type": "string", + "readOnly": true + }, + "urlScope": { + "type": "string", + "readOnly": true + }, + "createdAt": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "modifiedAt": { + "type": "string", + "format": "date-time", + "readOnly": true + } + }, + "description": "metadata of the resource", + "title": "Metadata" + }, + "spec": { + "$ref": "#/definitions/v3UserSpec", + "description": "Spec of the user resource", + "title": "Spec" + }, + "status": { + "$ref": "#/definitions/commonv3Status", + "description": "Status of the resource", + "title": "Status", + "readOnly": true + } + }, + "description": "User", + "title": "User", + "required": [ + "apiVersion", + "kind", + "metadata", + "spec", + "project" + ] } } ], @@ -739,58 +890,58 @@ "parameters": [ { "name": "apiVersion", - "description": "API Version. API Version of the user resource", + "description": "API Version\n\nAPI Version of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "system.k8smgmt.io/v3" }, { "name": "kind", - "description": "Kind. Kind of the user resource", + "description": "Kind\n\nKind of the user resource", "in": "query", - "required": false, + "required": true, "type": "string", "default": "User" }, { "name": "metadata.name", - "description": "Name. name of the resource", + "description": "Name\n\nname of the resource", "in": "query", - "required": false, + "required": true, "type": "string" }, { "name": "metadata.displayName", - "description": "Display Name. display name of the resource", + "description": "Display Name\n\ndisplay name of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.description", - "description": "Description. description of the resource", + "description": "Description\n\ndescription of the resource", "in": "query", "required": false, "type": "string" }, { "name": "metadata.project", - "description": "Project. Project of the resource", + "description": "Project\n\nProject of the resource", "in": "query", - "required": false, + "required": true, "type": "string" }, { "name": "metadata.organization", - "description": "Organization. Organization to which the resource belongs", + "description": "Organization\n\nOrganization to which the resource belongs", "in": "query", "required": false, "type": "string" }, { "name": "metadata.partner", - "description": "Partner. Partner to which the resource belongs", + "description": "Partner\n\nPartner to which the resource belongs", "in": "query", "required": false, "type": "string" @@ -823,92 +974,94 @@ }, { "name": "spec.firstName", - "description": "FirstName. First name of the user", + "description": "FirstName\n\nFirst name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastName", - "description": "LastName. Last name of the user", + "description": "LastName\n\nLast name of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.phone", - "description": "Phone. Phone number of the user", + "description": "Phone\n\nPhone number of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.password", - "description": "Password. Password of the user", + "description": "Password\n\nPassword of the user", "in": "query", "required": false, "type": "string" }, { "name": "spec.groups", - "description": "Group. Groups the user belongs to", + "description": "Group\n\nGroups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.idpGroups", - "description": "Idp Group. Idp Groups the user belongs to", + "description": "Idp Group\n\nIdp Groups the user belongs to", "in": "query", "required": false, "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "collectionFormat": "multi" }, { "name": "spec.emailVerified", - "description": "EmailVerified. Flag to show if the email of the user was verified", + "description": "EmailVerified\n\nFlag to show if the email of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.phoneVerified", - "description": "PhoneVerified. Flag to show if phone number of the user was verified", + "description": "PhoneVerified\n\nFlag to show if phone number of the user was verified", "in": "query", "required": false, "type": "boolean" }, { "name": "spec.recoveryUrl", - "description": "Recovery Url. Initial signup URL returned after user creation", + "description": "Recovery Url\n\nInitial signup URL returned after user creation", "in": "query", "required": false, "type": "string" }, { "name": "spec.lastLogin", - "description": "LastLogin. Last access date time in RFC3339 format.", + "description": "LastLogin\n\nLast access date time in RFC3339 format.", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionType", - "description": "Condition Type. type of the status condition", + "description": "Condition Type\n\ntype of the status condition", "in": "query", "required": false, "type": "string" }, { "name": "status.conditionStatus", - "description": "Condition Status. status of the condition", + "description": "Condition Status\n\nstatus of the condition", "in": "query", "required": false, "type": "string", @@ -922,7 +1075,7 @@ }, { "name": "status.lastUpdated", - "description": "Last Updated. when the condition status is last updated", + "description": "Last Updated\n\nwhen the condition status is last updated", "in": "query", "required": false, "type": "string", @@ -930,7 +1083,7 @@ }, { "name": "status.reason", - "description": "Reason. reason of the last condition status", + "description": "Reason\n\nreason of the last condition status", "in": "query", "required": false, "type": "string" @@ -972,21 +1125,21 @@ "parameters": [ { "name": "q", - "description": "query for filtering.", + "description": "query for filtering", "in": "query", "required": false, "type": "string" }, { "name": "name", - "description": "name is unique ID of a resource along with (partnerID, organizationID,\nprojectID).", + "description": "name is unique ID of a resource along with (partnerID, organizationID,\nprojectID)", "in": "query", "required": false, "type": "string" }, { "name": "selector", - "description": "selector is used to filter the labels of a resource.", + "description": "selector is used to filter the labels of a resource", "in": "query", "required": false, "type": "string" @@ -1023,7 +1176,7 @@ }, { "name": "displayName", - "description": "displayName only used for update queries to set displayName (READONLY).", + "description": "displayName only used for update queries to set displayName (READONLY)", "in": "query", "required": false, "type": "string" @@ -1051,14 +1204,14 @@ }, { "name": "ignoreScopeDefault", - "description": "ignoreScopeDefault ignores default values for partnerID, organizationID and\nprojectID.", + "description": "ignoreScopeDefault ignores default values for partnerID, organizationID and\nprojectID", "in": "query", "required": false, "type": "boolean" }, { "name": "globalScope", - "description": "globalScope sets partnerID,organizationID,projectID = 0.", + "description": "globalScope sets partnerID,organizationID,projectID = 0", "in": "query", "required": false, "type": "boolean" @@ -1089,7 +1242,7 @@ }, { "name": "urlScope", - "description": "urlScope is supposed to be passed in the URL as kind/HashID(value).", + "description": "urlScope is supposed to be passed in the URL as kind/HashID(value)", "in": "query", "required": false, "type": "string" @@ -1148,7 +1301,7 @@ }, { "name": "type", - "description": "generic way to specify a type of resource, mainly for use in users endpoint.", + "description": "generic way to specify a type of resource, mainly for use in users endpoint", "in": "query", "required": false, "type": "string" @@ -1192,6 +1345,7 @@ "parameters": [ { "name": "body", + "description": "User", "in": "body", "required": true, "schema": { @@ -1442,6 +1596,11 @@ }, "description": "Permissions provided by role", "title": "Permissions" + }, + "scope": { + "type": "string", + "description": "Scope holds information about org wide, project or namespace access", + "title": "Scope" } }, "description": "Permissions", @@ -1588,20 +1747,20 @@ "groups": { "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "description": "Groups the user belongs to", - "title": "Group", - "readOnly": true + "title": "Group" }, "idpGroups": { "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "description": "Idp Groups the user belongs to", - "title": "Idp Group", - "readOnly": true + "title": "Idp Group" }, "permissions": { "type": "array", @@ -1653,11 +1812,11 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/v3User" + "$ref": "#/definitions/v3User", + "readOnly": true }, "description": "List of the user resources", - "title": "Items", - "readOnly": true + "title": "Items" } }, "description": "User list", @@ -1675,6 +1834,17 @@ } } }, + "v3UserLoginAuditRequest": { + "type": "object", + "properties": { + "userId": { + "type": "string" + } + } + }, + "v3UserLoginAuditResponse": { + "type": "object" + }, "v3UserSpec": { "type": "object", "properties": { @@ -1701,20 +1871,20 @@ "groups": { "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "description": "Groups the user belongs to", - "title": "Group", - "readOnly": true + "title": "Group" }, "idpGroups": { "type": "array", "items": { - "type": "string" + "type": "string", + "readOnly": true }, "description": "Idp Groups the user belongs to", - "title": "Idp Group", - "readOnly": true + "title": "Idp Group" }, "projectNamespaceRoles": { "type": "array", diff --git a/main.go b/main.go index ca482f0..d9b7d9e 100644 --- a/main.go +++ b/main.go @@ -637,6 +637,7 @@ func runRPC(wg *sync.WaitGroup, ctx context.Context) { "/paralus.dev.sentry.rpc.BootstrapService/RegisterBootstrapAgent", "/paralus.dev.sentry.rpc.KubeConfigService/GetForClusterWebSession", //TODO: enable auth from prompt "/paralus.dev.rpc.auth.v3.AuthService/IsRequestAllowed", + "/paralus.dev.rpc.user.v3.UserService/AuditLogWebhook", }, ExcludeAuthzMethods: []string{ "/paralus.dev.rpc.user.v3.UserService/GetUserInfo", diff --git a/pkg/service/audit_utils.go b/pkg/service/audit_utils.go index 019b11c..34f43f4 100644 --- a/pkg/service/audit_utils.go +++ b/pkg/service/audit_utils.go @@ -112,6 +112,25 @@ func CreateUserAuditEvent(ctx context.Context, al *zap.Logger, db bun.IDB, actio } } +func CreateUserLoginAuditEvent(ctx context.Context, al *zap.Logger, action string, name string) { + sd, ok := GetSessionDataFromContext(ctx) + if !ok { + _log.Warn("unable to create audit event: could not fetch info from context") + return + } + + detail := &audit.EventDetail{ + Message: fmt.Sprintf("User login: %s", name), + Meta: map[string]string{ + "user": name, + }, + } + if err := audit.CreateV1Event(al, sd, detail, fmt.Sprintf("user.%s.success", action), ""); err != nil { + _log.Warn("unable to create audit event", err) + } + +} + func CreateGroupAuditEvent(ctx context.Context, al *zap.Logger, db bun.IDB, action string, name string, id uuid.UUID, usersBefore, usersAfter, rolesBefore, rolesAfter []uuid.UUID) { sd, ok := GetSessionDataFromContext(ctx) if !ok { diff --git a/pkg/service/user.go b/pkg/service/user.go index 4a7ba52..edf0d59 100644 --- a/pkg/service/user.go +++ b/pkg/service/user.go @@ -21,6 +21,7 @@ import ( "github.com/paralus/paralus/pkg/utils" userrpcv3 "github.com/paralus/paralus/proto/rpc/user" authzv1 "github.com/paralus/paralus/proto/types/authz" + commonv3 "github.com/paralus/paralus/proto/types/commonpb/v3" v3 "github.com/paralus/paralus/proto/types/commonpb/v3" userv3 "github.com/paralus/paralus/proto/types/userpb/v3" ) @@ -52,6 +53,8 @@ type UserService interface { UpdateIdpUserGroupPolicy(context.Context, string, string, string) error // Generate recovery link for users ForgotPassword(context.Context, *userrpcv3.UserForgotPasswordRequest) (*userrpcv3.UserForgotPasswordResponse, error) + // Generate auditLog event + CreateLoginAuditLog(context.Context, *userrpcv3.UserLoginAuditRequest) (*userrpcv3.UserLoginAuditResponse, error) } type userService struct { @@ -1072,6 +1075,26 @@ func (s *userService) ForgotPassword(ctx context.Context, req *userrpcv3.UserFor } } +func (s *userService) CreateLoginAuditLog(ctx context.Context, req *userrpcv3.UserLoginAuditRequest) (*userrpcv3.UserLoginAuditResponse, error) { + uid, err := uuid.Parse(req.UserId) + if err != nil { + return &userrpcv3.UserLoginAuditResponse{}, fmt.Errorf("unable to create login audit event. reason: uid parse error.%v", err.Error()) + } + + entities, err := dao.GetUserNamesByIds(ctx, s.db, []uuid.UUID{uid}, &models.KratosIdentities{}) + if err != nil { + return &userrpcv3.UserLoginAuditResponse{}, fmt.Errorf("unable to create login audit event. reason: internal error. %v", err.Error()) + } + if len(entities) == 0 { + return &userrpcv3.UserLoginAuditResponse{}, fmt.Errorf("unable to create login audit event. reason: user not found") + } + username := entities[0] + new_ctx := context.WithValue(ctx, common.SessionDataKey, &commonv3.SessionData{Username: username}) + CreateUserLoginAuditEvent(new_ctx, s.al, "login", username) + + return &userrpcv3.UserLoginAuditResponse{}, nil +} + func (s *userService) getUserLastLogin(ctx context.Context, userId uuid.UUID) (string, error) { var lastLogin string authTime, err := dao.GetUserLastAuthTime(ctx, s.db, userId) diff --git a/pkg/service/user_test.go b/pkg/service/user_test.go index b40aaca..d287596 100644 --- a/pkg/service/user_test.go +++ b/pkg/service/user_test.go @@ -3,6 +3,7 @@ package service import ( "context" "fmt" + "regexp" "strings" "testing" "time" @@ -854,3 +855,47 @@ func TestUserRetrieveCliConfigCreate(t *testing.T) { t.Error("invalid partner name") } } + +func TestCreateLoginAuditLog(t *testing.T) { + tt := []struct { + name string + uuid string + invalid bool + shouldHaveError bool + }{ + {"invalid uid format", "user-" + uuid.New().String(), false, true}, + {"invalid user id", uuid.New().String(), true, true}, + {"valid user id", uuid.New().String(), false, false}, + } + + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + db, mock := getDB(t) + defer db.Close() + + ap := &mockAuthProvider{} + mazc := mockAuthzClient{} + us := NewUserService(ap, db, &mazc, nil, common.CliConfigDownloadData{}, getLogger(), true) + if tc.invalid { + + uid := uuid.New().String() + // without regexp QuoteMeta, getting mismatch actual and required SQL queries + mock.ExpectQuery(regexp.QuoteMeta(`SELECT traits ->> 'email' as name FROM "identities" WHERE (id = ('` + uid + `'))`)). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"traits"}).AddRow([]byte(`{"email":"johndoe@provider.com"}`))) + + } else { + mock.ExpectQuery(regexp.QuoteMeta(`SELECT traits ->> 'email' as name FROM "identities" WHERE (id = ('` + tc.uuid + `'))`)). + WithArgs().WillReturnRows(sqlmock.NewRows([]string{"traits"}).AddRow([]byte(`{"email":"johndoe@provider.com"}`))) + + } + + audreq := &userrpcv3.UserLoginAuditRequest{UserId: tc.uuid} + _, err := us.CreateLoginAuditLog(context.TODO(), audreq) + if tc.shouldHaveError && err == nil { + + t.Error("could not add audit log", err) + } + }) + } + +} diff --git a/proto/rpc/user/user.pb.go b/proto/rpc/user/user.pb.go index 321316c..bb00e87 100644 --- a/proto/rpc/user/user.pb.go +++ b/proto/rpc/user/user.pb.go @@ -376,6 +376,91 @@ func (*CliConfigRequest) Descriptor() ([]byte, []int) { return file_proto_rpc_user_user_proto_rawDescGZIP(), []int{6} } +type UserLoginAuditRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` +} + +func (x *UserLoginAuditRequest) Reset() { + *x = UserLoginAuditRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_rpc_user_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserLoginAuditRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserLoginAuditRequest) ProtoMessage() {} + +func (x *UserLoginAuditRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_rpc_user_user_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 UserLoginAuditRequest.ProtoReflect.Descriptor instead. +func (*UserLoginAuditRequest) Descriptor() ([]byte, []int) { + return file_proto_rpc_user_user_proto_rawDescGZIP(), []int{7} +} + +func (x *UserLoginAuditRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type UserLoginAuditResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UserLoginAuditResponse) Reset() { + *x = UserLoginAuditResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_rpc_user_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserLoginAuditResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserLoginAuditResponse) ProtoMessage() {} + +func (x *UserLoginAuditResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_rpc_user_user_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 UserLoginAuditResponse.ProtoReflect.Descriptor instead. +func (*UserLoginAuditResponse) Descriptor() ([]byte, []int) { + return file_proto_rpc_user_user_proto_rawDescGZIP(), []int{8} +} + var File_proto_rpc_user_user_proto protoreflect.FileDescriptor var file_proto_rpc_user_user_proto_rawDesc = []byte{ @@ -425,136 +510,150 @@ var file_proto_rpc_user_user_proto_rawDesc = []byte{ 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x6e, 0x6b, 0x22, 0x1b, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x43, 0x6c, 0x69, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x32, 0xb7, 0x0b, - 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa2, 0x01, - 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x30, 0x0a, + 0x15, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, + 0x18, 0x0a, 0x16, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x41, 0x75, 0x64, 0x69, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, 0x0c, 0x0a, 0x0b, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x41, 0x75, + 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x57, 0x65, 0x62, 0x68, 0x6f, 0x6f, 0x6b, 0x12, 0x2e, 0x2e, + 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, + 0x6e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, + 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, + 0x6e, 0x41, 0x75, 0x64, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x3a, 0x01, 0x2a, 0x22, 0x16, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x6c, 0x6f, + 0x67, 0x12, 0xa2, 0x01, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x22, 0x52, 0x92, 0x41, 0x36, 0x4a, 0x34, 0x0a, 0x03, 0x32, 0x30, 0x31, 0x12, 0x2d, + 0x0a, 0x2b, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, + 0x75, 0x73, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x13, 0x3a, 0x01, 0x2a, 0x22, 0x0e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, + 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x72, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x23, 0x2e, + 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, + 0x73, 0x74, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x61, 0x75, 0x74, + 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x72, 0x0a, 0x07, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, + 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, + 0x1d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x6e, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, + 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x23, + 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, + 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x75, + 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x78, + 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x52, - 0x92, 0x41, 0x36, 0x4a, 0x34, 0x0a, 0x03, 0x32, 0x30, 0x31, 0x12, 0x2d, 0x0a, 0x2b, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, - 0x20, 0x69, 0x73, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, - 0x0e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x3a, - 0x01, 0x2a, 0x12, 0x72, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x29, - 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x23, 0x2e, 0x70, 0x61, 0x72, 0x61, - 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x16, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, - 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x72, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x61, 0x75, - 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x6e, 0x0a, 0x0b, 0x47, 0x65, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, - 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x23, 0x2e, 0x70, 0x61, 0x72, - 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, - 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, - 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, - 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x78, 0x0a, 0x0a, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, - 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, - 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x22, 0x1a, 0x1d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, - 0x72, 0x2f, 0x7b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, - 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xc1, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x1a, 0x32, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x92, 0x41, 0x36, 0x4a, 0x34, 0x0a, - 0x03, 0x32, 0x30, 0x34, 0x12, 0x2d, 0x0a, 0x2b, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, - 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x64, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x64, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, - 0x6c, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x2a, 0x1d, 0x2f, 0x61, 0x75, 0x74, 0x68, + 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x28, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x3a, 0x01, 0x2a, 0x1a, 0x1d, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x11, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6c, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x29, - 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, - 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6c, 0x69, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x61, 0x72, 0x61, - 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, - 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, - 0x76, 0x33, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x95, 0x01, - 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, - 0x73, 0x12, 0x26, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, - 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x4b, - 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x61, 0x72, 0x61, - 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, - 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x69, 0x4b, - 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, - 0x65, 0x72, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x61, 0x70, - 0x69, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x9e, 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x26, 0x2e, 0x70, 0x61, - 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, - 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x2a, - 0x25, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, - 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xae, 0x01, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x46, - 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x32, 0x2e, + 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xc1, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, + 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x32, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, + 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5e, 0x92, 0x41, + 0x36, 0x4a, 0x34, 0x0a, 0x03, 0x32, 0x30, 0x34, 0x12, 0x2d, 0x0a, 0x2b, 0x52, 0x65, 0x74, 0x75, + 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x69, + 0x73, 0x20, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x2a, 0x1d, 0x2f, + 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x82, 0x01, 0x0a, + 0x11, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6c, 0x69, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x29, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x43, 0x6c, 0x69, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, + 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x48, 0x74, 0x74, 0x70, + 0x42, 0x6f, 0x64, 0x79, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x61, + 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x95, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, + 0x69, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x26, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, + 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x67, - 0x6f, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, + 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, + 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x7d, 0x2f, 0x61, 0x70, 0x69, 0x6b, 0x65, 0x79, 0x73, 0x12, 0x9e, 0x01, 0x0a, 0x11, 0x55, 0x73, + 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x73, 0x12, + 0x26, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, + 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, + 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, + 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x70, 0x69, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x27, 0x2a, 0x25, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, + 0x65, 0x72, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x61, 0x70, + 0x69, 0x6b, 0x65, 0x79, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0xae, 0x01, 0x0a, 0x12, 0x55, + 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x12, 0x32, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, - 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x75, - 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x66, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0xc5, 0x04, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x3b, - 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x50, 0x44, 0x52, 0x55, 0xaa, 0x02, 0x17, - 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x52, 0x70, 0x63, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, - 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, - 0x33, 0xe2, 0x02, 0x23, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, - 0x52, 0x70, 0x63, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, - 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, 0x3a, 0x55, 0x73, 0x65, - 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x92, 0x41, 0xe6, 0x02, 0x12, 0x2d, 0x0a, 0x17, 0x55, 0x73, 0x65, - 0x72, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x20, - 0x44, 0x65, 0x76, 0x32, 0x03, 0x32, 0x2e, 0x30, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x32, 0x10, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x79, 0x61, 0x6d, 0x6c, 0x3a, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x46, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x29, 0x12, 0x27, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x76, 0x33, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x66, 0x6f, 0x72, + 0x67, 0x6f, 0x74, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x42, 0xc5, 0x04, 0x0a, 0x1b, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x33, 0x42, 0x09, 0x55, 0x73, 0x65, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6c, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x76, 0x33, 0xa2, 0x02, 0x04, 0x50, 0x44, 0x52, + 0x55, 0xaa, 0x02, 0x17, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x2e, 0x44, 0x65, 0x76, 0x2e, + 0x52, 0x70, 0x63, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x56, 0x33, 0xca, 0x02, 0x17, 0x50, 0x61, + 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x55, 0x73, + 0x65, 0x72, 0x5c, 0x56, 0x33, 0xe2, 0x02, 0x23, 0x50, 0x61, 0x72, 0x61, 0x6c, 0x75, 0x73, 0x5c, + 0x44, 0x65, 0x76, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x55, 0x73, 0x65, 0x72, 0x5c, 0x56, 0x33, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x50, 0x61, + 0x72, 0x61, 0x6c, 0x75, 0x73, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, + 0x3a, 0x55, 0x73, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x33, 0x92, 0x41, 0xe6, 0x02, 0x12, 0x2d, 0x0a, + 0x17, 0x55, 0x73, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x0d, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, + 0x6c, 0x75, 0x73, 0x20, 0x44, 0x65, 0x76, 0x32, 0x03, 0x32, 0x2e, 0x30, 0x2a, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, - 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x79, - 0x61, 0x6d, 0x6c, 0x52, 0x50, 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, 0x49, 0x0a, 0x47, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x68, 0x61, - 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, - 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x3b, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x34, 0x0a, 0x2a, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, - 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, - 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, 0x06, 0x0a, 0x04, 0x9a, 0x02, - 0x01, 0x07, 0x5a, 0x3a, 0x0a, 0x27, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, - 0x74, 0x68, 0x12, 0x19, 0x08, 0x02, 0x1a, 0x13, 0x58, 0x2d, 0x50, 0x41, 0x52, 0x41, 0x4c, 0x55, - 0x53, 0x2d, 0x41, 0x50, 0x49, 0x2d, 0x4b, 0x45, 0x59, 0x49, 0x44, 0x20, 0x02, 0x0a, 0x0f, 0x0a, - 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, 0x08, 0x01, 0x62, 0x1f, - 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, - 0x0a, 0x0d, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x00, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x79, + 0x61, 0x6d, 0x6c, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x79, 0x61, 0x6d, 0x6c, 0x52, 0x50, 0x0a, 0x03, 0x34, 0x30, 0x33, 0x12, 0x49, + 0x0a, 0x47, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, + 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, + 0x74, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x3b, 0x0a, 0x03, 0x34, 0x30, 0x34, + 0x12, 0x34, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, + 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x64, + 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, 0x06, + 0x0a, 0x04, 0x9a, 0x02, 0x01, 0x07, 0x5a, 0x3a, 0x0a, 0x27, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, + 0x65, 0x79, 0x41, 0x75, 0x74, 0x68, 0x12, 0x19, 0x08, 0x02, 0x1a, 0x13, 0x58, 0x2d, 0x50, 0x41, + 0x52, 0x41, 0x4c, 0x55, 0x53, 0x2d, 0x41, 0x50, 0x49, 0x2d, 0x4b, 0x45, 0x59, 0x49, 0x44, 0x20, + 0x02, 0x0a, 0x0f, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x02, + 0x08, 0x01, 0x62, 0x1f, 0x0a, 0x0e, 0x0a, 0x0a, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x41, 0x75, + 0x74, 0x68, 0x12, 0x00, 0x0a, 0x0d, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, + 0x68, 0x12, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -569,7 +668,7 @@ func file_proto_rpc_user_user_proto_rawDescGZIP() []byte { return file_proto_rpc_user_user_proto_rawDescData } -var file_proto_rpc_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_proto_rpc_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_proto_rpc_user_user_proto_goTypes = []interface{}{ (*ApiKeyRequest)(nil), // 0: paralus.dev.rpc.user.v3.ApiKeyRequest (*ApiKeyResponse)(nil), // 1: paralus.dev.rpc.user.v3.ApiKeyResponse @@ -578,39 +677,43 @@ var file_proto_rpc_user_user_proto_goTypes = []interface{}{ (*UserForgotPasswordResponse)(nil), // 4: paralus.dev.rpc.user.v3.UserForgotPasswordResponse (*UserDeleteApiKeysResponse)(nil), // 5: paralus.dev.rpc.user.v3.UserDeleteApiKeysResponse (*CliConfigRequest)(nil), // 6: paralus.dev.rpc.user.v3.CliConfigRequest - (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp - (*v3.User)(nil), // 8: paralus.dev.types.user.v3.User - (*v31.QueryOptions)(nil), // 9: paralus.dev.types.common.v3.QueryOptions - (*v3.UserList)(nil), // 10: paralus.dev.types.user.v3.UserList - (*v3.UserInfo)(nil), // 11: paralus.dev.types.user.v3.UserInfo - (*v31.HttpBody)(nil), // 12: paralus.dev.types.common.v3.HttpBody + (*UserLoginAuditRequest)(nil), // 7: paralus.dev.rpc.user.v3.UserLoginAuditRequest + (*UserLoginAuditResponse)(nil), // 8: paralus.dev.rpc.user.v3.UserLoginAuditResponse + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp + (*v3.User)(nil), // 10: paralus.dev.types.user.v3.User + (*v31.QueryOptions)(nil), // 11: paralus.dev.types.common.v3.QueryOptions + (*v3.UserList)(nil), // 12: paralus.dev.types.user.v3.UserList + (*v3.UserInfo)(nil), // 13: paralus.dev.types.user.v3.UserInfo + (*v31.HttpBody)(nil), // 14: paralus.dev.types.common.v3.HttpBody } var file_proto_rpc_user_user_proto_depIdxs = []int32{ - 7, // 0: paralus.dev.rpc.user.v3.ApiKeyResponse.modifiedAt:type_name -> google.protobuf.Timestamp - 7, // 1: paralus.dev.rpc.user.v3.ApiKeyResponse.createdAt:type_name -> google.protobuf.Timestamp + 9, // 0: paralus.dev.rpc.user.v3.ApiKeyResponse.modifiedAt:type_name -> google.protobuf.Timestamp + 9, // 1: paralus.dev.rpc.user.v3.ApiKeyResponse.createdAt:type_name -> google.protobuf.Timestamp 1, // 2: paralus.dev.rpc.user.v3.UserListApiKeysResponse.items:type_name -> paralus.dev.rpc.user.v3.ApiKeyResponse - 8, // 3: paralus.dev.rpc.user.v3.UserService.CreateUser:input_type -> paralus.dev.types.user.v3.User - 9, // 4: paralus.dev.rpc.user.v3.UserService.GetUsers:input_type -> paralus.dev.types.common.v3.QueryOptions - 8, // 5: paralus.dev.rpc.user.v3.UserService.GetUser:input_type -> paralus.dev.types.user.v3.User - 8, // 6: paralus.dev.rpc.user.v3.UserService.GetUserInfo:input_type -> paralus.dev.types.user.v3.User - 8, // 7: paralus.dev.rpc.user.v3.UserService.UpdateUser:input_type -> paralus.dev.types.user.v3.User - 8, // 8: paralus.dev.rpc.user.v3.UserService.DeleteUser:input_type -> paralus.dev.types.user.v3.User - 6, // 9: paralus.dev.rpc.user.v3.UserService.DownloadCliConfig:input_type -> paralus.dev.rpc.user.v3.CliConfigRequest - 0, // 10: paralus.dev.rpc.user.v3.UserService.UserListApiKeys:input_type -> paralus.dev.rpc.user.v3.ApiKeyRequest - 0, // 11: paralus.dev.rpc.user.v3.UserService.UserDeleteApiKeys:input_type -> paralus.dev.rpc.user.v3.ApiKeyRequest - 3, // 12: paralus.dev.rpc.user.v3.UserService.UserForgotPassword:input_type -> paralus.dev.rpc.user.v3.UserForgotPasswordRequest - 8, // 13: paralus.dev.rpc.user.v3.UserService.CreateUser:output_type -> paralus.dev.types.user.v3.User - 10, // 14: paralus.dev.rpc.user.v3.UserService.GetUsers:output_type -> paralus.dev.types.user.v3.UserList - 8, // 15: paralus.dev.rpc.user.v3.UserService.GetUser:output_type -> paralus.dev.types.user.v3.User - 11, // 16: paralus.dev.rpc.user.v3.UserService.GetUserInfo:output_type -> paralus.dev.types.user.v3.UserInfo - 8, // 17: paralus.dev.rpc.user.v3.UserService.UpdateUser:output_type -> paralus.dev.types.user.v3.User - 5, // 18: paralus.dev.rpc.user.v3.UserService.DeleteUser:output_type -> paralus.dev.rpc.user.v3.UserDeleteApiKeysResponse - 12, // 19: paralus.dev.rpc.user.v3.UserService.DownloadCliConfig:output_type -> paralus.dev.types.common.v3.HttpBody - 2, // 20: paralus.dev.rpc.user.v3.UserService.UserListApiKeys:output_type -> paralus.dev.rpc.user.v3.UserListApiKeysResponse - 5, // 21: paralus.dev.rpc.user.v3.UserService.UserDeleteApiKeys:output_type -> paralus.dev.rpc.user.v3.UserDeleteApiKeysResponse - 4, // 22: paralus.dev.rpc.user.v3.UserService.UserForgotPassword:output_type -> paralus.dev.rpc.user.v3.UserForgotPasswordResponse - 13, // [13:23] is the sub-list for method output_type - 3, // [3:13] is the sub-list for method input_type + 7, // 3: paralus.dev.rpc.user.v3.UserService.AuditLogWebhook:input_type -> paralus.dev.rpc.user.v3.UserLoginAuditRequest + 10, // 4: paralus.dev.rpc.user.v3.UserService.CreateUser:input_type -> paralus.dev.types.user.v3.User + 11, // 5: paralus.dev.rpc.user.v3.UserService.GetUsers:input_type -> paralus.dev.types.common.v3.QueryOptions + 10, // 6: paralus.dev.rpc.user.v3.UserService.GetUser:input_type -> paralus.dev.types.user.v3.User + 10, // 7: paralus.dev.rpc.user.v3.UserService.GetUserInfo:input_type -> paralus.dev.types.user.v3.User + 10, // 8: paralus.dev.rpc.user.v3.UserService.UpdateUser:input_type -> paralus.dev.types.user.v3.User + 10, // 9: paralus.dev.rpc.user.v3.UserService.DeleteUser:input_type -> paralus.dev.types.user.v3.User + 6, // 10: paralus.dev.rpc.user.v3.UserService.DownloadCliConfig:input_type -> paralus.dev.rpc.user.v3.CliConfigRequest + 0, // 11: paralus.dev.rpc.user.v3.UserService.UserListApiKeys:input_type -> paralus.dev.rpc.user.v3.ApiKeyRequest + 0, // 12: paralus.dev.rpc.user.v3.UserService.UserDeleteApiKeys:input_type -> paralus.dev.rpc.user.v3.ApiKeyRequest + 3, // 13: paralus.dev.rpc.user.v3.UserService.UserForgotPassword:input_type -> paralus.dev.rpc.user.v3.UserForgotPasswordRequest + 8, // 14: paralus.dev.rpc.user.v3.UserService.AuditLogWebhook:output_type -> paralus.dev.rpc.user.v3.UserLoginAuditResponse + 10, // 15: paralus.dev.rpc.user.v3.UserService.CreateUser:output_type -> paralus.dev.types.user.v3.User + 12, // 16: paralus.dev.rpc.user.v3.UserService.GetUsers:output_type -> paralus.dev.types.user.v3.UserList + 10, // 17: paralus.dev.rpc.user.v3.UserService.GetUser:output_type -> paralus.dev.types.user.v3.User + 13, // 18: paralus.dev.rpc.user.v3.UserService.GetUserInfo:output_type -> paralus.dev.types.user.v3.UserInfo + 10, // 19: paralus.dev.rpc.user.v3.UserService.UpdateUser:output_type -> paralus.dev.types.user.v3.User + 5, // 20: paralus.dev.rpc.user.v3.UserService.DeleteUser:output_type -> paralus.dev.rpc.user.v3.UserDeleteApiKeysResponse + 14, // 21: paralus.dev.rpc.user.v3.UserService.DownloadCliConfig:output_type -> paralus.dev.types.common.v3.HttpBody + 2, // 22: paralus.dev.rpc.user.v3.UserService.UserListApiKeys:output_type -> paralus.dev.rpc.user.v3.UserListApiKeysResponse + 5, // 23: paralus.dev.rpc.user.v3.UserService.UserDeleteApiKeys:output_type -> paralus.dev.rpc.user.v3.UserDeleteApiKeysResponse + 4, // 24: paralus.dev.rpc.user.v3.UserService.UserForgotPassword:output_type -> paralus.dev.rpc.user.v3.UserForgotPasswordResponse + 14, // [14:25] is the sub-list for method output_type + 3, // [3:14] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -706,6 +809,30 @@ func file_proto_rpc_user_user_proto_init() { return nil } } + file_proto_rpc_user_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserLoginAuditRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_rpc_user_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserLoginAuditResponse); 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{ @@ -713,7 +840,7 @@ func file_proto_rpc_user_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_rpc_user_user_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/rpc/user/user.pb.gw.go b/proto/rpc/user/user.pb.gw.go index ce58b5e..7ff1988 100644 --- a/proto/rpc/user/user.pb.gw.go +++ b/proto/rpc/user/user.pb.gw.go @@ -16,7 +16,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" "github.com/paralus/paralus/proto/types/commonpb/v3" - "github.com/paralus/paralus/proto/types/userpb/v3" + userv3_0 "github.com/paralus/paralus/proto/types/userpb/v3" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" @@ -33,8 +33,42 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join +func request_UserService_AuditLogWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UserLoginAuditRequest + 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) + } + + msg, err := client.AuditLogWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_UserService_AuditLogWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UserLoginAuditRequest + 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) + } + + msg, err := server.AuditLogWebhook(ctx, &protoReq) + return msg, metadata, err + +} + func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -51,7 +85,7 @@ func request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Mar } func local_request_UserService_CreateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -108,7 +142,7 @@ var ( ) func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata var ( @@ -141,7 +175,7 @@ func request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marsha } func local_request_UserService_GetUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata var ( @@ -178,7 +212,7 @@ var ( ) func request_UserService_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -194,7 +228,7 @@ func request_UserService_GetUserInfo_0(ctx context.Context, marshaler runtime.Ma } func local_request_UserService_GetUserInfo_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -210,7 +244,7 @@ func local_request_UserService_GetUserInfo_0(ctx context.Context, marshaler runt } func request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -244,7 +278,7 @@ func request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Mar } func local_request_UserService_UpdateUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -282,7 +316,7 @@ var ( ) func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata var ( @@ -315,7 +349,7 @@ func request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Mar } func local_request_UserService_DeleteUser_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq userv3.User + var protoReq userv3_0.User var metadata runtime.ServerMetadata var ( @@ -565,26 +599,53 @@ func local_request_UserService_UserForgotPassword_0(ctx context.Context, marshal // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead. func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error { + mux.Handle("POST", pattern_UserService_AuditLogWebhook_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/AuditLogWebhook", runtime.WithHTTPPathPattern("/auth/v3/user/auditlog")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_UserService_AuditLogWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_AuditLogWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_UserService_CreateUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/CreateUser", runtime.WithHTTPPathPattern("/auth/v3/users")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/CreateUser", runtime.WithHTTPPathPattern("/auth/v3/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_CreateUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_CreateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_CreateUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -594,20 +655,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUsers", runtime.WithHTTPPathPattern("/auth/v3/users")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUsers", runtime.WithHTTPPathPattern("/auth/v3/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUsers_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_GetUsers_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUsers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -617,20 +680,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_GetUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -640,20 +705,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUserInfo", runtime.WithHTTPPathPattern("/auth/v3/userinfo")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUserInfo", runtime.WithHTTPPathPattern("/auth/v3/userinfo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_GetUserInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_GetUserInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -663,20 +730,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UpdateUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UpdateUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UpdateUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UpdateUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -686,20 +755,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DeleteUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DeleteUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_DeleteUser_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_DeleteUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -709,20 +780,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DownloadCliConfig", runtime.WithHTTPPathPattern("/auth/v3/cli/config")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DownloadCliConfig", runtime.WithHTTPPathPattern("/auth/v3/cli/config")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_DownloadCliConfig_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_DownloadCliConfig_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_DownloadCliConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DownloadCliConfig_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -732,20 +805,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserListApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserListApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UserListApiKeys_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UserListApiKeys_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserListApiKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserListApiKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -755,20 +830,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserDeleteApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys/{id}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserDeleteApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UserDeleteApiKeys_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UserDeleteApiKeys_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserDeleteApiKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserDeleteApiKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -778,20 +855,22 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserForgotPassword", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/forgotpassword")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserForgotPassword", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/forgotpassword")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_UserService_UserForgotPassword_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_UserService_UserForgotPassword_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserForgotPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserForgotPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -836,23 +915,47 @@ func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn // "UserServiceClient" to call the correct interceptors. func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error { + mux.Handle("POST", pattern_UserService_AuditLogWebhook_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) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/AuditLogWebhook", runtime.WithHTTPPathPattern("/auth/v3/user/auditlog")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_UserService_AuditLogWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_UserService_AuditLogWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_UserService_CreateUser_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, "/paralus.dev.rpc.user.v3.UserService/CreateUser", runtime.WithHTTPPathPattern("/auth/v3/users")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/CreateUser", runtime.WithHTTPPathPattern("/auth/v3/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_CreateUser_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_CreateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_CreateUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_CreateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -860,19 +963,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUsers", runtime.WithHTTPPathPattern("/auth/v3/users")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUsers", runtime.WithHTTPPathPattern("/auth/v3/users")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUsers_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_GetUsers_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUsers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUsers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -880,19 +985,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUser_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_GetUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -900,19 +1007,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUserInfo", runtime.WithHTTPPathPattern("/auth/v3/userinfo")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/GetUserInfo", runtime.WithHTTPPathPattern("/auth/v3/userinfo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_GetUserInfo_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_GetUserInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_GetUserInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -920,19 +1029,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UpdateUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UpdateUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UpdateUser_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_UpdateUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UpdateUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UpdateUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -940,19 +1051,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DeleteUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DeleteUser", runtime.WithHTTPPathPattern("/auth/v3/user/{metadata.name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_DeleteUser_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_DeleteUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_DeleteUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DeleteUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -960,19 +1073,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DownloadCliConfig", runtime.WithHTTPPathPattern("/auth/v3/cli/config")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/DownloadCliConfig", runtime.WithHTTPPathPattern("/auth/v3/cli/config")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_DownloadCliConfig_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_DownloadCliConfig_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_DownloadCliConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_DownloadCliConfig_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -980,19 +1095,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserListApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserListApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UserListApiKeys_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_UserListApiKeys_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserListApiKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserListApiKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1000,19 +1117,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserDeleteApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys/{id}")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserDeleteApiKeys", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/apikeys/{id}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UserDeleteApiKeys_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_UserDeleteApiKeys_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserDeleteApiKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserDeleteApiKeys_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1020,19 +1139,21 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserForgotPassword", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/forgotpassword")) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/paralus.dev.rpc.user.v3.UserService/UserForgotPassword", runtime.WithHTTPPathPattern("/auth/v3/user/{username}/forgotpassword")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_UserService_UserForgotPassword_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) + resp, md, err := request_UserService_UserForgotPassword_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_UserService_UserForgotPassword_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_UserService_UserForgotPassword_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1040,6 +1161,8 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( + pattern_UserService_AuditLogWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"auth", "v3", "user", "auditlog"}, "")) + pattern_UserService_CreateUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"auth", "v3", "users"}, "")) pattern_UserService_GetUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"auth", "v3", "users"}, "")) @@ -1062,6 +1185,8 @@ var ( ) var ( + forward_UserService_AuditLogWebhook_0 = runtime.ForwardResponseMessage + forward_UserService_CreateUser_0 = runtime.ForwardResponseMessage forward_UserService_GetUsers_0 = runtime.ForwardResponseMessage diff --git a/proto/rpc/user/user.proto b/proto/rpc/user/user.proto index 24f205e..14a311c 100644 --- a/proto/rpc/user/user.proto +++ b/proto/rpc/user/user.proto @@ -76,7 +76,19 @@ message UserForgotPasswordResponse { string recoveryLink = 1; } message UserDeleteApiKeysResponse {} message CliConfigRequest {} +message UserLoginAuditRequest {string user_id = 1;} +message UserLoginAuditResponse {} + service UserService { + + rpc AuditLogWebhook(UserLoginAuditRequest) + returns (UserLoginAuditResponse) { + option (google.api.http) = { + post : "/auth/v3/user/auditlog" + body : "*" + }; + }; + rpc CreateUser(paralus.dev.types.user.v3.User) returns (paralus.dev.types.user.v3.User) { option (google.api.http) = { diff --git a/proto/rpc/user/user_grpc.pb.go b/proto/rpc/user/user_grpc.pb.go index 160be70..08c5cf7 100644 --- a/proto/rpc/user/user_grpc.pb.go +++ b/proto/rpc/user/user_grpc.pb.go @@ -24,6 +24,7 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type UserServiceClient interface { + AuditLogWebhook(ctx context.Context, in *UserLoginAuditRequest, opts ...grpc.CallOption) (*UserLoginAuditResponse, error) CreateUser(ctx context.Context, in *v3.User, opts ...grpc.CallOption) (*v3.User, error) GetUsers(ctx context.Context, in *v31.QueryOptions, opts ...grpc.CallOption) (*v3.UserList, error) GetUser(ctx context.Context, in *v3.User, opts ...grpc.CallOption) (*v3.User, error) @@ -44,6 +45,15 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { return &userServiceClient{cc} } +func (c *userServiceClient) AuditLogWebhook(ctx context.Context, in *UserLoginAuditRequest, opts ...grpc.CallOption) (*UserLoginAuditResponse, error) { + out := new(UserLoginAuditResponse) + err := c.cc.Invoke(ctx, "/paralus.dev.rpc.user.v3.UserService/AuditLogWebhook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *userServiceClient) CreateUser(ctx context.Context, in *v3.User, opts ...grpc.CallOption) (*v3.User, error) { out := new(v3.User) err := c.cc.Invoke(ctx, "/paralus.dev.rpc.user.v3.UserService/CreateUser", in, out, opts...) @@ -138,6 +148,7 @@ func (c *userServiceClient) UserForgotPassword(ctx context.Context, in *UserForg // All implementations should embed UnimplementedUserServiceServer // for forward compatibility type UserServiceServer interface { + AuditLogWebhook(context.Context, *UserLoginAuditRequest) (*UserLoginAuditResponse, error) CreateUser(context.Context, *v3.User) (*v3.User, error) GetUsers(context.Context, *v31.QueryOptions) (*v3.UserList, error) GetUser(context.Context, *v3.User) (*v3.User, error) @@ -154,6 +165,9 @@ type UserServiceServer interface { type UnimplementedUserServiceServer struct { } +func (UnimplementedUserServiceServer) AuditLogWebhook(context.Context, *UserLoginAuditRequest) (*UserLoginAuditResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuditLogWebhook not implemented") +} func (UnimplementedUserServiceServer) CreateUser(context.Context, *v3.User) (*v3.User, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") } @@ -196,6 +210,24 @@ func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { s.RegisterService(&UserService_ServiceDesc, srv) } +func _UserService_AuditLogWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserLoginAuditRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).AuditLogWebhook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/paralus.dev.rpc.user.v3.UserService/AuditLogWebhook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).AuditLogWebhook(ctx, req.(*UserLoginAuditRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(v3.User) if err := dec(in); err != nil { @@ -383,6 +415,10 @@ var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "paralus.dev.rpc.user.v3.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "AuditLogWebhook", + Handler: _UserService_AuditLogWebhook_Handler, + }, { MethodName: "CreateUser", Handler: _UserService_CreateUser_Handler, diff --git a/server/user.go b/server/user.go index 021efd4..285d3b5 100644 --- a/server/user.go +++ b/server/user.go @@ -113,3 +113,7 @@ func (s *userServer) UserForgotPassword(ctx context.Context, req *rpcv3.UserForg return s.us.ForgotPassword(ctx, req) } + +func (s *userServer) AuditLogWebhook(ctx context.Context, req *rpcv3.UserLoginAuditRequest) (*rpcv3.UserLoginAuditResponse, error) { + return s.us.CreateLoginAuditLog(ctx, req) +}