]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18591 Add sonar.token property and deprecate sonar.login
authorEric Giffon <eric.giffon@sonarsource.com>
Mon, 13 Mar 2023 16:56:23 +0000 (17:56 +0100)
committerLukasz Jarocki <lukasz.jarocki@sonarsource.com>
Fri, 17 Mar 2023 09:45:58 +0000 (10:45 +0100)
19 files changed:
build.gradle
server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/__tests__/__snapshots__/BitbucketPipelinesTutorial-it.tsx.snap
server/sonar-web/src/main/js/components/tutorials/bitbucket-pipelines/commands/DotNet.ts
server/sonar-web/src/main/js/components/tutorials/github-action/__tests__/__snapshots__/GithubActionTutorial-it.tsx.snap
server/sonar-web/src/main/js/components/tutorials/github-action/commands/DotNet.tsx
server/sonar-web/src/main/js/components/tutorials/gitlabci/__tests__/__snapshots__/GitLabCITutorial-it.tsx.snap
server/sonar-web/src/main/js/components/tutorials/gitlabci/commands/PipeCommand.tsx
server/sonar-web/src/main/js/components/tutorials/other/__tests__/__snapshots__/OtherTutorial-it.tsx.snap
server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetCore.tsx
server/sonar-web/src/main/js/components/tutorials/other/commands/DotNetFramework.tsx
server/sonar-web/src/main/js/components/tutorials/other/commands/ExecScanner.tsx
server/sonar-web/src/main/js/components/tutorials/other/commands/JavaGradle.tsx
server/sonar-web/src/main/js/components/tutorials/other/commands/JavaMaven.tsx
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGenerator.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/DefaultScannerWsClientTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerWsClientProviderTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGeneratorTest.java

index 95b3bde47cd69ad83ea891ca8da4724ca83c19bb..d831ea27bdf0f368b9fd99e43ec4cbfc29b89216 100644 (file)
@@ -353,7 +353,7 @@ subprojects {
       dependency 'org.reflections:reflections:0.10.2'
       dependency 'org.simpleframework:simple:5.1.6'
       dependency 'org.sonarsource.git.blame:git-files-blame:1.0.1.169'
-      dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.40.0.183'
+      dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.41.0.295'
       dependency 'org.sonarsource.update-center:sonar-update-center-common:1.29.0.1000'
       dependency("org.springframework:spring-context:${springVersion}") {
         exclude 'commons-logging:commons-logging'
@@ -616,4 +616,3 @@ tasks.named('sonarqube') {
     outputFile.append(JsonOutput.toJson([category: "Analysis", suite: "Standalone", operation: "total", duration: taskDuration]) + '\n')
   }
 }
-
index fc048678545ad9ed6510a39d964d32f6284d984d..4491112afda53983250518258af710ead84d8a35 100644 (file)
@@ -15,9 +15,9 @@ definitions:
           - apt-get install --yes openjdk-11-jre
           - dotnet tool install --global dotnet-sonarscanner
           - export PATH="$PATH:/root/.dotnet/tools"
-          - dotnet sonarscanner begin /k:"my-project" /d:"sonar.login=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
+          - dotnet sonarscanner begin /k:"my-project" /d:"sonar.token=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
           - dotnet build 
-          - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}"
+          - dotnet sonarscanner end /d:"sonar.token=\${SONAR_TOKEN}"
   caches:
     sonar: ~/.sonar
 
index 02481e27c921fdecc5ef03c926a4d50eed96bbfd..3b6e17fafe2c16d712b2cebfae1ec06fee8ff1c4 100644 (file)
@@ -36,9 +36,9 @@ definitions:
           - apt-get install --yes openjdk-11-jre
           - dotnet tool install --global dotnet-sonarscanner
           - export PATH="$PATH:/root/.dotnet/tools"
-          - dotnet sonarscanner begin /k:"${projectKey}" /d:"sonar.login=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
+          - dotnet sonarscanner begin /k:"${projectKey}" /d:"sonar.token=\${SONAR_TOKEN}"  /d:"sonar.host.url=\${SONAR_HOST_URL}"
           - dotnet build 
