diff --git a/analyzer/tools/build-logger/ldlogger b/analyzer/tools/build-logger/ldlogger new file mode 100755 index 0000000000..29b170621f Binary files /dev/null and b/analyzer/tools/build-logger/ldlogger differ diff --git a/analyzer/tools/build-logger/ldlogger_32.so b/analyzer/tools/build-logger/ldlogger_32.so new file mode 100755 index 0000000000..49e21018a2 Binary files /dev/null and b/analyzer/tools/build-logger/ldlogger_32.so differ diff --git a/web/api/authentication.thrift b/web/api/authentication.thrift index 06d64685da..ffa722abcc 100644 --- a/web/api/authentication.thrift +++ b/web/api/authentication.thrift @@ -77,10 +77,6 @@ service codeCheckerAuthentication { string createLinkGoogle() throws (1: codechecker_api_shared.RequestFailed requestError), - // Retrieves an OAuth token for the specified link. - string getOAuthToken(1: string link) - throws (1: codechecker_api_shared.RequestFailed requestError), - // Performs logout action for the user. Must be called from the // corresponding valid session which is to be destroyed. bool destroySession() diff --git a/web/server/codechecker_server/api/authentication.py b/web/server/codechecker_server/api/authentication.py index a65bdd02ee..a9c49daa90 100644 --- a/web/server/codechecker_server/api/authentication.py +++ b/web/server/codechecker_server/api/authentication.py @@ -125,7 +125,7 @@ def createLinkGoogle(self): """ This function is for creating an authentication link for OAuth for Google. """ - oauth_config = self.oauth_config_google + oauth_config = self.oauth_config_google # get the google oauth config if not oauth_config.get("enabled"): raise codechecker_api_shared.ttypes.RequestFailed( @@ -257,8 +257,8 @@ def performLogin(self, auth_method, auth_string): codechecker_api_shared.ttypes.ErrorCode.AUTH_DENIED, "User is not authorized to access this service.") - # return token session = self.__manager.create_session("github@" + username + ":" + token['access_token']) + return session.token elif auth_method == "oauth_google": LOG.info("OAuth login GOOGLE... started") diff --git a/web/server/vue-cli/src/views/Login.vue b/web/server/vue-cli/src/views/Login.vue index 6adc0e0cdf..8abe9d3651 100644 --- a/web/server/vue-cli/src/views/Login.vue +++ b/web/server/vue-cli/src/views/Login.vue @@ -154,10 +154,11 @@ export default { let code = null, state = null; code = url.searchParams.get("code"); state = url.searchParams.get("state"); + const provider = document.cookie.split(";").find( + c => c.includes("oauth_provider")).split("=")[1]; if (code != null && state != null) { - if (url.searchParams.get("scope") && - url.searchParams.get("scope").includes("googleapis") + if (provider === "google" ) { this.$store .dispatch(LOGIN, { @@ -178,24 +179,26 @@ export default { }); return; } + else if (provider === "github") { + this.$store + .dispatch(LOGIN, { + type: "oauth", + provider: "github", + url: window.location.href + }) + .then(() => { + this.success = true; + this.error = false; - this.$store - .dispatch(LOGIN, { - type: "oauth", - provider: "github", - url: window.location.href - }) - .then(() => { - this.success = true; - this.error = false; - - const w = window.location; - window.location.href = w.protocol + "//" + w.host + w.pathname; - }).catch(err => { - this.errorMsg = `Failed to log in! ${err.message}`; - this.error = true; - this.$router.replace({ name: "login" }); - }); + const w = window.location; + window.location.href = w.protocol + "//" + w.host + w.pathname; + }).catch(err => { + this.errorMsg = `Failed to log in! ${err.message}`; + this.error = true; + this.$router.replace({ name: "login" }); + }); + return; + } } }, @@ -219,6 +222,7 @@ export default { }, oauth(provider) { new Promise(resolve => { + document.cookie = `oauth_provider=${provider}; path=*`; if (provider === "google") { authService.getClient().createLinkGoogle( handleThriftError(url => {