@Override public String getAWSAccessKeyId() { return credentials.getUsername(); }
@Override protected StorageBucket[] listAllBucketsImpl() throws ServiceException { return super.listAllBucketsImpl( Collections.singletonMap("x-goog-project-id", host.getCredentials().getUsername())); }
@Override protected StorageBucket createBucketImpl(String bucketName, String location, AccessControlList acl) throws ServiceException { return super.createBucketImpl(bucketName, location, acl, Collections.singletonMap("x-goog-project-id", host.getCredentials().getUsername())); }
protected boolean userIsOwner() { final MantaAccountHomeInfo account = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath()); return StringUtils.equals(host.getCredentials().getUsername(), account.getAccountOwner()); }
private String getOAuthPrefix(final Host bookmark) { if(StringUtils.isNotBlank(bookmark.getCredentials().getUsername())) { return String.format("%s (%s)", bookmark.getProtocol().getDescription(), bookmark.getCredentials().getUsername()); } return bookmark.getProtocol().getDescription(); }
@Override public boolean accept(Host host) { return StringUtils.lowerCase(BookmarkNameProvider.toString(host)).contains(searchString.toLowerCase(Locale.ROOT)) || ((null != host.getComment()) && StringUtils.lowerCase(host.getComment()).contains(searchString.toLowerCase(Locale.ROOT))) || ((null != host.getCredentials().getUsername()) && StringUtils.lowerCase(host.getCredentials().getUsername()).contains(searchString.toLowerCase(Locale.ROOT))) || StringUtils.lowerCase(host.getHostname()).contains(searchString.toLowerCase(Locale.ROOT)); } });
@Override public void awakeFromNib() { super.awakeFromNib(); if(options.user) { window.makeFirstResponder(usernameField); } if(options.password && !org.apache.commons.lang3.StringUtils.isBlank(credentials.getUsername())) { window.makeFirstResponder(passwordField); } }
@Override public void windowDidBecomeKey(final NSNotification notification) { // Reset credentials this.updateField(usernameField, credentials.getUsername()); this.updateField(passwordField, credentials.getPassword()); }
@Override public void authSucceeded(final HttpHost authhost, final AuthScheme authScheme, final HttpContext context) { final HttpClientContext clientContext = HttpClientContext.adapt(context); final Credentials credentials = clientContext.getAttribute(PROXY_CREDENTIALS_INPUT_ID, Credentials.class); if(null != credentials) { clientContext.removeAttribute(PROXY_CREDENTIALS_INPUT_ID); if(log.isInfoEnabled()) { log.info(String.format("Save passphrase for proxy %s", authhost)); } keychain.addCredentials(authhost.toURI(), credentials.getUsername(), credentials.getPassword()); } super.authSucceeded(authhost, authScheme, context); }
public Credentials unlock(final PasswordCallback callback, final Host bookmark, final UserKeyPair keypair) throws CryptoException, LoginCanceledException { final String passphrase = keychain.getPassword(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()); return this.unlock(callback, bookmark, keypair, passphrase, LocaleFactory.localizedString("Enter your decryption password to access encrypted data rooms.", "SDS")); }
@Override public Boolean authenticate(final Host bookmark, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("Login using none authentication with credentials %s", bookmark.getCredentials())); } try { session.getClient().auth(bookmark.getCredentials().getUsername(), new AuthNone()); return session.getClient().isAuthenticated(); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } }
@Override public Credentials getCredentials(final String username) { // Ignore user but use username from host credentials final String user = host.getCredentials().getUsername(); final String password = store.getPassword(host.getProtocol().getScheme(), host.getPort(), host.getHostname(), user); if(StringUtils.isEmpty(password)) { return null; } return new Credentials(user, password); } }
@Override public void change(final Host bookmark) { updateField(usernameField, credentials.getUsername()); usernameField.cell().setPlaceholderString(bookmark.getProtocol().getUsernamePlaceholder()); usernameField.setEnabled(options.user && !credentials.isAnonymousLogin()); } });
protected boolean isWorldReadable(final MantaObject object) { final MantaAccountHomeInfo accountHomeInfo = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath()); return StringUtils.startsWithAny( object.getPath(), accountHomeInfo.getAccountPublicRoot().getAbsolute()); }
@Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { return new MantaAccountHomeInfo(session.getHost().getCredentials().getUsername(), session.getHost().getDefaultPath()).getNormalizedHomePath(); } return home; } }
/** * @return URL */ public String get(final Host bookmark) { final Scheme scheme = bookmark.getProtocol().getScheme(); final int port = bookmark.getPort(); final String username = bookmark.getCredentials().getUsername(); final String hostname = bookmark.getHostname(); final String path = bookmark.getDefaultPath(); return this.get(scheme, port, username, hostname, path); }
@Override public String get(final Host bookmark) { switch(bookmark.getProtocol().getScheme()) { case sftp: return super.get(Scheme.ftp, bookmark.getPort(), bookmark.getCredentials().getUsername(), bookmark.getHostname(), bookmark.getDefaultPath()); } return super.get(bookmark); } }
protected boolean isUserWritable(final MantaObject object) { final MantaAccountHomeInfo account = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath()); return StringUtils.startsWithAny( object.getPath(), account.getAccountPublicRoot().getAbsolute(), account.getAccountPrivateRoot().getAbsolute()); }
protected boolean isUserWritable(final Path file) { final MantaAccountHomeInfo account = new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath()); return file.equals(account.getAccountPublicRoot()) || file.equals(account.getAccountPrivateRoot()) || file.isChild(account.getAccountPublicRoot()) || file.isChild(account.getAccountPrivateRoot()); }
public MantaSession(final Host host, final X509TrustManager trust, final X509KeyManager key) { super(host, new ThreadLocalHostnameDelegatingTrustManager(new DisabledX509TrustManager(), host.getHostname()), key); config = new AuthAwareConfigContext(new ChainedConfigContext( new DefaultsConfigContext(), new StandardConfigContext() .setNoAuth(true) .setMantaKeyPath(null) .setHttpsProtocols(PreferencesFactory.get().getProperty("connection.ssl.protocols")) .setDisableNativeSignatures(true) .setMantaUser(host.getCredentials().getUsername()) .setMantaURL(String.format("%s://%s", host.getProtocol().getScheme().name(), host.getHostname())) )); }