From 8f99afad8aed55f0a9564315846b33d4f5750ca5 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Fri, 22 Sep 2023 15:36:15 +0200 Subject: [PATCH] Make flow type optional in profile configuration. --- .../java/ch/cyberduck/core/owncloud/OwncloudSession.java | 4 +++- s3/src/main/java/ch/cyberduck/core/s3/S3Session.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java b/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java index 83f6d07198f..a303bba9e68 100644 --- a/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java +++ b/owncloud/src/main/java/ch/cyberduck/core/owncloud/OwncloudSession.java @@ -65,8 +65,10 @@ protected HttpClientBuilder getConfiguration(final Proxy proxy, final LoginCallb final HttpClientBuilder configuration = super.getConfiguration(proxy, prompt); if(host.getProtocol().isOAuthConfigurable()) { authorizationService = new OAuth2RequestInterceptor(configuration.build(), host, prompt) - .withFlowType(OAuth2AuthorizationService.FlowType.valueOf(host.getProtocol().getAuthorization())) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); + if(host.getProtocol().getAuthorization() != null) { + authorizationService.withFlowType(OAuth2AuthorizationService.FlowType.valueOf(host.getProtocol().getAuthorization())); + } configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService)); } diff --git a/s3/src/main/java/ch/cyberduck/core/s3/S3Session.java b/s3/src/main/java/ch/cyberduck/core/s3/S3Session.java index d9aa7c4eda5..c88762e0ca5 100644 --- a/s3/src/main/java/ch/cyberduck/core/s3/S3Session.java +++ b/s3/src/main/java/ch/cyberduck/core/s3/S3Session.java @@ -191,8 +191,10 @@ protected RequestEntityRestStorageService connect(final Proxy proxy, final HostK if(host.getProtocol().isOAuthConfigurable()) { final OAuth2RequestInterceptor oauth = new OAuth2RequestInterceptor(builder.build(ProxyFactory.get() .find(host.getProtocol().getOAuthAuthorizationUrl()), this, prompt).build(), host, prompt) - .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()) - .withFlowType(OAuth2AuthorizationService.FlowType.valueOf(host.getProtocol().getAuthorization())); + .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); + if(host.getProtocol().getAuthorization() != null) { + oauth.withFlowType(OAuth2AuthorizationService.FlowType.valueOf(host.getProtocol().getAuthorization())); + } configuration.addInterceptorLast(oauth); final STSAssumeRoleCredentialsRequestInterceptor interceptor = new STSAssumeRoleCredentialsRequestInterceptor(oauth, this, trust, key, prompt);