public class PropertiesLineWriterPredicate extends Object implements Predicate<String>
add-user.sh
,
each users and group security provider implementation delegates the handling for the properties file to
the Wildfly's libraries, which are the ones that the add-user.sh
script relies on as well.
On the other hand, in order to follow the security management capabilities and restrictions, it behaves different rather than the default implementation in a few aspects, so this Predicate provides a shared way to override the default implementations and test if lines should be finally skipped or written into the output stream.
See parent property file handler implementations here:
UserPropertiesFileLoader
,
See security management implementations:
,
WildflyUserPropertiesManager
,
This predicate considers the following behaviors than differ from the default implementation ones:
- Allows using empty values for the entries. For the users file, it implies empty passwords are supported.
- User and group deletion is allowed by the security management providers.
- The add-user.sh
supports enable/disabling users, but the security management does not.
Modifier and Type | Field and Description |
---|---|
static Pattern |
EMPTY_PROPERTY_PATTERN |
static Pattern |
PROPERTY_PATTERN |
Constructor and Description |
---|
PropertiesLineWriterPredicate(Function<String,String> keyRawValueProvider,
boolean allowEmptyEntryValue) |
Modifier and Type | Method and Description |
---|---|
PropertiesLineWriterPredicate |
begin(Properties p) |
PropertiesLineWriterPredicate |
end() |
boolean |
test(String line)
This method is being extended for 2 reasons:
1.- This implementation support deleting a valid key-value pair.
2.- This implementation allows use of empty values for keys.
|
public static final Pattern PROPERTY_PATTERN
public static final Pattern EMPTY_PROPERTY_PATTERN
public PropertiesLineWriterPredicate begin(Properties p)
public PropertiesLineWriterPredicate end()
public boolean test(String line)
Support for deleting valid key-value pairs. The parent's behavior is to not support deleting users/groups, just disabling is allowed. Sp this implementation considers removed entries from the in-memory properties instance.
Support for empty key's value.
Notice only makes sense to use this feature for the users property file.
The default implementation considers a key-value pair valid in case the value is not empty.
For example user1=
is not considered valid key-value pairs for users, which
implies that the super-type implementation will write the line in the resulting output stream.
In order to allow empty passwords as well, this checks if the content is really
a valid key-pair too but considering empty values.
Copyright © 2012–2020 JBoss by Red Hat. All rights reserved.