本文整理了Java中ch.cyberduck.core.Protocol.disk()
方法的一些代码示例,展示了Protocol.disk()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Protocol.disk()
方法的具体详情如下:
包路径:ch.cyberduck.core.Protocol
类名称:Protocol
方法名:disk
暂无
代码示例来源:origin: iterate-ch/cyberduck
@Override
public String disk() {
if(null == disk) {
return parent.disk();
}
// Temporary file
return disk.getAbsolute();
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public I volumeIcon(final Protocol protocol, final Integer size) {
return this.iconNamed(protocol.disk(), size);
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public char[] reqPassword(Resource<?> resource) {
if(StringUtils.isEmpty(credentials.getIdentityPassphrase())) {
try {
// Use password prompt
final Credentials input = prompt.prompt(bookmark,
LocaleFactory.localizedString("Private key password protected", "Credentials"),
String.format("%s (%s)",
LocaleFactory.localizedString("Enter the passphrase for the private key file", "Credentials"),
identity.getAbbreviatedPath()),
new LoginOptions()
.icon(bookmark.getProtocol().disk())
.user(false).password(true)
);
credentials.setSaved(input.isSaved());
credentials.setIdentityPassphrase(input.getPassword());
}
catch(LoginCanceledException e) {
canceled.set(true);
// Return null if user cancels
return StringUtils.EMPTY.toCharArray();
}
}
return credentials.getIdentityPassphrase().toCharArray();
}
代码示例来源:origin: iterate-ch/cyberduck
"Login {0} with username and password", "Credentials"), authhost.getHostName()),
new LoginOptions()
.icon(bookmark.getProtocol().disk())
.usernamePlaceholder(LocaleFactory.localizedString("Username", "Credentials"))
.passwordPlaceholder(LocaleFactory.localizedString("Password", "Credentials"))
代码示例来源:origin: iterate-ch/cyberduck
public void configure(final Protocol protocol) {
publickey = protocol.isPrivateKeyConfigurable();
certificate = protocol.isCertificateConfigurable();
anonymous = protocol.isAnonymousConfigurable();
user = protocol.isUsernameConfigurable();
password = protocol.isPasswordConfigurable();
token = protocol.isTokenConfigurable();
oauth = protocol.isOAuthConfigurable();
icon = protocol.disk();
usernamePlaceholder = protocol.getUsernamePlaceholder();
passwordPlaceholder = protocol.getPasswordPlaceholder();
}
代码示例来源:origin: iterate-ch/cyberduck
private Credentials unlock(final PasswordCallback callback, final Host bookmark, final UserKeyPair keypair, String passphrase, final String message) throws LoginCanceledException, CryptoException {
final Credentials credentials;
if(null == passphrase) {
credentials = callback.prompt(bookmark, LocaleFactory.localizedString("Decryption password required", "SDS"), message,
new LoginOptions()
.icon(bookmark.getProtocol().disk())
);
if(credentials.getPassword() == null) {
throw new LoginCanceledException();
}
}
else {
credentials = new VaultCredentials(passphrase).withSaved(true);
}
if(!Crypto.checkUserKeyPair(keypair, credentials.getPassword())) {
return this.unlock(callback, bookmark, keypair, null, String.format("%s. %s", LocaleFactory.localizedString("Invalid passphrase", "Credentials"), LocaleFactory.localizedString("Enter your decryption password to access encrypted data rooms.", "SDS")));
}
else {
if(credentials.isSaved()) {
if(log.isInfoEnabled()) {
log.info(String.format("Save encryption password for %s", bookmark));
}
keychain.addPassword(String.format("Triple-Crypt Encryption Password (%s)", bookmark.getCredentials().getUsername()),
new DefaultUrlProvider(bookmark).toUrl(new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory))).find(DescriptiveUrl.Type.provider).getUrl(),
credentials.getPassword());
}
return credentials;
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public char[] reqPassword(Resource<?> resource) {
if(StringUtils.isEmpty(credentials.getIdentityPassphrase())) {
try {
// Use password prompt
final Credentials input = prompt.prompt(bookmark,
LocaleFactory.localizedString("Private key password protected", "Credentials"),
String.format("%s (%s)",
LocaleFactory.localizedString("Enter the passphrase for the private key file", "Credentials"),
identity.getAbbreviatedPath()),
new LoginOptions()
.icon(bookmark.getProtocol().disk())
.user(false).password(true)
);
credentials.setSaved(input.isSaved());
credentials.setIdentityPassphrase(input.getPassword());
}
catch(LoginCanceledException e) {
// Return null if user cancels
return StringUtils.EMPTY.toCharArray();
}
}
config.setPassword(credentials.getIdentityPassphrase());
return credentials.getIdentityPassphrase().toCharArray();
}
代码示例来源:origin: iterate-ch/cyberduck
additional = callback.prompt(bookmark, title.toString(),
message.toString(), new LoginOptions()
.icon(bookmark.getProtocol().disk())
.password(true)
.user(false)
代码示例来源:origin: iterate-ch/cyberduck
/**
* Prompt for MFA credentials
*
* @param mfaSerial Serial number for a hardware device (such as GAHT12345678) or an Amazon Resource Name (ARN) for
* a virtual device (such as arn:aws:iam::123456789012:mfa/user)
* @param callback Prompt controller
* @return MFA one time authentication password.
* @throws ch.cyberduck.core.exception.ConnectionCanceledException Prompt dismissed
*/
@Override
public Credentials getToken(final String mfaSerial, final PasswordCallback callback) throws ConnectionCanceledException {
// Prompt for multi factor authentication credentials.
return callback.prompt(
session.getHost(), LocaleFactory.localizedString("Provide additional login credentials", "Credentials"),
String.format("%s %s", LocaleFactory.localizedString("Multi-Factor Authentication", "S3"), mfaSerial),
new LoginOptions()
.icon(session.getHost().getProtocol().disk())
.password(true)
.user(false)
.passwordPlaceholder(LocaleFactory.localizedString("MFA Authentication Code", "S3"))
.keychain(false)
);
}
}
代码示例来源:origin: iterate-ch/cyberduck
final Host host = this.getSource().get(row.intValue());
if(identifier.equals(BookmarkColumn.icon.name())) {
return IconCacheFactory.<NSImage>get().iconNamed(host.getProtocol().disk(),
PreferencesFactory.get().getInteger("bookmark.icon.size"));
代码示例来源:origin: iterate-ch/cyberduck
LocaleFactory.localizedString("Multi-Factor Authentication", "S3"),
new LoginOptions()
.icon(host.getProtocol().disk())
.user(false)
.keychain(false)
代码示例来源:origin: iterate-ch/cyberduck
private String login(final LoginCallback controller, final LoginRequest request) throws BackgroundException {
try {
try {
return new AuthApi(client).login(request).getToken();
}
catch(ApiException e) {
throw new SDSExceptionMappingService().map(e);
}
}
catch(PartialLoginFailureException e) {
final Credentials additional = controller.prompt(host, host.getCredentials().getUsername(),
LocaleFactory.localizedString("Provide additional login credentials", "Credentials"), e.getDetail(),
new LoginOptions()
.icon(host.getProtocol().disk())
.user(false)
.keychain(false)
);
return this.login(controller, new LoginRequest()
.authType(LoginRequest.AuthTypeEnum.fromValue(host.getProtocol().getAuthorization()))
.password(additional.getPassword())
);
}
}
内容来源于网络,如有侵权,请联系作者删除!