Skip to content

Commit

Permalink
Merge pull request #397 from mdrillin/TEIIDDES-2215
Browse files Browse the repository at this point in the history
TEIIDDES-2215 passwords not masked in Teiid Connection Importer
  • Loading branch information
blafond committed Aug 21, 2014
2 parents 0438a54 + 8a79c6d commit d9f2ae0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ public String getText( Object element ) {
return property.getDisplayName();
} else {
String value = property.getValue();
if((property.isMasked() || property.getDisplayName().equalsIgnoreCase(PropertyItem.PASSWORD_PROP_DISPLAYNAME)) && !CoreStringUtil.isEmpty(value)) {
if((property.isMasked() || property.isPassword()) && !CoreStringUtil.isEmpty(value)) {
return "*****"; //$NON-NLS-1$
}
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ protected CellEditor getCellEditor( Object element ) {

if (this.allowedValues == null) {
PropertyItem pItem = (PropertyItem)element;
boolean isPassword = pItem.getDisplayName().equalsIgnoreCase(PropertyItem.PASSWORD_PROP_DISPLAYNAME);
if(isPassword) {
if(pItem.isPassword()) {
this.currentEditor = new TextCellEditor((Composite)getViewer().getControl(), SWT.SINGLE | SWT.PASSWORD);
} else {
this.currentEditor = new TextCellEditor((Composite)getViewer().getControl(), SWT.SINGLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ public class PropertyItem extends Object implements Serializable {
@SuppressWarnings( "javadoc" )
public static final String PASSWORD_PROP_DISPLAYNAME = "password"; //$NON-NLS-1$

@SuppressWarnings( "javadoc" )
private static final String PASSWORD_PROP_NAME = "password"; //$NON-NLS-1$
@SuppressWarnings( "javadoc" )
private static final String AUTH_PASSWORD_PROP_NAME = "AuthPassword"; //$NON-NLS-1$
@SuppressWarnings( "javadoc" )
private static final String RECOVERY_PASSWORD_PROP_NAME = "recovery-password"; //$NON-NLS-1$
@SuppressWarnings( "javadoc" )
private static final String LDAP_PASSWORD_PROP_NAME = "LdapAdminUserPassword"; //$NON-NLS-1$

private static final long serialVersionUID = 1L;
private String name;
private String displayName;
Expand Down Expand Up @@ -147,6 +156,23 @@ public void setMasked(boolean isMasked) {
this.isMasked = isMasked;
}

/**
* Determine if property name indicates that it is a password
* @return 'true' if password name, 'false' if not.
*/
public boolean isPassword( ) {
boolean isPassword = false;
String name = getName();
if(name!=null &&
name.equalsIgnoreCase(PASSWORD_PROP_NAME) ||
name.equalsIgnoreCase(AUTH_PASSWORD_PROP_NAME) ||
name.equalsIgnoreCase(RECOVERY_PASSWORD_PROP_NAME) ||
name.equalsIgnoreCase(LDAP_PASSWORD_PROP_NAME) ) {
isPassword = true;
}
return isPassword;
}

/**
* Set the Property original value
* @param value the Property original value
Expand Down

0 comments on commit d9f2ae0

Please sign in to comment.