From f2442034b1ece623ecbc224bf7e155ea26663d23 Mon Sep 17 00:00:00 2001 From: ivinokur Date: Tue, 10 Oct 2023 16:33:13 +0300 Subject: [PATCH] fixup! Respect authorisation request opt-out on workspace start --- .../ssh/GitSshFactoryParametersResolver.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/wsmaster/che-core-api-factory-git-ssh/src/main/java/org/eclipse/che/api/factory/server/git/ssh/GitSshFactoryParametersResolver.java b/wsmaster/che-core-api-factory-git-ssh/src/main/java/org/eclipse/che/api/factory/server/git/ssh/GitSshFactoryParametersResolver.java index c0f009f586..97698512d9 100644 --- a/wsmaster/che-core-api-factory-git-ssh/src/main/java/org/eclipse/che/api/factory/server/git/ssh/GitSshFactoryParametersResolver.java +++ b/wsmaster/che-core-api-factory-git-ssh/src/main/java/org/eclipse/che/api/factory/server/git/ssh/GitSshFactoryParametersResolver.java @@ -12,6 +12,7 @@ package org.eclipse.che.api.factory.server.git.ssh; import static org.eclipse.che.api.factory.server.FactoryResolverPriority.LOWEST; +import static org.eclipse.che.api.factory.shared.Constants.CURRENT_VERSION; import static org.eclipse.che.api.factory.shared.Constants.URL_PARAMETER_NAME; import static org.eclipse.che.dto.server.DtoFactory.newDto; @@ -84,12 +85,16 @@ public class GitSshFactoryParametersResolver extends BaseFactoryParameterResolve // no need to check null value of url parameter as accept() method has performed the check final GitSshUrl gitSshUrl = gitSshURLParser.parse(factoryParameters.get(URL_PARAMETER_NAME)); - return super.createFactory( - factoryParameters, - gitSshUrl, - new GitSshFactoryVisitor(gitSshUrl), - new GitSshAuthorizingFileContentProvider( - gitSshUrl, urlFetcher, personalAccessTokenManager)); + // create factory from the following location if location exists, else create default factory + return urlFactoryBuilder + .createFactoryFromDevfile( + gitSshUrl, + new GitSshAuthorizingFileContentProvider( + gitSshUrl, urlFetcher, personalAccessTokenManager), + extractOverrideParams(factoryParameters), + true) + .orElseGet(() -> newDto(FactoryDto.class).withV(CURRENT_VERSION).withSource("repo")) + .acceptVisitor(new GitSshFactoryVisitor(gitSshUrl)); } /**