-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make OAuth prefix used for storing credentials configurable; use port… #15114
base: master
Are you sure you want to change the base?
Conversation
core/src/main/java/ch/cyberduck/core/DefaultHostPasswordStore.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/DefaultHostPasswordStore.java
Outdated
Show resolved
Hide resolved
On Windows the OAuth Token is attached to the Credential Manager entry for a host in an additional "page"/attribute. Basically:
Thus the configurable oauth prefix isn't used there. |
core/src/main/java/ch/cyberduck/core/DefaultHostPasswordStore.java
Outdated
Show resolved
Hide resolved
ac17560
to
ec72ed9
Compare
if (protocol.isPortConfigurable() && !Equals(protocol.getDefaultPort(), bookmark.getPort())) | ||
isOAuth = true; | ||
OAuthPrefixService oAuthPrefix = new OAuthPrefixServiceFactory().create(bookmark); | ||
hostname = oAuthPrefix.getIdentifier(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AliveDevil looks dodgy to assign identifier
to hostname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's what I called the field, could change that to identifier
, which holds either OAuthPrefix.getIdentifier()
or bookmark.getHostname()
(in non-OAuth path).
Which is then built to duck:identifier:port?user=
(OAuth) or duck:fqdn:port?user=
(Default).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes a regression as previously entries were saved using bookmark.getProtocol().getOAuthTokenUrl()
when available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only using the protocol identifier and no token URL will cause entries to be saved with the same key for bookmarks using same protocol but different OAuth endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AliveDevil The previous default was duck:identifier:fqdn:port?user=
, not duck:fqdn:port?user=
?
core/src/main/java/ch/cyberduck/core/OAuthPrefixServiceFactory.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/DefaultOAuthPrefixService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/preferences/Preferences.java
Outdated
Show resolved
Hide resolved
ec72ed9
to
10c08c1
Compare
247781e
to
fb98028
Compare
fb98028
to
507c612
Compare
6b5dbe3
to
f311e4f
Compare
Refactored to protocol service
|
core/src/main/java/ch/cyberduck/core/PasswordStorePrefixService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/preferences/Preferences.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/DefaultPasswordStorePrefixService.java
Outdated
Show resolved
Hide resolved
windows/src/main/csharp/ch/cyberduck/ui/core/preferences/ApplicationPreferences.cs
Outdated
Show resolved
Hide resolved
cli/src/main/csharp/ch/cyberduck/cli/WindowsTerminalPreferences.cs
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/PasswordStorePrefixService.java
Outdated
Show resolved
Hide resolved
core/src/main/java/ch/cyberduck/core/PasswordStorePrefixService.java
Outdated
Show resolved
Hide resolved
…okup. Signed-off-by: chenkins <[email protected]>
a30e21e
to
fe35500
Compare
if (!string.IsNullOrWhiteSpace(cred.Password)) | ||
{ | ||
return cred.Password; | ||
} | ||
|
||
return base.findLoginPassword(bookmark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the base implementation will load the platform specific implementation of the prefix service this will cause a regression in failure finding deprecated store entries.
core/src/main/java/ch/cyberduck/core/CredentialManagerPasswordStoreDescriptorService.java
Show resolved
Hide resolved
23accf1
to
8650ca9
Compare
return null; | ||
} | ||
final PasswordStoreDescriptorService service = bookmark.getProtocol().getFeature(PasswordStoreDescriptorService.class); | ||
final String prefix = service.getDescriptor(bookmark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused.
final Credentials credentials = bookmark.getCredentials(); | ||
if(StringUtils.isEmpty(credentials.getUsername())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this case handled in the new implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduce variables, e.g. URI.create(bookmark.getProtocol().getOAuthTokenUrl())
to avoid duplicate code which is not very readable as you always have to check if there is any difference to the previous usage.
var credentials = bookmark.getCredentials(); | ||
|
||
var targetBuilder = new UriBuilder(PreferencesFactory.get().getProperty("application.container.name"), string.Empty); | ||
PasswordStoreDescriptorService service = (PasswordStoreDescriptorService)bookmark.getProtocol().getFeature(typeof(PasswordStorePrefixService)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong type PasswordStorePrefixService
.
string hostname = service.getHostname(bookmark); | ||
if (!string.IsNullOrWhiteSpace(hostname)) | ||
{ | ||
pathBuilder.Append(hostname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing :
between prefix and hostname?
@@ -211,27 +221,37 @@ public override void save(Host bookmark) | |||
|
|||
private static Uri ToUri(Host bookmark) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage for such methods.
var pathBuilder = new StringBuilder(); | ||
pathBuilder.Append(protocol.getIdentifier()); | ||
if (protocol.isHostnameConfigurable() || !(protocol.isTokenConfigurable() || protocol.isOAuthConfigurable())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this equivalent to the new checks in CredentialManagerPasswordStoreDescriptorService
which are different.
Resolves #15113