-          - dotnet sonarscanner end /d:"sonar.login=\${SONAR_TOKEN}"
+          - dotnet sonarscanner end /d:"sonar.token=\${SONAR_TOKEN}"
   caches:
     sonar: ~/.sonar
 
index e7a91a7df94d51a39dd294e2582583f341924509..178e17d227342d2ee930f5ede29e6fab074a7380 100644 (file)
@@ -46,9 +46,9 @@ jobs:
           GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
         shell: powershell
         run: |
-          .\\.sonar\\scanner\\dotnet-sonarscanner begin /k:"my-project" /d:sonar.login="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
+          .\\.sonar\\scanner\\dotnet-sonarscanner begin /k:"my-project" /d:sonar.token="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
           dotnet build
-          .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.login="\${{ secrets.SONAR_TOKEN }}""
+          .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.token="\${{ secrets.SONAR_TOKEN }}""
 `;
 
 exports[`should follow and complete all steps: CFamily Linux: .github/workflows/build.yml 1`] = `
index 138fde63301591c3d6109647c45bfe6ecd301547..26580bbfc348dbe56380c9d918695de439e3aa6c 100644 (file)
@@ -61,9 +61,9 @@ function dotnetYamlSteps(projectKey: string) {
           GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
         shell: powershell
         run: |
-          .\\.sonar\\scanner\\dotnet-sonarscanner begin /k:"${projectKey}" /d:sonar.login="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
+          .\\.sonar\\scanner\\dotnet-sonarscanner begin /k:"${projectKey}" /d:sonar.token="\${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="\${{ secrets.SONAR_HOST_URL }}"
           dotnet build
-          .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.login="\${{ secrets.SONAR_TOKEN }}"`;
+          .\\.sonar\\scanner\\dotnet-sonarscanner end /d:sonar.token="\${{ secrets.SONAR_TOKEN }}"`;
 }
 
 export default function DotNet(props: DotNetProps) {
index 13f3630f4edda8d032ad094a329f707fe72541f0..cc7c5e33d3ddddb7726eabdbe4f7f72f4120a16c 100644 (file)
@@ -15,9 +15,9 @@ exports[`should follow and complete all steps: .NET: gitlab-ci.yml 1`] = `
       - "apt-get install --yes openjdk-11-jre"
       - "dotnet tool install --global dotnet-sonarscanner"
       - "export PATH=\\"$PATH:$HOME/.dotnet/tools\\""
-      - "dotnet sonarscanner begin /k:\\"my-project\\" /d:sonar.login=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
+      - "dotnet sonarscanner begin /k:\\"my-project\\" /d:sonar.token=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
       - "dotnet build"
-      - "dotnet sonarscanner end /d:sonar.login=\\"$SONAR_TOKEN\\""
+      - "dotnet sonarscanner end /d:sonar.token=\\"$SONAR_TOKEN\\""
   allow_failure: true
   rules:
     - if: $CI_COMMIT_BRANCH == 'main'
index a97667611612929b29f67950e8130a3a5ac157eb..323b6ad67ccc2b3523a751cca6bc856a39612c7a 100644 (file)
@@ -44,9 +44,9 @@ const BUILD_TOOL_SPECIFIC = {
       - "apt-get install --yes openjdk-11-jre"
       - "dotnet tool install --global dotnet-sonarscanner"
       - "export PATH=\\"$PATH:$HOME/.dotnet/tools\\""
-      - "dotnet sonarscanner begin /k:\\"${projectKey}\\" /d:sonar.login=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
+      - "dotnet sonarscanner begin /k:\\"${projectKey}\\" /d:sonar.token=\\"$SONAR_TOKEN\\" /d:\\"sonar.host.url=$SONAR_HOST_URL\\" "
       - "dotnet build"
-      - "dotnet sonarscanner end /d:sonar.login=\\"$SONAR_TOKEN\\""`,
+      - "dotnet sonarscanner end /d:sonar.token=\\"$SONAR_TOKEN\\""`,
   },
   [BuildTools.Other]: {
     image: `
index 402d7e7f541723a5fae21f5e521c53d5fb16782a..cee9bc50114f170ecc62efb1ecb09f5e36aff6a9 100644 (file)
@@ -60,26 +60,26 @@ $env:SONAR_SCANNER_OPTS="-server"
 "
 `;
 
-exports[`can choose build tools and copy provided settings: dotnet core: execute command 1 1`] = `"dotnet sonarscanner begin /k:"my-project" /d:sonar.host.url="http://localhost:9000"  /d:sonar.login="generatedtoken2""`;
+exports[`can choose build tools and copy provided settings: dotnet core: execute command 1 1`] = `"dotnet sonarscanner begin /k:"my-project" /d:sonar.host.url="http://localhost:9000"  /d:sonar.token="generatedtoken2""`;
 
 exports[`can choose build tools and copy provided settings: dotnet core: execute command 2 1`] = `"dotnet build"`;
 
-exports[`can choose build tools and copy provided settings: dotnet core: execute command 3 1`] = `"dotnet sonarscanner end /d:sonar.login="generatedtoken2""`;
+exports[`can choose build tools and copy provided settings: dotnet core: execute command 3 1`] = `"dotnet sonarscanner end /d:sonar.token="generatedtoken2""`;
 
 exports[`can choose build tools and copy provided settings: dotnet core: install scanner globally 1`] = `"dotnet tool install --global dotnet-sonarscanner"`;
 
-exports[`can choose build tools and copy provided settings: dotnet framework: execute command 1 1`] = `"SonarScanner.MSBuild.exe begin /k:"my-project" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="generatedtoken2""`;
+exports[`can choose build tools and copy provided settings: dotnet framework: execute command 1 1`] = `"SonarScanner.MSBuild.exe begin /k:"my-project" /d:sonar.host.url="http://localhost:9000" /d:sonar.token="generatedtoken2""`;
 
 exports[`can choose build tools and copy provided settings: dotnet framework: execute command 2 1`] = `"MsBuild.exe /t:Rebuild"`;
 
-exports[`can choose build tools and copy provided settings: dotnet framework: execute command 3 1`] = `"SonarScanner.MSBuild.exe end /d:sonar.login="generatedtoken2""`;
+exports[`can choose build tools and copy provided settings: dotnet framework: execute command 3 1`] = `"SonarScanner.MSBuild.exe end /d:sonar.token="generatedtoken2""`;
 
 exports[`can choose build tools and copy provided settings: gradle: execute scanner 1`] = `
 "./gradlew sonar \\
   -Dsonar.projectKey=my-project \\
   -Dsonar.projectName='MyProject' \\
   -Dsonar.host.url=http://localhost:9000 \\
-  -Dsonar.login=generatedtoken2"
+  -Dsonar.token=generatedtoken2"
 `;
 
 exports[`can choose build tools and copy provided settings: gradle: sonarqube plugin 1`] = `
@@ -93,7 +93,7 @@ exports[`can choose build tools and copy provided settings: maven: execute scann
   -Dsonar.projectKey=my-project \\
   -Dsonar.projectName='MyProject' \\
   -Dsonar.host.url=http://localhost:9000 \\
-  -Dsonar.login=generatedtoken2"
+  -Dsonar.token=generatedtoken2"
 `;
 
 exports[`can choose build tools and copy provided settings: other linux: execute scanner 1`] = `
index 94bead506569b803f0636fda184f7cb4fcbf9076..ef3fae9e94308cb4ad96015a986fdf4a615cc207 100644 (file)
@@ -28,9 +28,9 @@ export default function DotNetCore(props: DotNetProps) {
   const { baseUrl, component, token } = props;
 
   const commands = [
-    `dotnet sonarscanner begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}"  /d:sonar.login="${token}"`,
+    `dotnet sonarscanner begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}"  /d:sonar.token="${token}"`,
     'dotnet build',
-    `dotnet sonarscanner end /d:sonar.login="${token}"`,
+    `dotnet sonarscanner end /d:sonar.token="${token}"`,
   ];
 
   return (
index 1bd7580cd0be826d67f29cfe441bd094c52b27ea..55362bb46e3b884381c64a61e01982d34f972723 100644 (file)
@@ -28,9 +28,9 @@ export default function DotNetFramework(props: DotNetProps) {
   const { baseUrl, component, token } = props;
 
   const commands = [
-    `SonarScanner.MSBuild.exe begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}" /d:sonar.login="${token}"`,
+    `SonarScanner.MSBuild.exe begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}" /d:sonar.token="${token}"`,
     'MsBuild.exe /t:Rebuild',
-    `SonarScanner.MSBuild.exe end /d:sonar.login="${token}"`,
+    `SonarScanner.MSBuild.exe end /d:sonar.token="${token}"`,
   ];
 
   return (
index 018c09ce92500fcbfda29602e52594368ea526d2..b37c57abbb90b5b8c44075ce4b5c79780f28cc9a 100644 (file)
@@ -47,7 +47,7 @@ export default function ExecScanner(props: ExecScannerProps) {
     '-D' + q('sonar.sources=.'),
     cfamily ? '-D' + q('sonar.cfamily.build-wrapper-output=bw-output') : undefined,
     '-D' + q(`sonar.host.url=${baseUrl}`),
-    isLocal ? '-D' + q(`sonar.login=${token}`) : undefined,
+    isLocal ? '-D' + q(`sonar.token=${token}`) : undefined,
   ];
 
   return (
index 7fe32b990e6b0f56fe588cf9f229de5ce94baaa4..929bb0e0904416e606aef8155059b121262461aa 100644 (file)
@@ -44,7 +44,7 @@ export default function JavaGradle(props: JavaGradleProps) {
     `-Dsonar.projectKey=${component.key}`,
     `-Dsonar.projectName='${component.name}'`,
     `-Dsonar.host.url=${baseUrl}`,
-    `-Dsonar.login=${token}`,
+    `-Dsonar.token=${token}`,
   ];
 
   return (
index 869c9e66329d31f34c8afa070427a73b8a1bd0d8..aa4ce669b68a0a589b2464d2f271b2b457b7b138 100644 (file)
@@ -39,7 +39,7 @@ export default function JavaMaven(props: JavaMavenProps) {
     `-Dsonar.projectKey=${component.key}`,
     `-Dsonar.projectName='${component.name}'`,
     `-Dsonar.host.url=${baseUrl}`,
-    `-Dsonar.login=${token}`,
+    `-Dsonar.token=${token}`,
   ];
 
   return (
index a53e81dc4072e9a8db28a0e127ead33c3354a02e..5dfc85f4dd269949d110a9572ab5ac93e1761382 100644 (file)
@@ -109,8 +109,8 @@ public class DefaultScannerWsClient implements ScannerWsClient {
           CoreProperties.LOGIN, CoreProperties.PASSWORD));
       }
       // not authenticated - see https://jira.sonarsource.com/browse/SONAR-4048
-      throw MessageException.of(format("Not authorized. Analyzing this project requires authentication. "
-        + "Please provide a user token in %s or other credentials in %s and %s.", CoreProperties.LOGIN, CoreProperties.LOGIN, CoreProperties.PASSWORD));
+      throw MessageException.of(format("Not authorized. Analyzing this project requires authentication. Please provide a user token in %s" +
+        " or other credentials in %s and %s.", ScannerWsClientProvider.TOKEN_PROPERTY, CoreProperties.LOGIN, CoreProperties.PASSWORD));
     }
     if (code == HTTP_FORBIDDEN) {
       throw MessageException.of("You're not authorized to analyze this project or the project doesn't exist on SonarQube" +
index a42e48a5054e1305acfe687a4cff28c948709171..c38ad36fd31058999637da19e1df8fbb90e2db37 100644 (file)
@@ -34,6 +34,8 @@ import static org.apache.commons.lang.StringUtils.defaultIfBlank;
 public class ScannerWsClientProvider {
   static final int CONNECT_TIMEOUT_MS = 5_000;
   static final String READ_TIMEOUT_SEC_PROPERTY = "sonar.ws.timeout";
+  public static final String TOKEN_PROPERTY = "sonar.token";
+  private static final String TOKEN_ENV_VARIABLE = "SONAR_TOKEN";
   static final int DEFAULT_READ_TIMEOUT_SEC = 60;
 
   @Bean("DefaultScannerWsClient")
@@ -43,7 +45,8 @@ public class ScannerWsClientProvider {
     HttpConnector.Builder connectorBuilder = HttpConnector.newBuilder();
 
     String timeoutSec = defaultIfBlank(scannerProps.property(READ_TIMEOUT_SEC_PROPERTY), valueOf(DEFAULT_READ_TIMEOUT_SEC));
-    String token = defaultIfBlank(system.envVariable("SONAR_TOKEN"), null);
+    String envVarToken = defaultIfBlank(system.envVariable(TOKEN_ENV_VARIABLE), null);
+    String token = defaultIfBlank(scannerProps.property(TOKEN_PROPERTY), envVarToken);
     String login = defaultIfBlank(scannerProps.property(CoreProperties.LOGIN), token);
     connectorBuilder
       .readTimeoutMilliseconds(parseInt(timeoutSec) * 1_000)
index 79f5d1eb5270ccb0e39d1adc52911ea072def444..54595d632d058e5c133407c454922568559a2fab 100644 (file)
@@ -26,13 +26,14 @@ import org.sonar.api.config.Configuration;
 import org.sonar.api.notifications.AnalysisWarnings;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
+import org.sonar.scanner.bootstrap.ScannerWsClientProvider;
 
 public class DeprecatedPropertiesWarningGenerator {
   private static final Logger LOG = Loggers.get(DeprecatedPropertiesWarningGenerator.class);
 
   @VisibleForTesting
-  public static final String PASSWORD_WARN_MESSAGE = "Property '" + CoreProperties.PASSWORD + "' is deprecated. It will not be supported " +
-    "in the future. Please instead use the 'sonar.login' parameter with a token.";
+  static final String CREDENTIALS_WARN_MESSAGE = String.format("The properties '%s' and '%s' are deprecated. They will not be supported " +
+    "in the future. Please instead use the '%s' parameter.", CoreProperties.LOGIN, CoreProperties.PASSWORD, ScannerWsClientProvider.TOKEN_PROPERTY);
 
   private final Configuration configuration;
   private final AnalysisWarnings analysisWarnings;
@@ -43,10 +44,11 @@ public class DeprecatedPropertiesWarningGenerator {
   }
 
   public void execute() {
+    Optional<String> login = configuration.get(CoreProperties.LOGIN);
     Optional<String> password = configuration.get(CoreProperties.PASSWORD);
-    if (password.isPresent()) {
-      LOG.warn(PASSWORD_WARN_MESSAGE);
-      analysisWarnings.addUnique(PASSWORD_WARN_MESSAGE);
+    if (login.isPresent() || password.isPresent()) {
+      LOG.warn(CREDENTIALS_WARN_MESSAGE);
+      analysisWarnings.addUnique(CREDENTIALS_WARN_MESSAGE);
     }
   }
 
index cf2c26e7a15bc4443fcc95090e030e1c590fe92c..1d5aed378127553c90396d1f7ec22813d45052e6 100644 (file)
@@ -101,7 +101,7 @@ public class DefaultScannerWsClientTest {
     assertThatThrownBy(() -> new DefaultScannerWsClient(wsClient, false,
       new GlobalAnalysisMode(new ScannerProperties(Collections.emptyMap())), analysisWarnings).call(request))
         .isInstanceOf(MessageException.class)
-        .hasMessage("Not authorized. Analyzing this project requires authentication. Please provide a user token in sonar.login or other " +
+        .hasMessage("Not authorized. Analyzing this project requires authentication. Please provide a user token in sonar.token or other " +
           "credentials in sonar.login and sonar.password.");
   }
 
index 74117787648050b046bcd94fa7eaa50ee149a85d..e1c36390291929c6ddd4aeddea935b0fcb95d2f4 100644 (file)
@@ -56,8 +56,7 @@ public class ScannerWsClientProviderTest {
   public void provide_client_with_custom_settings() {
     Map<String, String> props = new HashMap<>();
     props.put("sonar.host.url", "https://here/sonarqube");
-    props.put("sonar.login", "theLogin");
-    props.put("sonar.password", "thePassword");
+    props.put("sonar.token", "testToken");
     props.put("sonar.ws.timeout", "42");
     ScannerProperties settings = new ScannerProperties(props);
 
index fbcc86817a5b2297641a98ed4dc710adf56bdd54..f8cbf8c944d3bceed42766108366f4982f960d8c 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.scanner.scan;
 
 import org.assertj.core.api.Assertions;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -32,7 +33,7 @@ import org.sonar.api.utils.log.LoggerLevel;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoInteractions;
-import static org.sonar.scanner.scan.DeprecatedPropertiesWarningGenerator.PASSWORD_WARN_MESSAGE;
+import static org.sonar.scanner.scan.DeprecatedPropertiesWarningGenerator.CREDENTIALS_WARN_MESSAGE;
 
 public class DeprecatedPropertiesWarningGeneratorTest {
 
@@ -42,26 +43,41 @@ public class DeprecatedPropertiesWarningGeneratorTest {
   private final MapSettings settings = new MapSettings();
 
   private final AnalysisWarnings analysisWarnings = Mockito.spy(AnalysisWarnings.class);
-  private final DeprecatedPropertiesWarningGenerator underTest = new DeprecatedPropertiesWarningGenerator(settings.asConfig(), analysisWarnings);
+  private final DeprecatedPropertiesWarningGenerator underTest = new DeprecatedPropertiesWarningGenerator(settings.asConfig(),
+    analysisWarnings);
+
+  @Before
+  public void setUp() throws Exception {
+    settings.removeProperty(CoreProperties.LOGIN);
+    settings.removeProperty(CoreProperties.PASSWORD);
+  }
 
   @Test
-  public void verify_warning_when_using_password() {
-    settings.setProperty(CoreProperties.PASSWORD, "winner winner chicken dinner");
+  public void execute_whenUsingLogin_shouldAddWarning() {
+    settings.setProperty(CoreProperties.LOGIN, "test");
 
     underTest.execute();
 
-    verify(analysisWarnings, times(1)).addUnique(PASSWORD_WARN_MESSAGE);
-    Assertions.assertThat(logger.logs(LoggerLevel.WARN)).contains(PASSWORD_WARN_MESSAGE);
+    verify(analysisWarnings, times(1)).addUnique(CREDENTIALS_WARN_MESSAGE);
+    Assertions.assertThat(logger.logs(LoggerLevel.WARN)).contains(CREDENTIALS_WARN_MESSAGE);
   }
 
   @Test
-  public void verify_no_warning_when_not_using_password() {
-    settings.removeProperty(CoreProperties.PASSWORD);
+  public void execute_whenUsingPassword_shouldAddWarning() {
+    settings.setProperty(CoreProperties.PASSWORD, "winner winner chicken dinner");
 
     underTest.execute();
 
+    verify(analysisWarnings, times(1)).addUnique(CREDENTIALS_WARN_MESSAGE);
+    Assertions.assertThat(logger.logs(LoggerLevel.WARN)).contains(CREDENTIALS_WARN_MESSAGE);
+  }
+
+  @Test
+  public void execute_whenNotUsingLoginOrPassword_shouldNotAddWarning() {
+    underTest.execute();
+
     verifyNoInteractions(analysisWarnings);
     Assertions.assertThat(logger.logs(LoggerLevel.WARN)).isEmpty();
   }
 
-}
\ No newline at end of file
+}