diff --git a/.travis.yml b/.travis.yml index 29fe2a8..fe3ea42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,24 @@ language: java - jdk: - - oraclejdk7 - -script: ./travis.sh - +- oraclejdk7 +script: "./travis.sh" install: true - sudo: false - cache: directories: - - $HOME/.m2/repository - # for analysis - - $HOME/.sonar - + - "$HOME/.m2/repository" + - "$HOME/.sonar" +before_deploy: +- export VERSION=$(cat pom.xml | grep -A 1 "sonar-auth-googleoauth-plugin" | grep + version | sed 's@^[^>]*>\([^<]*\)<.*@\1@g') +- git push --tags +- export RELEASE_JAR=$(ls target/sonar-auth-googleoauth-plugin-${VERSION}.jar) +- echo "Deploying ${RELEASE_JAR} to GitHub" +deploy: + provider: releases + api_key: + secure: rSHtAf8daq9kqpZaHGAfe+ArIOO1/TArti2XKcuHCSfS5zpareosAGKSWPgOukT/zamoKrHmHL58HL93SVyrkahFie86o9l4rMBQ9r1AX5xNilbqEJ5+7q5SknWzckzZx47JlI7Rd8I4yfAGsPtQPb7UflhQFGRgUKrCHpWA61r3z8J5P6ttdLPipQcbdsrDm4Nlv5zM1B4QXFsuDITpvwkYwpOF+BWyZSvU/AhFr3RfZGdlt5ZY+6ClbfiwSQi9lFNspBRbe6zeM6QWTh0UC49NwmONLXVb+soDD3ikeqomJnodpupCpSbcjyXhLt59Dg1JZ4Ty9nF6ks3mzL5/fKq2Tpf9k2DID/1V286qJ87kpWqx6y3/7BhbtjlirI8ADFnG4aLNfYJIJBAhHXXW2fWdHP4yS5BeO9NY5i1Q4UaLv1/lh1YE3ZhR/i/mSyMe44nPPA5YvZDSdhu7S7wQMTjHtsPYtXzers1LKC1WooA9m7135oKZtS94NJ3hxif2XWgDEmlR7+NNae5od4W5rCC93E0V7BWG9LruP3LL73hSM9VrVFnQoghil33sD3E/NM0VXxZqqP5LpCR7bYj9tX3TDmJK/YewsI5+hae06GdOkj2Rke4y6EmRFrTfFFVC/fIvn3NrDf837/mVapdNNPHtUTEpUFMPj5DUbN2RYrg= + file: target/RELEASE_NOTES + file: "${RELEASE_JAR}" + on: + tags: true diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 43a2e53..ef4f00e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # Google Authentication Plug-in for SonarQube # +[![Build Status](https://api.travis-ci.org/InfoSec812/sonar-auth-google.svg)](https://travis-ci.org/InfoSec812/sonar-auth-google) + ## Description ## This plugin enables user authentication and Single Sign-On via [Google](https://google.com/). diff --git a/pom.xml b/pom.xml index e86061a..299402a 100644 --- a/pom.xml +++ b/pom.xml @@ -2,8 +2,8 @@ 4.0.0 org.sonarqube.auth.google - sonar-auth-google-plugin - 1.1-SNAPSHOT + sonar-auth-googleoauth-plugin + 1.2-SNAPSHOT sonar-plugin Google Authentication for SonarQube Google Authentication for SonarQube @@ -30,9 +30,9 @@ - scm:git:git@github.com:SonarQubeCommunity/sonar-auth-google.git - scm:git:git@github.com:SonarQubeCommunity/sonar-auth-google.git - https://github.com/SonarQubeCommunity/sonar-auth-google + scm:git:git@github.com:InfoSec812/sonar-auth-google.git + scm:git:git@github.com:InfoSec812/sonar-auth-google.git + https://github.com/InfoSec812/sonar-auth-google HEAD @@ -130,7 +130,7 @@ 1.15 true - org.sonarqube.auth.google.AuthGooglePlugin + org.sonarqube.auth.googleoauth.AuthGooglePlugin @@ -156,6 +156,52 @@ + + org.apache.maven.plugins + maven-scm-plugin + + + org.codehaus.plexus + plexus-utils + 2.1 + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.2 + + + 1.0 + + test + connection + + + + tag + deploy + + tag + + + + + + org.codehaus.mojo + license-maven-plugin + 1.9 + + apache_v2 + + + + download-licenses + + download-licenses + + + + diff --git a/src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java similarity index 65% rename from src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java rename to src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java index d04e6f9..8d0448b 100644 --- a/src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.sonar.api.SonarPlugin; diff --git a/src/main/java/org/sonarqube/auth/google/GoogleIdentityProvider.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java similarity index 84% rename from src/main/java/org/sonarqube/auth/google/GoogleIdentityProvider.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java index 91918c7..b16dff0 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleIdentityProvider.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import com.github.scribejava.core.builder.ServiceBuilder; import com.github.scribejava.core.model.*; @@ -41,7 +61,7 @@ public class GoogleIdentityProvider implements OAuth2IdentityProvider { private static final Logger LOGGER = Loggers.get(GoogleIdentityProvider.class); public static final String REQUIRED_SCOPE = "openid email"; - public static final String KEY = "google"; + public static final String KEY = "googleoauth"; private static final Token EMPTY_TOKEN = null; private final GoogleSettings settings; @@ -67,9 +87,9 @@ public String getName() { @Override public Display getDisplay() { return Display.builder() - // URL of src/main/resources/static/google.svg at runtime - .setIconPath("/static/authgoogle/google.svg") - .setBackgroundColor("#236487") + // URL of src/main/resources/static/googleoauth.svg at runtime + .setIconPath("/static/googleoauth/googleoauth.svg") + .setBackgroundColor("#4d90fe") .build(); } diff --git a/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java similarity index 75% rename from src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java index 8c10ad4..f573392 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import com.github.scribejava.apis.GoogleApi20; import com.github.scribejava.core.extractors.AccessTokenExtractor; @@ -49,7 +69,7 @@ public Verb getAccessTokenVerb() { @Override public String getAuthorizationUrl(OAuthConfig config) { - StringBuilder sb = new StringBuilder(settings.webURL()).append("o/oauth2/auth") + StringBuilder sb = new StringBuilder(settings.webURL()) .append(String.format(GOOGLE_OAUTH_URL, new Object[]{config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope())})); String state = config.getState(); if(state != null) { diff --git a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java similarity index 76% rename from src/main/java/org/sonarqube/auth/google/GoogleSettings.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java index 5ba8260..7fe42d1 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; @@ -34,22 +54,21 @@ @ServerSide public class GoogleSettings { - public static final String CONSUMER_KEY = "sonar.auth.google.clientId.secured"; - public static final String CONSUMER_SECRET = "sonar.auth.google.clientSecret.secured"; - public static final String ENABLED = "sonar.auth.google.enabled"; - public static final String ALLOW_USERS_TO_SIGN_UP = "sonar.auth.google.allowUsersToSignUp"; - public static final String LIMIT_DOMAIN = "sonar.auth.google.limitOauthDomain"; - // URLs are not configurable yet - public static final String API_URL = "sonar.auth.google.apiUrl"; + public static final String CONSUMER_KEY = "sonar.auth.googleoauth.clientId.secured"; + public static final String CONSUMER_SECRET = "sonar.auth.googleoauth.clientSecret.secured"; + public static final String ENABLED = "sonar.auth.googleoauth.enabled"; + public static final String ALLOW_USERS_TO_SIGN_UP = "sonar.auth.googleoauth.allowUsersToSignUp"; + public static final String LIMIT_DOMAIN = "sonar.auth.googleoauth.limitOauthDomain"; + public static final String API_URL = "sonar.auth.googleoauth.apiUrl"; public static final String DEFAULT_API_URL = "https://www.googleapis.com/"; - public static final String WEB_URL = "sonar.auth.google.webUrl"; - public static final String DEFAULT_WEB_URL = "https://accounts.google.com/"; - public static final String LOGIN_STRATEGY = "sonar.auth.google.loginStrategy"; + public static final String WEB_URL = "sonar.auth.googleoauth.webUrl"; + public static final String DEFAULT_WEB_URL = "https://accounts.googleoauth.com/o/oauth2/auth"; + public static final String LOGIN_STRATEGY = "sonar.auth.googleoauth.loginStrategy"; public static final String LOGIN_STRATEGY_UNIQUE = "Unique"; public static final String LOGIN_STRATEGY_PROVIDER_LOGIN = "Same as Google login"; public static final String LOGIN_STRATEGY_DEFAULT_VALUE = LOGIN_STRATEGY_UNIQUE; public static final String CATEGORY = "security"; - public static final String SUBCATEGORY = "google"; + public static final String SUBCATEGORY = "googleoauth"; private final Settings settings; @@ -88,7 +107,7 @@ public String webURL() { if (url == null) { url = DEFAULT_WEB_URL; } - return urlWithEndingSlash(url); + return url; } public String apiURL() { @@ -158,11 +177,19 @@ public static List definitions() { .index(index++) .build(), PropertyDefinition.builder(LIMIT_DOMAIN) - .name("Limit allowed authentication domain") + .name("Allowed Domain") .description("When set, this will only allow users from the specified GApps domain to authenticate") .category(CATEGORY) .subCategory(SUBCATEGORY) .index(index++) + .build(), + PropertyDefinition.builder(WEB_URL) + .name("Google authentication URI") + .description("When set, this will override the URI used to send an authentication request to Google") + .defaultValue(DEFAULT_WEB_URL) + .category(CATEGORY) + .subCategory(SUBCATEGORY) + .index(index++) .build() ); } diff --git a/src/main/java/org/sonarqube/auth/google/GsonUser.java b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java similarity index 75% rename from src/main/java/org/sonarqube/auth/google/GsonUser.java rename to src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java index 1ec4890..5647bf3 100644 --- a/src/main/java/org/sonarqube/auth/google/GsonUser.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import com.google.gson.Gson; import com.google.gson.annotations.SerializedName; diff --git a/src/main/java/org/sonarqube/auth/google/UserIdentityFactory.java b/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java similarity index 75% rename from src/main/java/org/sonarqube/auth/google/UserIdentityFactory.java rename to src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java index 4e5e617..558fc23 100644 --- a/src/main/java/org/sonarqube/auth/google/UserIdentityFactory.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java @@ -17,13 +17,33 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.sonar.api.server.ServerSide; import org.sonar.api.server.authentication.UserIdentity; import static java.lang.String.format; -import static org.sonarqube.auth.google.GoogleSettings.LOGIN_STRATEGY_UNIQUE; +import static org.sonarqube.auth.googleoauth.GoogleSettings.LOGIN_STRATEGY_UNIQUE; /** * Converts Google JSON responses to {@link UserIdentity} diff --git a/src/main/java/org/sonarqube/auth/google/package-info.java b/src/main/java/org/sonarqube/auth/googleoauth/package-info.java similarity index 57% rename from src/main/java/org/sonarqube/auth/google/package-info.java rename to src/main/java/org/sonarqube/auth/googleoauth/package-info.java index 8f2b9f9..fa5ab1b 100644 --- a/src/main/java/org/sonarqube/auth/google/package-info.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/package-info.java @@ -18,6 +18,26 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/resources/org/sonar/l10n/authgoogle.properties b/src/main/resources/org/sonar/l10n/authgoogle.properties deleted file mode 100644 index b0186f3..0000000 --- a/src/main/resources/org/sonar/l10n/authgoogle.properties +++ /dev/null @@ -1,4 +0,0 @@ -property.category.security.google=Google -property.category.security.google.description=In order to enable Google authentication: - - diff --git a/src/main/resources/org/sonar/l10n/authgoogleoauth.properties b/src/main/resources/org/sonar/l10n/authgoogleoauth.properties new file mode 100644 index 0000000..3ca5fcd --- /dev/null +++ b/src/main/resources/org/sonar/l10n/authgoogleoauth.properties @@ -0,0 +1,23 @@ +### +# #%L +# Google Authentication for SonarQube +# %% +# Copyright (C) 2016 SonarSource +# %% +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# #L% +### +property.category.security.googleoauth=Google +property.category.security.googleoauth.description=In order to enable Google authentication: + + diff --git a/src/main/resources/static/google.svg b/src/main/resources/static/googleoauth.svg similarity index 100% rename from src/main/resources/static/google.svg rename to src/main/resources/static/googleoauth.svg diff --git a/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java similarity index 59% rename from src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java index 30da3d2..07db1c8 100644 --- a/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.junit.Test; @@ -29,7 +49,7 @@ public class AuthGooglePluginTest { @Test public void test_extensions() { - assertThat(underTest.getExtensions()).hasSize(10); + assertThat(underTest.getExtensions()).hasSize(11); } } diff --git a/src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java similarity index 65% rename from src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java index 3deed04..29057b4 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.junit.Rule; import org.junit.Test; @@ -30,7 +50,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.sonarqube.auth.google.GoogleSettings.LOGIN_STRATEGY_DEFAULT_VALUE; +import static org.sonarqube.auth.googleoauth.GoogleSettings.LOGIN_STRATEGY_DEFAULT_VALUE; public class GoogleIdentityProviderTest { @@ -45,10 +65,10 @@ public class GoogleIdentityProviderTest { @Test public void check_fields() { - assertThat(underTest.getKey()).isEqualTo("google"); + assertThat(underTest.getKey()).isEqualTo("googleoauth"); assertThat(underTest.getName()).isEqualTo("Google"); - assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/authgoogle/google.svg"); - assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#236487"); + assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/googleoauth/googleoauth.svg"); + assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#4d90fe"); } @Test @@ -60,7 +80,7 @@ public void init() { underTest.init(context); - verify(context).redirectTo("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=id&redirect_uri=http%3A%2F%2Flocalhost%2Fcallback&scope=openid%20email"); + verify(context).redirectTo("https://accounts.googleoauth.com/o/oauth2/auth?response_type=code&client_id=id&redirect_uri=http%3A%2F%2Flocalhost%2Fcallback&scope=openid%20email"); } @Test @@ -75,12 +95,12 @@ public void fail_to_init_when_disabled() { private void setSettings(boolean enabled) { if (enabled) { - settings.setProperty("sonar.auth.google.clientId.secured", "id"); - settings.setProperty("sonar.auth.google.clientSecret.secured", "secret"); - settings.setProperty("sonar.auth.google.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); - settings.setProperty("sonar.auth.google.enabled", true); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", "id"); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", "secret"); + settings.setProperty("sonar.auth.googleoauth.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); + settings.setProperty("sonar.auth.googleoauth.enabled", true); } else { - settings.setProperty("sonar.auth.google.enabled", false); + settings.setProperty("sonar.auth.googleoauth.enabled", false); } } diff --git a/src/test/java/org/sonarqube/auth/google/GoogleScribeApiTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java similarity index 68% rename from src/test/java/org/sonarqube/auth/google/GoogleScribeApiTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java index fdc4d3e..1d8d7b3 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleScribeApiTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import com.github.scribejava.core.extractors.JsonTokenExtractor; import com.github.scribejava.core.model.OAuthConfig; @@ -45,13 +65,13 @@ public void getAccessTokenVerb() { public void getAuthorizationUrl() { OAuthConfig oAuthConfig = new OAuthConfig("key", null, "callback", null, "the-scope", null, null, null, null); assertThat(underTest.getAuthorizationUrl(oAuthConfig)).isEqualTo( - "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=key&redirect_uri=callback&scope=the-scope" + "https://accounts.googleoauth.com/o/oauth2/auth?response_type=code&client_id=key&redirect_uri=callback&scope=the-scope" ); oAuthConfig = new OAuthConfig("key", null, "callback", null, "the-scope", null, null, null, null); oAuthConfig.setState("my-test-state"); assertThat(underTest.getAuthorizationUrl(oAuthConfig)).isEqualTo( - "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=key&redirect_uri=callback&scope=the-scope&state=my-test-state" + "https://accounts.googleoauth.com/o/oauth2/auth?response_type=code&client_id=key&redirect_uri=callback&scope=the-scope&state=my-test-state" ); } diff --git a/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java similarity index 51% rename from src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java index 408515d..a74b9a5 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java @@ -17,15 +17,35 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.junit.Test; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonarqube.auth.google.GoogleSettings.LOGIN_STRATEGY_DEFAULT_VALUE; -import static org.sonarqube.auth.google.GoogleSettings.LOGIN_STRATEGY_PROVIDER_LOGIN; +import static org.sonarqube.auth.googleoauth.GoogleSettings.LOGIN_STRATEGY_DEFAULT_VALUE; +import static org.sonarqube.auth.googleoauth.GoogleSettings.LOGIN_STRATEGY_PROVIDER_LOGIN; public class GoogleSettingsTest { @@ -35,33 +55,33 @@ public class GoogleSettingsTest { @Test public void is_enabled() { - settings.setProperty("sonar.auth.google.clientId.secured", "id"); - settings.setProperty("sonar.auth.google.clientSecret.secured", "secret"); - settings.setProperty("sonar.auth.google.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", "id"); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", "secret"); + settings.setProperty("sonar.auth.googleoauth.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); - settings.setProperty("sonar.auth.google.enabled", true); + settings.setProperty("sonar.auth.googleoauth.enabled", true); assertThat(underTest.isEnabled()).isTrue(); - settings.setProperty("sonar.auth.google.enabled", false); + settings.setProperty("sonar.auth.googleoauth.enabled", false); assertThat(underTest.isEnabled()).isFalse(); } @Test public void is_enabled_always_return_false_when_client_id_is_null() { - settings.setProperty("sonar.auth.google.enabled", true); - settings.setProperty("sonar.auth.google.clientId.secured", (String) null); - settings.setProperty("sonar.auth.google.clientSecret.secured", "secret"); - settings.setProperty("sonar.auth.google.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); + settings.setProperty("sonar.auth.googleoauth.enabled", true); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", (String) null); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", "secret"); + settings.setProperty("sonar.auth.googleoauth.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); assertThat(underTest.isEnabled()).isFalse(); } @Test public void is_enabled_always_return_false_when_client_secret_is_null() { - settings.setProperty("sonar.auth.google.enabled", true); - settings.setProperty("sonar.auth.google.clientId.secured", "id"); - settings.setProperty("sonar.auth.google.clientSecret.secured", (String) null); - settings.setProperty("sonar.auth.google.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); + settings.setProperty("sonar.auth.googleoauth.enabled", true); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", "id"); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", (String) null); + settings.setProperty("sonar.auth.googleoauth.loginStrategy", LOGIN_STRATEGY_DEFAULT_VALUE); assertThat(underTest.isEnabled()).isFalse(); } @@ -73,28 +93,28 @@ public void default_login_strategy_is_unique_login() { @Test public void return_client_id() { - settings.setProperty("sonar.auth.google.clientId.secured", "id"); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", "id"); assertThat(underTest.clientId()).isEqualTo("id"); } @Test public void return_client_secret() { - settings.setProperty("sonar.auth.google.clientSecret.secured", "secret"); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", "secret"); assertThat(underTest.clientSecret()).isEqualTo("secret"); } @Test public void return_login_strategy() { - settings.setProperty("sonar.auth.google.loginStrategy", LOGIN_STRATEGY_PROVIDER_LOGIN); + settings.setProperty("sonar.auth.googleoauth.loginStrategy", LOGIN_STRATEGY_PROVIDER_LOGIN); assertThat(underTest.loginStrategy()).isEqualTo(LOGIN_STRATEGY_PROVIDER_LOGIN); } @Test public void allow_users_to_sign_up() { - settings.setProperty("sonar.auth.google.allowUsersToSignUp", "true"); + settings.setProperty("sonar.auth.googleoauth.allowUsersToSignUp", "true"); assertThat(underTest.allowUsersToSignUp()).isTrue(); - settings.setProperty("sonar.auth.google.allowUsersToSignUp", "false"); + settings.setProperty("sonar.auth.googleoauth.allowUsersToSignUp", "false"); assertThat(underTest.allowUsersToSignUp()).isFalse(); } @@ -105,12 +125,12 @@ public void default_apiUrl() { @Test public void default_webUrl() { - assertThat(underTest.webURL()).isEqualTo("https://accounts.google.com/"); + assertThat(underTest.webURL()).isEqualTo("https://accounts.googleoauth.com/o/oauth2/auth"); } @Test public void definitions() { - assertThat(GoogleSettings.definitions()).hasSize(6); + assertThat(GoogleSettings.definitions()).hasSize(7); } } diff --git a/src/test/java/org/sonarqube/auth/google/GsonUserTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java similarity index 70% rename from src/test/java/org/sonarqube/auth/google/GsonUserTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java index aedb0ef..ac1a01e 100644 --- a/src/test/java/org/sonarqube/auth/google/GsonUserTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import org.junit.Test; @@ -37,7 +57,7 @@ public void test_getter_and_setter() { public void parse_from_json() { GsonUser underTest = GsonUser.parse("{\n" + " \"id\": \"42\",\n" + - " \"email\": \"john.smith@google.com\",\n" + + " \"email\": \"john.smith@googleoauth.com\",\n" + " \"verified_email\": true,\n" + " \"name\": \"John Smith\",\n" + " \"given_name\": \"John\",\n" + @@ -46,7 +66,7 @@ public void parse_from_json() { " \"locale\": \"en-US\"\n" + "}"); - assertThat(underTest.getUsername()).isEqualTo("john.smith@google.com"); + assertThat(underTest.getUsername()).isEqualTo("john.smith@googleoauth.com"); assertThat(underTest.getDisplayName()).isEqualTo("John Smith"); } diff --git a/src/test/java/org/sonarqube/auth/google/IntegrationTest.java b/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java similarity index 88% rename from src/test/java/org/sonarqube/auth/google/IntegrationTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java index 447ad22..5274843 100644 --- a/src/test/java/org/sonarqube/auth/google/IntegrationTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java @@ -17,7 +17,27 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; + +/*- + * #%L + * Google Authentication for SonarQube + * %% + * Copyright (C) 2016 SonarSource + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ import com.squareup.okhttp.mockwebserver.MockResponse; import com.squareup.okhttp.mockwebserver.MockWebServer; @@ -48,7 +68,7 @@ public class IntegrationTest { - private static final String CALLBACK_URL = "http://localhost/oauth/callback/google"; + private static final String CALLBACK_URL = "http://localhost/oauth/callback/googleoauth"; @Rule public MockWebServer google = new MockWebServer(); @@ -65,12 +85,12 @@ public class IntegrationTest { @Before public void enable() { - settings.setProperty("sonar.auth.google.clientId.secured", "the_id"); - settings.setProperty("sonar.auth.google.clientSecret.secured", "the_secret"); - settings.setProperty("sonar.auth.google.enabled", true); - settings.setProperty("sonar.auth.google.limitOauthDomain", "google.com"); - settings.setProperty("sonar.auth.google.apiUrl", format("http://%s:%d", google.getHostName(), google.getPort())); - settings.setProperty("sonar.auth.google.webUrl", format("http://%s:%d", google.getHostName(), google.getPort())); + settings.setProperty("sonar.auth.googleoauth.clientId.secured", "the_id"); + settings.setProperty("sonar.auth.googleoauth.clientSecret.secured", "the_secret"); + settings.setProperty("sonar.auth.googleoauth.enabled", true); + settings.setProperty("sonar.auth.googleoauth.limitOauthDomain", "googleoauth.com"); + settings.setProperty("sonar.auth.googleoauth.apiUrl", format("http://%s:%d", google.getHostName(), google.getPort())); + settings.setProperty("sonar.auth.googleoauth.webUrl", format("http://%s:%d/o/oauth2/auth", google.getHostName(), google.getPort())); } /** @@ -87,7 +107,7 @@ public void redirect_browser_to_google_authentication_form() throws Exception { } /** - * Second phase: Google redirects browser to SonarQube at /oauth/callback/google?code={the verifier code}. + * Second phase: Google redirects browser to SonarQube at /oauth/callback/googleoauth?code={the verifier code}. * This SonarQube web service sends two requests to Google: *