Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/Gitlab Sign Flow #4220

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func server(localMode bool) http.Handler {
v2GithubActivityService := v2GithubActivity.NewService(gitV1Repository, githubOrganizationsRepo, eventsService, autoEnableService, emailService)

v2ClaGroupService := cla_groups.NewService(v1ProjectService, templateService, v1ProjectClaGroupRepo, v1ClaManagerService, v1SignaturesService, metricsRepo, gerritService, v1RepositoriesService, eventsService)
v2SignService := sign.NewService(configFile.ClaAPIV4Base, configFile.ClaV1ApiURL, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService, configFile.CLALandingPage, configFile.CLALogoURL, emailService, eventsService)
v2SignService := sign.NewService(configFile.ClaAPIV4Base, configFile.ClaV1ApiURL, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService, configFile.CLALandingPage, configFile.CLALogoURL, emailService, eventsService, gitlabActivityService, gitlabApp)

sessionStore, err := dynastore.New(dynastore.Path("/"), dynastore.HTTPOnly(), dynastore.TableName(configFile.SessionStoreTableName), dynastore.DynamoDB(dynamodb.New(awsSession)))
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions cla-backend-go/swagger/cla.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4279,6 +4279,8 @@ paths:
description: Receives XML data when an individual signs a document in DocuSign linked to GitLab.
operationId: iclaCallbackGitlab
security: [ ]
consumes:
- text/xml
parameters:
- $ref: "#/parameters/x-request-id"
- name: user_id
Expand All @@ -4297,12 +4299,12 @@ paths:
in: path
required: true
type: string
- name: body
- name: envelopeInformation
in: body
required: true
description: XML payload with DocuSign envelope information
schema:
type: object
additionalProperties: true
$ref: '#/definitions/DocuSignEnvelopeInformation'
responses:
'200':
description: Callback data for GitLab successfully received and processed.
Expand Down
8 changes: 2 additions & 6 deletions cla-backend-go/v2/sign/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,8 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se
utils.XREQUESTID: ctx.Value(utils.XREQUESTID),
}
log.WithFields(f).Debug("gitlab callback")
payload, marshalErr := json.Marshal(params.Body)
if marshalErr != nil {
log.WithFields(f).WithError(marshalErr).Warn("unable to marshal github callback body")
return sign.NewIclaCallbackGithubBadRequest()
}

err := service.SignedIndividualCallbackGitlab(ctx, payload, params.UserID, params.OrganizationID, params.GitlabRepositoryID, params.MergeRequestID)
err := service.SignedIndividualCallbackGitlab(ctx, iclaGitHubPayload, params.UserID, params.OrganizationID, params.GitlabRepositoryID, params.MergeRequestID)
if err != nil {
return sign.NewIclaCallbackGitlabBadRequest()
}
Expand Down Expand Up @@ -256,6 +251,7 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se

api.AddMiddlewareFor("POST", "/signed/individual/{installation_id}/{github_repository_id}/{change_request_id}", docusignMiddleware)
api.AddMiddlewareFor("POST", "/signed/corporate/{project_id}/{company_id}", cclaDocusignMiddleware)
api.AddMiddlewareFor("POST", "/signed/gitlab/individual/{user_id}/{organization_id}/{gitlab_repository_id}/{merge_request_id}", docusignMiddleware)
}

type codedResponse interface {
Expand Down
Loading
Loading