Java Code Examples for org.apache.commons.vfs2.UserAuthenticationData#getData()

The following examples show how to use org.apache.commons.vfs2.UserAuthenticationData#getData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SmbUserAuthenticator.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void userSelectedHook(UserAuthenticationData userAuthenticationData) {
  char[] domain = new char[0];
  if (userAuthenticationData != null) {
    domain = userAuthenticationData.getData(UserAuthenticationData.DOMAIN);
  }
  fieldTf.setText(new String(domain));

}
 
Example 2
Source File: SftpUserAuthenticator.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void userSelectedHook(UserAuthenticationData userAuthenticationData) {
  if (userAuthenticationData != null) {
    char[] sshKeyPath = userAuthenticationData.getData(UserAuthenticationDataWrapper.SSH_KEY);
    String path = "";
    if (sshKeyPath != null && sshKeyPath.length > 0) {
      path = new String(sshKeyPath);
    }
    sshKeyFileField.setText(path);
  }
}
 
Example 3
Source File: UserPassUserAuthenticator.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
private void userSelected(String user) {
  UserAuthenticationData userAuthenticationData = getAuthStore().getUserAuthenticationData(new UserAuthenticationInfo(getVfsUriParser().getProtocol().getName(), getVfsUriParser().getHostname(), user));
  char[] passChars = new char[0];

  if (userAuthenticationData != null && userAuthenticationData.getData(UserAuthenticationData.PASSWORD) != null) {
    passChars = userAuthenticationData.getData(UserAuthenticationData.PASSWORD);
  }
  passTx.setText(new String(passChars));

  userSelectedHook(userAuthenticationData);
}
 
Example 4
Source File: UserAuthenticatorUtils.java    From commons-vfs with Apache License 2.0 5 votes vote down vote up
/**
 * Gets data of given type from the UserAuthenticationData or null if there is no data or data of this type
 * available.
 *
 * @param data The UserAuthenticationData.
 * @param type The type of the element to retrieve.
 * @param overriddenValue The default value.
 * @return The data of the given type as a character array or null if the data is not available.
 */
public static char[] getData(final UserAuthenticationData data, final UserAuthenticationData.Type type,
        final char[] overriddenValue) {
    if (overriddenValue != null) {
        return overriddenValue;
    }

    if (data == null) {
        return null;
    }

    return data.getData(type);
}