I've got an OSGi component, declared with an annotation, that allows a login credential property to be configured through Felix's configuration UI. I've seen other components that obscure a property text field for passwords, but mine is still in the clear. I'd assume that there is just a flag that is included in the @Property annotation, but I can't find any mention of it in the documentation.
Does anyone know how to create a password field in the configuration UI?
There is a annotation property that can be used:
private static final String DEFAULT_USERNAME = StringUtils.EMPTY;
private String username = DEFAULT_USERNAME;
@Property(label="username", description="user name", value=DEFAULT_USERNAME )
public static final String USERNAME = "xxx.username";
private static final String DEFAULT_PASSWORD = StringUtils.EMPTY;
private String password = DEFAULT_PASSWORD;
@Property(label="password", description="user password", passwordValue=DEFAULT_PASSWORD )
public static final String PASSWORD = "xxx.password";
Notice that the USERNAME
constant is being annotated with the value
parameter, where as PASSWORD
is annotated with passwordValue
parameter. It is the use of passwordValue
that triggers the field to be obscured in the OSGi console.