Skip to content

Commit

Permalink
Rename gitlab callbacks (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
alagishev authored Jan 24, 2025
1 parent 9d1ba82 commit 2b5fbe9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions qubership-apihub-service/Service.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ func main() {
r.HandleFunc("/api/v2/space", security.SecureJWT(userController.CreatePrivateUserPackage)).Methods(http.MethodPost)
r.HandleFunc("/api/v2/space", security.SecureJWT(userController.GetPrivateUserPackage)).Methods(http.MethodGet)

r.HandleFunc("/login/ncgitlab/callback", security.NoSecure(oauthController.GitlabOauthCallback)).Methods(http.MethodGet)
r.HandleFunc("/login/ncgitlab", security.NoSecure(oauthController.StartOauthProcessWithGitlab)).Methods(http.MethodGet)
r.HandleFunc("/login/gitlab/callback", security.NoSecure(oauthController.GitlabOauthCallback)).Methods(http.MethodGet)
r.HandleFunc("/login/gitlab", security.NoSecure(oauthController.StartOauthProcessWithGitlab)).Methods(http.MethodGet)

r.HandleFunc("/api/v2/packages/{packageId}/versions/{version}/changes/summary", security.Secure(comparisonController.GetComparisonChangesSummary)).Methods(http.MethodGet)
r.HandleFunc("/api/v2/packages/{packageId}/versions/{version}/{apiType}/operations", security.Secure(operationController.GetOperationList)).Methods(http.MethodGet)
Expand Down
4 changes: 2 additions & 2 deletions qubership-apihub-service/security/Oauth2Controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (o oauth20ControllerImpl) GitlabOauthCallback(w http.ResponseWriter, r *htt
}

req := makeRequest()
authRedirectUri := fmt.Sprintf("%s%s", o.systemInfoService.GetAPIHubUrl(), "/login/ncgitlab/callback?redirectUri="+redirectUri)
authRedirectUri := fmt.Sprintf("%s%s", o.systemInfoService.GetAPIHubUrl(), "/login/gitlab/callback?redirectUri="+redirectUri)
//todo move query parameters to body with Content-Type: application/x-www-form-urlencoded https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3
url := fmt.Sprintf("%s%s?client_id=%s&client_secret=%s&code=%s&grant_type=authorization_code&redirect_uri=%s",
o.gitlabUrl, gitlabOauthTokenUri, o.clientId, o.clientSecret, code, authRedirectUri)
Expand Down Expand Up @@ -211,7 +211,7 @@ func (o oauth20ControllerImpl) StartOauthProcessWithGitlab(w http.ResponseWriter
}
}

fullRedirectUrl := fmt.Sprintf("%s%s?redirectUri=%s", o.systemInfoService.GetAPIHubUrl(), "/login/ncgitlab/callback", redirectUri)
fullRedirectUrl := fmt.Sprintf("%s%s?redirectUri=%s", o.systemInfoService.GetAPIHubUrl(), "/login/gitlab/callback", redirectUri)
http.Redirect(w, r, fmt.Sprintf("%s%s?client_id=%s&response_type=code&redirect_uri=%s", o.gitlabUrl, gitlabOauthAuthorize, o.clientId, fullRedirectUrl), http.StatusFound)
}

Expand Down

0 comments on commit 2b5fbe9

Please sign in to comment.