|
15 | 15 | * GNU General Public License for more details. |
16 | 16 | */ |
17 | 17 |
|
18 | | -import ch.cyberduck.core.Credentials; |
19 | 18 | import ch.cyberduck.core.DefaultIOExceptionMappingService; |
20 | 19 | import ch.cyberduck.core.Host; |
21 | 20 | import ch.cyberduck.core.HostKeyCallback; |
22 | 21 | import ch.cyberduck.core.ListService; |
23 | 22 | import ch.cyberduck.core.LoginCallback; |
24 | | -import ch.cyberduck.core.OAuthTokens; |
25 | 23 | import ch.cyberduck.core.UrlProvider; |
26 | 24 | import ch.cyberduck.core.dav.DAVClient; |
27 | | -import ch.cyberduck.core.dav.DAVDirectoryFeature; |
28 | 25 | import ch.cyberduck.core.dav.DAVSession; |
29 | 26 | import ch.cyberduck.core.dav.DAVTouchFeature; |
30 | 27 | import ch.cyberduck.core.exception.BackgroundException; |
31 | 28 | import ch.cyberduck.core.features.AttributesFinder; |
32 | 29 | import ch.cyberduck.core.features.Delete; |
33 | | -import ch.cyberduck.core.features.Directory; |
34 | 30 | import ch.cyberduck.core.features.Home; |
35 | 31 | import ch.cyberduck.core.features.Lock; |
36 | 32 | import ch.cyberduck.core.features.Read; |
|
62 | 58 | import ch.cyberduck.core.tus.TusWriteFeature; |
63 | 59 |
|
64 | 60 | import org.apache.commons.lang3.ArrayUtils; |
65 | | -import org.apache.commons.lang3.StringUtils; |
66 | 61 | import org.apache.http.client.HttpResponseException; |
67 | 62 | import org.apache.logging.log4j.LogManager; |
68 | 63 | import org.apache.logging.log4j.Logger; |
69 | 64 |
|
70 | 65 | import java.io.IOException; |
71 | 66 |
|
72 | | -import com.auth0.jwt.JWT; |
73 | | -import com.auth0.jwt.exceptions.JWTDecodeException; |
74 | | - |
75 | 67 | import static ch.cyberduck.core.tus.TusCapabilities.TUS_VERSION; |
76 | 68 |
|
77 | 69 | public class OwncloudSession extends DAVSession { |
@@ -104,19 +96,6 @@ protected DAVClient connect(final ProxyFinder proxy, final HostKeyCallback key, |
104 | 96 | @Override |
105 | 97 | public void login(final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { |
106 | 98 | super.login(prompt, cancel); |
107 | | - if(host.getProtocol().isOAuthConfigurable()) { |
108 | | - final Credentials credentials = host.getCredentials(); |
109 | | - final OAuthTokens oauth = credentials.getOauth(); |
110 | | - try { |
111 | | - final String username = JWT.decode(oauth.getIdToken()).getClaim("preferred_username").asString(); |
112 | | - if(StringUtils.isNotBlank(username)) { |
113 | | - credentials.setUsername(username); |
114 | | - } |
115 | | - } |
116 | | - catch(JWTDecodeException e) { |
117 | | - log.warn("Failure {} decoding JWT {}", e, oauth.getIdToken()); |
118 | | - } |
119 | | - } |
120 | 99 | try { |
121 | 100 | client.execute(new OcsCapabilitiesRequest(host), new OcsCapabilitiesResponseHandler(ocs)); |
122 | 101 | } |
|
0 commit comments