From 052c0601eabf180242046481eecc7fc1abcaa12f Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 10:36:18 -0400 Subject: [PATCH 01/24] Changed how the default Google auth URL is handled --- .../org/sonarqube/auth/google/GoogleSettings.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java b/src/main/java/org/sonarqube/auth/google/GoogleSettings.java index 5ba8260..a186e91 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java +++ b/src/main/java/org/sonarqube/auth/google/GoogleSettings.java @@ -43,7 +43,7 @@ public class GoogleSettings { public static final String API_URL = "sonar.auth.google.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 DEFAULT_WEB_URL = "https://accounts.google.com/o/oauth2/auth"; public static final String LOGIN_STRATEGY = "sonar.auth.google.loginStrategy"; public static final String LOGIN_STRATEGY_UNIQUE = "Unique"; public static final String LOGIN_STRATEGY_PROVIDER_LOGIN = "Same as Google login"; @@ -88,7 +88,7 @@ public String webURL() { if (url == null) { url = DEFAULT_WEB_URL; } - return urlWithEndingSlash(url); + return url; } public String apiURL() { @@ -158,11 +158,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() ); } From d0d972e9a2e5a9ee70c8c8fc720ed233d688d08e Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 10:36:41 -0400 Subject: [PATCH 02/24] Updated unit tests to account for new Settings --- .../java/org/sonarqube/auth/google/GoogleSettingsTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java b/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java index 408515d..d0e43bf 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java +++ b/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java @@ -105,12 +105,12 @@ public void default_apiUrl() { @Test public void default_webUrl() { - assertThat(underTest.webURL()).isEqualTo("https://accounts.google.com/"); + assertThat(underTest.webURL()).isEqualTo("https://accounts.google.com/o/oauth2/auth"); } @Test public void definitions() { - assertThat(GoogleSettings.definitions()).hasSize(6); + assertThat(GoogleSettings.definitions()).hasSize(7); } } From 9374ec5c83810f153c5a8b1f0b60c9615329a5da Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 10:37:24 -0400 Subject: [PATCH 03/24] Updated other code related to webUrl() changes --- src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java | 2 +- .../java/org/sonarqube/auth/google/AuthGooglePluginTest.java | 2 +- src/test/java/org/sonarqube/auth/google/IntegrationTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java b/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java index 8c10ad4..47d607a 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java +++ b/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java @@ -49,7 +49,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/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java b/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java index 30da3d2..967bb3e 100644 --- a/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java +++ b/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java @@ -29,7 +29,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/IntegrationTest.java b/src/test/java/org/sonarqube/auth/google/IntegrationTest.java index 447ad22..1e36735 100644 --- a/src/test/java/org/sonarqube/auth/google/IntegrationTest.java +++ b/src/test/java/org/sonarqube/auth/google/IntegrationTest.java @@ -70,7 +70,7 @@ public void enable() { 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.google.webUrl", format("http://%s:%d/o/oauth2/auth", google.getHostName(), google.getPort())); } /** From a8f6eef8f1b09a72d93f0e21ccaefd298d20033c Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 10:48:04 -0400 Subject: [PATCH 04/24] Added ability to publish release --- .travis.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29fe2a8..a980929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,4 +14,13 @@ cache: - $HOME/.m2/repository # for analysis - $HOME/.sonar - +before_deploy: + - export RELEASE_JAR=$(ls target/sonar-auth-google-plugin-*.jar + - echo "Deploying ${RELEASE_JAR} to GitHub" +deploy: + provider: releases + api_key: "9c3a2beeb5c59cb519ccfc7ca55e0b1c70731258" + file: "${RELEASE_JAR}" + skip_cleanup: true + on: + tags: true \ No newline at end of file From 328f33198786ad1133cb1ef30b1857933a2ebc2e Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:19:44 -0400 Subject: [PATCH 05/24] Bump version and add SCM plugin --- pom.xml | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index e86061a..a6421aa 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.sonarqube.auth.google sonar-auth-google-plugin - 1.1-SNAPSHOT + 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 @@ -156,6 +156,36 @@ + + 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 + + + + From abb6b176b7b1d6e9a57728126bf722d0af87b698 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:20:02 -0400 Subject: [PATCH 06/24] Add GitHub release to build --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a980929..adfd519 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,9 @@ cache: # for analysis - $HOME/.sonar before_deploy: - - export RELEASE_JAR=$(ls target/sonar-auth-google-plugin-*.jar + - export VERSION=$(cat pom.xml | grep -A 1 "sonar-auth-google-plugin" | grep version | sed 's@^[^>]*>\([^<]*\)<.*@\1@g') + - git push --tags + - export RELEASE_JAR=$(ls target/sonar-auth-google-plugin-${VERSION}.jar) - echo "Deploying ${RELEASE_JAR} to GitHub" deploy: provider: releases From 8edd474bb67c9af5e1860590c18ca867c110595a Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:20:54 -0400 Subject: [PATCH 07/24] Add REASE notes to deployment --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index adfd519..910a94e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ deploy: provider: releases api_key: "9c3a2beeb5c59cb519ccfc7ca55e0b1c70731258" file: "${RELEASE_JAR}" + file: "target/RELEASE_NOTES" skip_cleanup: true on: tags: true \ No newline at end of file From 2edb3771f1788400b6a43a2da064c32475585250 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:21:06 -0400 Subject: [PATCH 08/24] Generate release notes --- travis.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index fd3db1f..6b1008e 100755 --- a/travis.sh +++ b/travis.sh @@ -3,7 +3,7 @@ set -euo pipefail if [ "${TRAVIS_BRANCH}" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - echo '======= Build, and analyze master, no deploy' + echo '======= Build, and analyze master, deploy to GitHub Releases' # Fetch all commit history so that SonarQube has exact blame information # for issue auto-assignment @@ -50,3 +50,5 @@ else -B -e -V fi +LAST_TAG=$(git rev-list --tags --max-count=1) +git show -s --format=%ad ${LAST_TAG} > target/RELEASE_NOTES From 0d3c77dfc3fc9a365ad8a6aaa8108a37f2f2c485 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:23:29 -0400 Subject: [PATCH 09/24] Allow release notes to display in build --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index 6b1008e..8919f0c 100755 --- a/travis.sh +++ b/travis.sh @@ -51,4 +51,4 @@ else fi LAST_TAG=$(git rev-list --tags --max-count=1) -git show -s --format=%ad ${LAST_TAG} > target/RELEASE_NOTES +git show -s --format=%ad ${LAST_TAG} | tee target/RELEASE_NOTES From 0bc17be1675a1ece38bbdf69a3530d9b2cca95e3 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:26:14 -0400 Subject: [PATCH 10/24] Debugging release notes generation --- travis.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/travis.sh b/travis.sh index 8919f0c..ddcdc13 100755 --- a/travis.sh +++ b/travis.sh @@ -51,4 +51,5 @@ else fi LAST_TAG=$(git rev-list --tags --max-count=1) +echo "Generating release notes from git history since: ${LAST_TAG}" git show -s --format=%ad ${LAST_TAG} | tee target/RELEASE_NOTES From eeddc0c21accdb1d3dc9fd154f803a822e6033ce Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:32:10 -0400 Subject: [PATCH 11/24] More release notes debugging --- travis.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/travis.sh b/travis.sh index ddcdc13..d4dce2a 100755 --- a/travis.sh +++ b/travis.sh @@ -50,6 +50,5 @@ else -B -e -V fi -LAST_TAG=$(git rev-list --tags --max-count=1) -echo "Generating release notes from git history since: ${LAST_TAG}" -git show -s --format=%ad ${LAST_TAG} | tee target/RELEASE_NOTES +echo "Generating release notes from git history" +git show -s $(git rev-list --tags --max-count=1) $(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES From bad5d235b96bde0779299f7e893fe47126dba2a6 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:45:12 -0400 Subject: [PATCH 12/24] Fixed release notes generation --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index d4dce2a..82dfc80 100755 --- a/travis.sh +++ b/travis.sh @@ -51,4 +51,4 @@ else fi echo "Generating release notes from git history" -git show -s $(git rev-list --tags --max-count=1) $(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES +git show -s --pretty=format:"%h - %<|(35)%an%s" $(git rev-list --tags --max-count=1) $(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES From 1265140a2836802b8cf791ddb2e2ddda46b4ec8e Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:48:14 -0400 Subject: [PATCH 13/24] Migrate to org.sonarqube.auth.googleoath package name --- .travis.yml | 4 +- pom.xml | 4 +- .../AuthGooglePlugin.java | 2 +- .../GoogleIdentityProvider.java | 8 ++-- .../GoogleScribeApi.java | 2 +- .../GoogleSettings.java | 22 +++++----- .../{google => googleoauth}/GsonUser.java | 2 +- .../UserIdentityFactory.java | 4 +- .../{google => googleoauth}/package-info.java | 2 +- .../AuthGooglePluginTest.java | 2 +- .../GoogleIdentityProviderTest.java | 20 ++++----- .../GoogleScribeApiTest.java | 6 +-- .../GoogleSettingsTest.java | 44 +++++++++---------- .../{google => googleoauth}/GsonUserTest.java | 6 +-- .../IntegrationTest.java | 28 ++++++------ .../UserIdentityFactoryTest.java | 14 +++--- 16 files changed, 85 insertions(+), 85 deletions(-) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/AuthGooglePlugin.java (97%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/GoogleIdentityProvider.java (95%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/GoogleScribeApi.java (98%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/GoogleSettings.java (90%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/GsonUser.java (98%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/UserIdentityFactory.java (95%) rename src/main/java/org/sonarqube/auth/{google => googleoauth}/package-info.java (95%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/AuthGooglePluginTest.java (96%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/GoogleIdentityProviderTest.java (77%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/GoogleScribeApiTest.java (87%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/GoogleSettingsTest.java (60%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/GsonUserTest.java (93%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/IntegrationTest.java (93%) rename src/test/java/org/sonarqube/auth/{google => googleoauth}/UserIdentityFactoryTest.java (94%) diff --git a/.travis.yml b/.travis.yml index 910a94e..0aca2d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,9 @@ cache: # for analysis - $HOME/.sonar before_deploy: - - export VERSION=$(cat pom.xml | grep -A 1 "sonar-auth-google-plugin" | grep version | sed 's@^[^>]*>\([^<]*\)<.*@\1@g') + - 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-google-plugin-${VERSION}.jar) + - export RELEASE_JAR=$(ls target/sonar-auth-googleoauth-plugin-${VERSION}.jar) - echo "Deploying ${RELEASE_JAR} to GitHub" deploy: provider: releases diff --git a/pom.xml b/pom.xml index a6421aa..541e47a 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.sonarqube.auth.google - sonar-auth-google-plugin + sonar-auth-googleoauth-plugin 1.2-SNAPSHOT sonar-plugin Google Authentication for SonarQube @@ -130,7 +130,7 @@ 1.15 true - org.sonarqube.auth.google.AuthGooglePlugin + org.sonarqube.auth.googleoauth.AuthGooglePlugin diff --git a/src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java similarity index 97% rename from src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java rename to src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java index d04e6f9..a456d2c 100644 --- a/src/main/java/org/sonarqube/auth/google/AuthGooglePlugin.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java @@ -17,7 +17,7 @@ * 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; 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 95% rename from src/main/java/org/sonarqube/auth/google/GoogleIdentityProvider.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java index 91918c7..4222797 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleIdentityProvider.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java @@ -17,7 +17,7 @@ * 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; import com.github.scribejava.core.builder.ServiceBuilder; import com.github.scribejava.core.model.*; @@ -41,7 +41,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,8 +67,8 @@ 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") + // URL of src/main/resources/static/googleoauth.svg at runtime + .setIconPath("/static/authgoogle/googleoauth.svg") .setBackgroundColor("#236487") .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 98% rename from src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java index 47d607a..524752b 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleScribeApi.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java @@ -17,7 +17,7 @@ * 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; import com.github.scribejava.apis.GoogleApi20; import com.github.scribejava.core.extractors.AccessTokenExtractor; diff --git a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java similarity index 90% rename from src/main/java/org/sonarqube/auth/google/GoogleSettings.java rename to src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java index a186e91..eae5970 100644 --- a/src/main/java/org/sonarqube/auth/google/GoogleSettings.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java @@ -17,7 +17,7 @@ * 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; import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; @@ -34,22 +34,22 @@ @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"; + 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"; // URLs are not configurable yet - public static final String API_URL = "sonar.auth.google.apiUrl"; + 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/o/oauth2/auth"; - 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; diff --git a/src/main/java/org/sonarqube/auth/google/GsonUser.java b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java similarity index 98% rename from src/main/java/org/sonarqube/auth/google/GsonUser.java rename to src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java index 1ec4890..95eb79e 100644 --- a/src/main/java/org/sonarqube/auth/google/GsonUser.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java @@ -17,7 +17,7 @@ * 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; 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 95% rename from src/main/java/org/sonarqube/auth/google/UserIdentityFactory.java rename to src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java index 4e5e617..ed61790 100644 --- a/src/main/java/org/sonarqube/auth/google/UserIdentityFactory.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java @@ -17,13 +17,13 @@ * 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; 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 95% 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..1637aa5 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,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonarqube.auth.google; +package org.sonarqube.auth.googleoauth; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java similarity index 96% rename from src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java index 967bb3e..c0df0fe 100644 --- a/src/test/java/org/sonarqube/auth/google/AuthGooglePluginTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java @@ -17,7 +17,7 @@ * 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; import org.junit.Test; diff --git a/src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java similarity index 77% rename from src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java index 3deed04..876f509 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleIdentityProviderTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java @@ -17,7 +17,7 @@ * 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; import org.junit.Rule; import org.junit.Test; @@ -30,7 +30,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,9 +45,9 @@ 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().getIconPath()).isEqualTo("/static/authgoogle/googleoauth.svg"); assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#236487"); } @@ -60,7 +60,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 +75,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 87% rename from src/test/java/org/sonarqube/auth/google/GoogleScribeApiTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java index fdc4d3e..be3641d 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleScribeApiTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java @@ -17,7 +17,7 @@ * 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; import com.github.scribejava.core.extractors.JsonTokenExtractor; import com.github.scribejava.core.model.OAuthConfig; @@ -45,13 +45,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 60% rename from src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java index d0e43bf..c92eb0d 100644 --- a/src/test/java/org/sonarqube/auth/google/GoogleSettingsTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java @@ -17,15 +17,15 @@ * 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; 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 +35,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 +73,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,7 +105,7 @@ public void default_apiUrl() { @Test public void default_webUrl() { - assertThat(underTest.webURL()).isEqualTo("https://accounts.google.com/o/oauth2/auth"); + assertThat(underTest.webURL()).isEqualTo("https://accounts.googleoauth.com/o/oauth2/auth"); } @Test diff --git a/src/test/java/org/sonarqube/auth/google/GsonUserTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java similarity index 93% rename from src/test/java/org/sonarqube/auth/google/GsonUserTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java index aedb0ef..4e69096 100644 --- a/src/test/java/org/sonarqube/auth/google/GsonUserTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java @@ -17,7 +17,7 @@ * 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; import org.junit.Test; @@ -37,7 +37,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 +46,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 93% rename from src/test/java/org/sonarqube/auth/google/IntegrationTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java index 1e36735..4d318fa 100644 --- a/src/test/java/org/sonarqube/auth/google/IntegrationTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java @@ -17,7 +17,7 @@ * 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; import com.squareup.okhttp.mockwebserver.MockResponse; import com.squareup.okhttp.mockwebserver.MockWebServer; @@ -48,7 +48,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 +65,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/o/oauth2/auth", 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 +87,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: *
    *
  • get an access token
  • @@ -100,7 +100,7 @@ public void callback_on_successful_authentication() throws IOException, Interrup // response of https://www.googleapis.com/oauth2/v3/token google.enqueue(new MockResponse().setBody("{\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" + @@ -114,9 +114,9 @@ public void callback_on_successful_authentication() throws IOException, Interrup underTest.callback(callbackContext); assertThat(callbackContext.csrfStateVerified.get()).isFalse(); - assertThat(callbackContext.userIdentity.getLogin()).isEqualTo("john.smith@google.com"); + assertThat(callbackContext.userIdentity.getLogin()).isEqualTo("john.smith@googleoauth.com"); assertThat(callbackContext.userIdentity.getName()).isEqualTo("John Smith"); - assertThat(callbackContext.userIdentity.getEmail()).isEqualTo("john.smith@google.com"); + assertThat(callbackContext.userIdentity.getEmail()).isEqualTo("john.smith@googleoauth.com"); assertThat(callbackContext.redirectSent.get()).isTrue(); // Verify the requests sent to Google @@ -127,7 +127,7 @@ public void callback_on_successful_authentication() throws IOException, Interrup } /** - * 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: *
      *
    • get an access token
    • @@ -136,7 +136,7 @@ public void callback_on_successful_authentication() throws IOException, Interrup */ @Test public void callback_on_successful_authentication_without_domain() throws IOException, InterruptedException { - settings.removeProperty("sonar.auth.google.limitOauthDomain"); + settings.removeProperty("sonar.auth.googleoauth.limitOauthDomain"); callback_on_successful_authentication(); } diff --git a/src/test/java/org/sonarqube/auth/google/UserIdentityFactoryTest.java b/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java similarity index 94% rename from src/test/java/org/sonarqube/auth/google/UserIdentityFactoryTest.java rename to src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java index 917c6ff..70411f2 100644 --- a/src/test/java/org/sonarqube/auth/google/UserIdentityFactoryTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java @@ -17,7 +17,7 @@ * 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; import org.junit.Rule; import org.junit.Test; @@ -43,7 +43,7 @@ public class UserIdentityFactoryTest { public void create_login_for_provider_strategy() { GsonUser gson = 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" + @@ -53,16 +53,16 @@ public void create_login_for_provider_strategy() { "}"); settings.setProperty(GoogleSettings.LOGIN_STRATEGY, GoogleSettings.LOGIN_STRATEGY_PROVIDER_LOGIN); UserIdentity identity = underTest.create(gson); - assertThat(identity.getLogin()).isEqualTo("john.smith@google.com"); + assertThat(identity.getLogin()).isEqualTo("john.smith@googleoauth.com"); assertThat(identity.getName()).isEqualTo("John Smith"); - assertThat(identity.getEmail()).isEqualTo("john.smith@google.com"); + assertThat(identity.getEmail()).isEqualTo("john.smith@googleoauth.com"); } @Test public void create_login_for_unique_login_strategy() { GsonUser gson = 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" + @@ -73,9 +73,9 @@ public void create_login_for_unique_login_strategy() { settings.setProperty(GoogleSettings.LOGIN_STRATEGY, GoogleSettings.LOGIN_STRATEGY_UNIQUE); UserIdentity identity = underTest.create(gson); - assertThat(identity.getLogin()).isEqualTo("john.smith@google.com"); + assertThat(identity.getLogin()).isEqualTo("john.smith@googleoauth.com"); assertThat(identity.getName()).isEqualTo("John Smith"); - assertThat(identity.getEmail()).isEqualTo("john.smith@google.com"); + assertThat(identity.getEmail()).isEqualTo("john.smith@googleoauth.com"); } @Test From 42a1ada501c4309b52ba2844072cddd55303084c Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:50:39 -0400 Subject: [PATCH 14/24] One last fix to release notes (I hope) --- travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis.sh b/travis.sh index 82dfc80..0951a4e 100755 --- a/travis.sh +++ b/travis.sh @@ -51,4 +51,4 @@ else fi echo "Generating release notes from git history" -git show -s --pretty=format:"%h - %<|(35)%an%s" $(git rev-list --tags --max-count=1) $(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES +git show -s --pretty=format:"%h - %<|(35)%an%s" $(git rev-list --tags --max-count=1)...$(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES From 4f9b2749a1a33ea5ee0ed66d91658f7bf73b9dfe Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 11:59:38 -0400 Subject: [PATCH 15/24] Update license information --- pom.xml | 16 +++++++++++++++ .../auth/googleoauth/AuthGooglePlugin.java | 20 +++++++++++++++++++ .../googleoauth/GoogleIdentityProvider.java | 20 +++++++++++++++++++ .../auth/googleoauth/GoogleScribeApi.java | 20 +++++++++++++++++++ .../auth/googleoauth/GoogleSettings.java | 20 +++++++++++++++++++ .../sonarqube/auth/googleoauth/GsonUser.java | 20 +++++++++++++++++++ .../auth/googleoauth/UserIdentityFactory.java | 20 +++++++++++++++++++ .../auth/googleoauth/package-info.java | 20 +++++++++++++++++++ .../org/sonar/l10n/authgoogle.properties | 19 ++++++++++++++++++ .../googleoauth/AuthGooglePluginTest.java | 20 +++++++++++++++++++ .../GoogleIdentityProviderTest.java | 20 +++++++++++++++++++ .../auth/googleoauth/GoogleScribeApiTest.java | 20 +++++++++++++++++++ .../auth/googleoauth/GoogleSettingsTest.java | 20 +++++++++++++++++++ .../auth/googleoauth/GsonUserTest.java | 20 +++++++++++++++++++ .../auth/googleoauth/IntegrationTest.java | 20 +++++++++++++++++++ .../googleoauth/UserIdentityFactoryTest.java | 20 +++++++++++++++++++ 16 files changed, 315 insertions(+) diff --git a/pom.xml b/pom.xml index 541e47a..299402a 100644 --- a/pom.xml +++ b/pom.xml @@ -186,6 +186,22 @@ + + org.codehaus.mojo + license-maven-plugin + 1.9 + + apache_v2 + + + + download-licenses + + download-licenses + + + + diff --git a/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java index a456d2c..8d0448b 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/AuthGooglePlugin.java @@ -19,6 +19,26 @@ */ 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; import java.util.ArrayList; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java index 4222797..7b79e8e 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java @@ -19,6 +19,26 @@ */ 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.*; import com.github.scribejava.core.oauth.OAuthService; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java index 524752b..f573392 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleScribeApi.java @@ -19,6 +19,26 @@ */ 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; import com.github.scribejava.core.extractors.JsonTokenExtractor; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java index eae5970..7e5ecdf 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java @@ -19,6 +19,26 @@ */ 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; import org.sonar.api.config.Settings; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java index 95eb79e..5647bf3 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GsonUser.java @@ -19,6 +19,26 @@ */ 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; import javax.annotation.CheckForNull; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java b/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java index ed61790..558fc23 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/UserIdentityFactory.java @@ -19,6 +19,26 @@ */ 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; diff --git a/src/main/java/org/sonarqube/auth/googleoauth/package-info.java b/src/main/java/org/sonarqube/auth/googleoauth/package-info.java index 1637aa5..fa5ab1b 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/package-info.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/package-info.java @@ -20,4 +20,24 @@ @ParametersAreNonnullByDefault 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 index b0186f3..060adde 100644 --- a/src/main/resources/org/sonar/l10n/authgoogle.properties +++ b/src/main/resources/org/sonar/l10n/authgoogle.properties @@ -1,3 +1,22 @@ +### +# #%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.google=Google property.category.security.google.description=In order to enable Google authentication:
      • SonarQube must be publicly accessible through HTTPS only
      • The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL WITHOUT A TRAILING SLASH
      • In your Google developers console, you need to create a set of credentials for a web application which the 'Callback URL' must be set to '<value_of_sonar.core.serverBaseURL_property>/oauth2/callback', and enable READ access to the Google+ API.
      diff --git a/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java index c0df0fe..07db1c8 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/AuthGooglePluginTest.java @@ -19,6 +19,26 @@ */ 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 static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java index 876f509..0f1b44b 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java @@ -19,6 +19,26 @@ */ 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; import org.junit.rules.ExpectedException; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java index be3641d..1d8d7b3 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleScribeApiTest.java @@ -19,6 +19,26 @@ */ 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; import com.github.scribejava.core.model.Verb; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java index c92eb0d..a74b9a5 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleSettingsTest.java @@ -19,6 +19,26 @@ */ 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; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java index 4e69096..ac1a01e 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GsonUserTest.java @@ -19,6 +19,26 @@ */ 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 static org.assertj.core.api.Assertions.assertThat; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java b/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java index 4d318fa..5274843 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/IntegrationTest.java @@ -19,6 +19,26 @@ */ 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; import com.squareup.okhttp.mockwebserver.RecordedRequest; diff --git a/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java b/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java index 70411f2..2cb6d79 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/UserIdentityFactoryTest.java @@ -19,6 +19,26 @@ */ 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; import org.junit.rules.ExpectedException; From 3fc8a8d5c00d201b86eddc3607b63294e7e6d7f9 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 12:00:39 -0400 Subject: [PATCH 16/24] Added LICENSE file --- LICENSE.txt | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE.txt 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. From 6dfd232b3b35dc48a22de64dd72788098f243684 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 12:14:18 -0400 Subject: [PATCH 17/24] Added logic to set maven version to release --- travis.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/travis.sh b/travis.sh index 0951a4e..aa046ae 100755 --- a/travis.sh +++ b/travis.sh @@ -2,6 +2,11 @@ set -euo pipefail +if ["$TRAVIS_PULL_REQUEST" != "false"]; then + echo "Setting Maven release values" + mvn versions:set -DnewVersion=$(git tag | tail -n 1) +fi + if [ "${TRAVIS_BRANCH}" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo '======= Build, and analyze master, deploy to GitHub Releases' @@ -50,5 +55,7 @@ else -B -e -V fi -echo "Generating release notes from git history" -git show -s --pretty=format:"%h - %<|(35)%an%s" $(git rev-list --tags --max-count=1)...$(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES +if ["$TRAVIS_PULL_REQUEST" != "false"]; then + echo "Generating release notes from git history" + git show -s --pretty=format:"%h - %<|(35)%an%s" $(git rev-list --tags --max-count=1)...$(git show | grep "^commit" | awk '{print $2}') | tee target/RELEASE_NOTES +fi \ No newline at end of file From 69f8aaeee04007348db0c3ee606f537757d22218 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 12:40:10 -0400 Subject: [PATCH 18/24] Added Travis build status to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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/). From 8a52fe86afbb622b2724e8e4016b7e357ce070b1 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 12:46:50 -0400 Subject: [PATCH 19/24] Replaced API token with encrypted token --- .travis.yml | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0aca2d3..be2f864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +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" +- 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: "9c3a2beeb5c59cb519ccfc7ca55e0b1c70731258" + 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}" - file: "target/RELEASE_NOTES" - skip_cleanup: true on: - tags: true \ No newline at end of file + repo: InfoSec812/sonar-auth-google From b976c97e1ae4e2e034c1a5b45e7ad84609f75bea Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 12:48:08 -0400 Subject: [PATCH 20/24] Change release config to only deploy tagged versions --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index be2f864..fe3ea42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,4 +21,4 @@ deploy: file: target/RELEASE_NOTES file: "${RELEASE_JAR}" on: - repo: InfoSec812/sonar-auth-google + tags: true From 6b44fc3e31bb69da9fcf38e3ece630fb472afa9c Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Fri, 27 May 2016 14:42:06 -0400 Subject: [PATCH 21/24] Update property names for package name changes --- src/main/resources/org/sonar/l10n/authgoogle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/org/sonar/l10n/authgoogle.properties b/src/main/resources/org/sonar/l10n/authgoogle.properties index 060adde..3ca5fcd 100644 --- a/src/main/resources/org/sonar/l10n/authgoogle.properties +++ b/src/main/resources/org/sonar/l10n/authgoogle.properties @@ -17,7 +17,7 @@ # limitations under the License. # #L% ### -property.category.security.google=Google -property.category.security.google.description=In order to enable Google authentication:
      • SonarQube must be publicly accessible through HTTPS only
      • The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL WITHOUT A TRAILING SLASH
      • In your Google developers console, you need to create a set of credentials for a web application which the 'Callback URL' must be set to '<value_of_sonar.core.serverBaseURL_property>/oauth2/callback', and enable READ access to the Google+ API.
      +property.category.security.googleoauth=Google +property.category.security.googleoauth.description=In order to enable Google authentication:
      • SonarQube must be publicly accessible through HTTPS only
      • The property 'sonar.core.serverBaseURL' must be set to this public HTTPS URL WITHOUT A TRAILING SLASH
      • In your Google developers console, you need to create a set of credentials for a web application which the 'Callback URL' must be set to '<value_of_sonar.core.serverBaseURL_property>/oauth2/callback', and enable READ access to the Google+ API.
      From 5183566850d41b81f364f6000e55f72e1e381b7b Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Tue, 31 May 2016 07:52:27 -0400 Subject: [PATCH 22/24] More debugging of Google OAuth --- pom.xml | 2 +- .../sonarqube/auth/googleoauth/GoogleIdentityProvider.java | 4 ++-- .../java/org/sonarqube/auth/googleoauth/GoogleSettings.java | 1 - .../{authgoogle.properties => authgoogleoauth.properties} | 0 src/main/resources/static/{google.svg => googleoauth.svg} | 0 .../auth/googleoauth/GoogleIdentityProviderTest.java | 2 +- 6 files changed, 4 insertions(+), 5 deletions(-) rename src/main/resources/org/sonar/l10n/{authgoogle.properties => authgoogleoauth.properties} (100%) rename src/main/resources/static/{google.svg => googleoauth.svg} (100%) diff --git a/pom.xml b/pom.xml index 299402a..a83580d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.sonarqube.auth.google sonar-auth-googleoauth-plugin - 1.2-SNAPSHOT + 1.1 sonar-plugin Google Authentication for SonarQube Google Authentication for SonarQube diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java index 7b79e8e..b16dff0 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleIdentityProvider.java @@ -88,8 +88,8 @@ public String getName() { public Display getDisplay() { return Display.builder() // URL of src/main/resources/static/googleoauth.svg at runtime - .setIconPath("/static/authgoogle/googleoauth.svg") - .setBackgroundColor("#236487") + .setIconPath("/static/googleoauth/googleoauth.svg") + .setBackgroundColor("#4d90fe") .build(); } diff --git a/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java index 7e5ecdf..7fe42d1 100644 --- a/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java +++ b/src/main/java/org/sonarqube/auth/googleoauth/GoogleSettings.java @@ -59,7 +59,6 @@ public class GoogleSettings { 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"; - // URLs are not configurable yet 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.googleoauth.webUrl"; diff --git a/src/main/resources/org/sonar/l10n/authgoogle.properties b/src/main/resources/org/sonar/l10n/authgoogleoauth.properties similarity index 100% rename from src/main/resources/org/sonar/l10n/authgoogle.properties rename to src/main/resources/org/sonar/l10n/authgoogleoauth.properties 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/googleoauth/GoogleIdentityProviderTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java index 0f1b44b..826c050 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java @@ -67,7 +67,7 @@ public class GoogleIdentityProviderTest { public void check_fields() { assertThat(underTest.getKey()).isEqualTo("googleoauth"); assertThat(underTest.getName()).isEqualTo("Google"); - assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/authgoogle/googleoauth.svg"); + assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/authgoogleoauth/googleoauth.svg"); assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#236487"); } From a857571bccf40034357ec14f78024e57d9de884b Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Tue, 31 May 2016 07:53:57 -0400 Subject: [PATCH 23/24] Clean up unit tests for color change --- .../auth/googleoauth/GoogleIdentityProviderTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java index 826c050..29057b4 100644 --- a/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java +++ b/src/test/java/org/sonarqube/auth/googleoauth/GoogleIdentityProviderTest.java @@ -67,8 +67,8 @@ public class GoogleIdentityProviderTest { public void check_fields() { assertThat(underTest.getKey()).isEqualTo("googleoauth"); assertThat(underTest.getName()).isEqualTo("Google"); - assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/authgoogleoauth/googleoauth.svg"); - assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#236487"); + assertThat(underTest.getDisplay().getIconPath()).isEqualTo("/static/googleoauth/googleoauth.svg"); + assertThat(underTest.getDisplay().getBackgroundColor()).isEqualTo("#4d90fe"); } @Test From f0fe0e9aded25a35b101e21b2d1070929c2624a8 Mon Sep 17 00:00:00 2001 From: Deven Phillips Date: Tue, 31 May 2016 07:58:35 -0400 Subject: [PATCH 24/24] Updated version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a83580d..299402a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.sonarqube.auth.google sonar-auth-googleoauth-plugin - 1.1 + 1.2-SNAPSHOT sonar-plugin Google Authentication for SonarQube Google Authentication for SonarQube