brikar-server/src/main/java/com/truward/brikar/server/auth/SimpleAuthenticatorUtil.java
public static List<SimpleServiceUser> loadUsers(PropertySource<?> propertySource, String authPropertiesPrefix) {
    if (propertySource instanceof EnumerablePropertySource) {
      final EnumerablePropertySource<?> enumPropSource = (EnumerablePropertySource) propertySource;
      final String[] propertyNames = enumPropSource.getPropertyNames();

      final PropertyEntrySink sink = new PropertyEntrySink(authPropertiesPrefix);

      for (final String propertyName : propertyNames) {
        final Object value = propertySource.getProperty(propertyName);
        if (value instanceof String) {
          sink.putEntry(propertyName, value.toString());
        }
      }

      return sink.getUserList();
    }

    LoggerFactory.getLogger(SimpleAuthenticatorUtil.class)
        .warn("propertySource={} is not of type EnumerablePropertySource", propertySource);

    return Collections.emptyList();
  }
public static List<SimpleServiceUser> loadUsers(PropertySource<?> propertySource, String authPropertiesPrefix) {
    if (propertySource instanceof EnumerablePropertySource) {
      final EnumerablePropertySource<?> enumPropSource = (EnumerablePropertySource) propertySource;
      final String[] propertyNames = enumPropSource.getPropertyNames();

      final PropertyEntrySink sink = new PropertyEntrySink(authPropertiesPrefix);

      for (final String propertyName : propertyNames) {
        final Object value = propertySource.getProperty(propertyName);
        if (value instanceof String) {
          sink.putEntry(propertyName, value.toString());
        }
      }

      return sink.getUserList();
    }

    LoggerFactory.getLogger(SimpleAuthenticatorUtil.class)
        .warn("propertySource={} is not of type EnumerablePropertySource", propertySource);

    return Collections.emptyList();
  }
public static List < SimpleServiceUser > loadUsers ( PropertySource < ? > propertySource , String authPropertiesPrefix ) { if ( propertySource instanceof EnumerablePropertySource ) { final EnumerablePropertySource < ? > enumPropSource = ( EnumerablePropertySource ) propertySource ; final String [ ] propertyNames = enumPropSource . getPropertyNames ( ) ; final PropertyEntrySink sink = new PropertyEntrySink ( authPropertiesPrefix ) ; for ( final String propertyName : propertyNames ) { final Object value = propertySource . getProperty ( propertyName ) ; if ( value instanceof String ) { sink . putEntry ( propertyName , value . toString ( ) ) ; } } return sink . getUserList ( ) ; } LoggerFactory . getLogger ( SimpleAuthenticatorUtil . class ) . warn ( "propertySource={} is not of type EnumerablePropertySource" , propertySource ) ; return Collections . emptyList ( ) ; }
Loads user records from a given reader.
The text stream produced by reader should contain records in java properties format (see also {@link Properties}).
Each property related to authorization entries should be prefixed. This prefix should be passed as
a second parameter to this method, {@code authPropertiesPrefix}.

<p>
Example of property file:
<code>
myService.auth.1.username=alice
myService.auth.1.password=test
myService.auth.1.roles=USER,ADMIN

myService.auth.1.username=bob
myService.auth.1.password=password
</code>

Sample call that would read {@code alice} and {@code bob} user entries from a sample property file given above:
<code>
users = loadUsers(propertySource, "myService.auth");
</code>
</p>

<p>
Note: if {@code .roles} property entry is missing for a user, the default value will be used, which is a list
of single element which is {@code USER}.
See also {@link SimpleServiceUser}.
</p>

@param propertySource Property source, to read auth properties from
@param authPropertiesPrefix Prefix for properties in a given reader, that should be treated as user record entries
@return List of the parsed user entries
Loads user records from a given reader . The text stream produced by reader should contain records in java properties format ( see also { @link Properties } ) . Each property related to authorization entries should be prefixed . This prefix should be passed as a second parameter to this method { @code authPropertiesPrefix } .