Fixes refresh token flow (#4450)
* Fixes refresh token flow * Review comments * Reverting mistake with CI cs url
This commit is contained in:
parent
c2af4a97fd
commit
53c2d815f6
4
.github/workflows/client-test.yml
vendored
4
.github/workflows/client-test.yml
vendored
|
|
@ -206,7 +206,7 @@ jobs:
|
|||
--env APPSMITH_ENCRYPTION_PASSWORD=password \
|
||||
--env APPSMITH_ENCRYPTION_SALT=salt \
|
||||
--env APPSMITH_IS_SELF_HOSTED=false \
|
||||
--env APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com\
|
||||
--env APPSMITH_CLOUD_SERVICES_BASE_URL= \
|
||||
--env APPSMITH_CLOUD_SERVICES_USERNAME= \
|
||||
--env APPSMITH_CLOUD_SERVICES_PASSWORD= \
|
||||
${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:release
|
||||
|
|
@ -221,7 +221,7 @@ jobs:
|
|||
--env APPSMITH_ENCRYPTION_PASSWORD=password \
|
||||
--env APPSMITH_ENCRYPTION_SALT=salt \
|
||||
--env APPSMITH_IS_SELF_HOSTED=false \
|
||||
--env APPSMITH_CLOUD_SERVICES_BASE_URL=https://release-cs.appsmith.com\
|
||||
--env APPSMITH_CLOUD_SERVICES_BASE_URL= \
|
||||
--env APPSMITH_CLOUD_SERVICES_USERNAME= \
|
||||
--env APPSMITH_CLOUD_SERVICES_PASSWORD= \
|
||||
${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-server:nightly
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.appsmith.external.models;
|
|||
import com.appsmith.external.annotations.documenttype.DocumentType;
|
||||
import com.appsmith.external.annotations.encryption.Encrypted;
|
||||
import com.appsmith.external.constants.Authentication;
|
||||
import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginError;
|
||||
import com.appsmith.external.exceptions.pluginExceptions.AppsmithPluginException;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
|
@ -12,7 +14,9 @@ import lombok.ToString;
|
|||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.util.StringUtils;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -73,4 +77,15 @@ public class OAuth2 extends AuthenticationDTO {
|
|||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Boolean> hasExpired() {
|
||||
if (this.authenticationResponse == null) {
|
||||
return Mono.error(new AppsmithPluginException(
|
||||
AppsmithPluginError.PLUGIN_ERROR,
|
||||
"Expected datasource to have valid authentication tokens at this point"));
|
||||
}
|
||||
|
||||
return Mono.just(authenticationResponse.expiresAt.isBefore(Instant.now().plusSeconds(60)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,6 @@ import javax.validation.Validator;
|
|||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
@ -538,11 +536,11 @@ public class NewActionServiceImpl extends BaseService<NewActionRepository, NewAc
|
|||
|
||||
Mono<Datasource> validatedDatasourceMono = authenticationValidator.validateAuthentication(datasource).cache();
|
||||
|
||||
|
||||
Mono<ActionExecutionResult> executionMono = validatedDatasourceMono
|
||||
.flatMap(datasourceContextService::getDatasourceContext)
|
||||
// Now that we have the context (connection details), execute the action.
|
||||
.flatMap(resourceContext -> validatedDatasourceMono.flatMap(datasource1 -> {
|
||||
.flatMap(resourceContext -> validatedDatasourceMono
|
||||
.flatMap(datasource1 -> {
|
||||
return (Mono<ActionExecutionResult>) pluginExecutor.executeParameterized(
|
||||
resourceContext.getConnection(),
|
||||
executeActionDTO,
|
||||
|
|
|
|||
|
|
@ -422,7 +422,11 @@ public class AuthenticationService {
|
|||
oAuth2.setAuthenticationResponse(authenticationResponse);
|
||||
oAuth2.setIsEncrypted(null);
|
||||
datasource.getDatasourceConfiguration().setAuthentication(oAuth2);
|
||||
return datasourceService.update(datasource.getId(), datasource);
|
||||
// We return the same object instead of the update value because the updates value
|
||||
// will be in the encrypted form
|
||||
return datasourceService
|
||||
.update(datasource.getId(), datasource)
|
||||
.thenReturn(datasource);
|
||||
});
|
||||
})
|
||||
.switchIfEmpty(Mono.just(datasource))
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ public class ReleaseNotesService {
|
|||
.flatMap(instanceId -> WebClient
|
||||
.create(
|
||||
baseUrl + "/api/v1/releases?instanceId=" + instanceId +
|
||||
// isCloudHosted should be true only for our cloud instance,
|
||||
// For docker images that burn the segment key with the image, the CE key will be present
|
||||
"&isSourceInstall=" + (isCloudHosted || StringUtils.isEmpty(segmentConfig.getCeKey())) +
|
||||
(StringUtils.isEmpty(repo) ? "" : ("&repo=" + repo))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ admin.emails = ${APPSMITH_ADMIN_EMAILS:}
|
|||
emails.welcome.enabled = ${APPSMITH_EMAILS_WELCOME_ENABLED:true}
|
||||
|
||||
# Appsmith Cloud Services
|
||||
appsmith.cloud_services.base_url = ${APPSMITH_CLOUD_SERVICES_BASE_URL:}
|
||||
appsmith.cloud_services.base_url = ${APPSMITH_CLOUD_SERVICES_BASE_URL:https://cs.appsmith.com}
|
||||
appsmith.cloud_services.username = ${APPSMITH_CLOUD_SERVICES_USERNAME:}
|
||||
appsmith.cloud_services.password = ${APPSMITH_CLOUD_SERVICES_PASSWORD:}
|
||||
github_repo = ${APPSMITH_GITHUB_REPO:}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ APPSMITH_ENCRYPTION_SALT=abcd
|
|||
|
||||
APPSMITH_CODEC_SIZE=10
|
||||
|
||||
#APPSMITH_CLOUD_SERVICES_BASE_URL="https://release-cs.appsmith.com"
|
||||
|
||||
#APPSMITH_OAUTH2_GOOGLE_CLIENT_ID=""
|
||||
#APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET=""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user