mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
14.03.2013 1bc62891e75a5e97abefaca3b60923977fe417b1
OPENDJ-960 (CR-1844) HTTP Connection Handler - Validate http-config.json file 

Enhanced JsonValue by adding a record/verify mode for key accesses.
Client code must call recordKeyAccesses() to verifyAllKeysAccessed().
When yhere is an an unaccessed key, a JsonException will be thrown and all unaccessed keys will be reported (unaccessed keys located under other unaccessed keys are not reported to reduce noise).


HTTPConnectionHandler.java:
In createAndRegisterServlet(), enabled the record mode before accessing the keys, then verify all the keys have been accessed after we are done with the JSON config.

JsonValue.java:
Added recordKeyAccesses() and verifyAllKeysAccessed().

JsonValueKeyAccessChecker.java, JsonValueKeyAccessCheckerTest.java: ADDED
1 files modified
5 ■■■■■ changed files
opends/src/server/org/opends/server/protocols/http/HTTPConnectionHandler.java 5 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -875,12 +875,13 @@
      final String... urlPatterns) throws Exception
  {
    // parse and use JSON config
    File jsonConfigFile = getFileForPath(this.currentConfig.getConfigFile());
    final JsonValue configuration =
        parseJsonConfiguration(getFileForPath(this.currentConfig
            .getConfigFile()));
        parseJsonConfiguration(jsonConfigFile).recordKeyAccesses();
    final HTTPAuthenticationConfig authenticationConfig =
        getAuthenticationConfig(configuration);
    final ConnectionFactory connFactory = getConnectionFactory(configuration);
    configuration.verifyAllKeysAccessed();
    Filter filter =
        new CollectClientConnectionsFilter(this, authenticationConfig);