Skip to content

Commit ba2991f

Browse files
author
jrivard@gmail.com
committed
-config login fixes
-replace jdom xml factory with w3c -jsp precompiliation
1 parent e354e5d commit ba2991f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1353
-945
lines changed

build/checkstyle-import.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<allow pkg="com.github.tomakehurst.wiremock"/>
6565
<allow pkg="org.reflections"/>
6666
<allow pkg="org.bouncycastle.jce.provider"/>
67+
<allow pkg="org.openjdk.jmh"/>
6768

6869
<!-- gson -->
6970
<allow pkg="com.google.gson"/>

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<plugin>
8080
<groupId>com.github.eirslett</groupId>
8181
<artifactId>frontend-maven-plugin</artifactId>
82-
<version>1.7.5</version>
82+
<version>1.7.6</version>
8383
<configuration>
8484
<nodeVersion>v8.9.4</nodeVersion>
8585
<npmVersion>5.6.0</npmVersion>

docker/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<plugin>
3535
<groupId>com.google.cloud.tools</groupId>
3636
<artifactId>jib-maven-plugin</artifactId>
37-
<version>1.1.0</version>
37+
<version>1.1.2</version>
3838
<executions>
3939
<execution>
4040
<id>make-docker-image</id>
@@ -44,8 +44,9 @@
4444
</goals>
4545
<configuration>
4646
<skip>${skipDocker}</skip>
47+
<jib.console>plain</jib.console>
4748
<from>
48-
<image>adoptopenjdk/openjdk11:slim</image>
49+
<image>adoptopenjdk/openjdk11:jre</image>
4950
</from>
5051
<to>
5152
<image>${dockerImageTag}</image>

pom.xml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,50 @@
294294
<version>4.0.0-beta1</version>
295295
<scope>provided</scope>
296296
</dependency>
297-
</dependencies>
298297

298+
<!-- Test dependencies -->
299+
<dependency>
300+
<groupId>junit</groupId>
301+
<artifactId>junit</artifactId>
302+
<version>4.12</version>
303+
<scope>test</scope>
304+
</dependency>
305+
<dependency>
306+
<groupId>org.mockito</groupId>
307+
<artifactId>mockito-core</artifactId>
308+
<version>2.27.0</version>
309+
<scope>test</scope>
310+
</dependency>
311+
<dependency>
312+
<groupId>org.assertj</groupId>
313+
<artifactId>assertj-core</artifactId>
314+
<version>3.12.2</version>
315+
<scope>test</scope>
316+
</dependency>
317+
<dependency>
318+
<groupId>com.github.tomakehurst</groupId>
319+
<artifactId>wiremock</artifactId>
320+
<version>2.23.2</version>
321+
<scope>test</scope>
322+
</dependency>
323+
<dependency>
324+
<groupId>org.reflections</groupId>
325+
<artifactId>reflections</artifactId>
326+
<version>0.9.11</version>
327+
<scope>test</scope>
328+
</dependency>
329+
<dependency>
330+
<groupId>org.openjdk.jmh</groupId>
331+
<artifactId>jmh-core</artifactId>
332+
<version>1.21</version>
333+
<scope>test</scope>
334+
</dependency>
335+
<dependency>
336+
<groupId>org.openjdk.jmh</groupId>
337+
<artifactId>jmh-generator-annprocess</artifactId>
338+
<version>1.21</version>
339+
<scope>test</scope>
340+
</dependency>
341+
342+
</dependencies>
299343
</project>

rest-test-service/pom.xml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,6 @@
5959
<dependencies>
6060
<!-- dev tool -->
6161

62-
<!-- Test dependencies -->
63-
<dependency>
64-
<groupId>junit</groupId>
65-
<artifactId>junit</artifactId>
66-
<version>4.12</version>
67-
<scope>test</scope>
68-
</dependency>
69-
<dependency>
70-
<groupId>org.assertj</groupId>
71-
<artifactId>assertj-core</artifactId>
72-
<version>3.11.1</version>
73-
<scope>test</scope>
74-
</dependency>
75-
<dependency>
76-
<groupId>com.github.tomakehurst</groupId>
77-
<artifactId>wiremock</artifactId>
78-
<version>2.20.0</version>
79-
<scope>test</scope>
80-
</dependency>
81-
<dependency>
82-
<groupId>org.reflections</groupId>
83-
<artifactId>reflections</artifactId>
84-
<version>0.9.11</version>
85-
<scope>test</scope>
86-
</dependency>
87-
8862
<!-- container dependencies -->
8963
<dependency>
9064
<groupId>javax.servlet</groupId>

server/pom.xml

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -151,38 +151,6 @@
151151

152152
<dependencies>
153153

154-
<!-- Test dependencies -->
155-
<dependency>
156-
<groupId>junit</groupId>
157-
<artifactId>junit</artifactId>
158-
<version>4.12</version>
159-
<scope>test</scope>
160-
</dependency>
161-
<dependency>
162-
<groupId>org.mockito</groupId>
163-
<artifactId>mockito-core</artifactId>
164-
<version>2.23.4</version>
165-
<scope>test</scope>
166-
</dependency>
167-
<dependency>
168-
<groupId>org.assertj</groupId>
169-
<artifactId>assertj-core</artifactId>
170-
<version>3.11.1</version>
171-
<scope>test</scope>
172-
</dependency>
173-
<dependency>
174-
<groupId>com.github.tomakehurst</groupId>
175-
<artifactId>wiremock</artifactId>
176-
<version>2.20.0</version>
177-
<scope>test</scope>
178-
</dependency>
179-
<dependency>
180-
<groupId>org.reflections</groupId>
181-
<artifactId>reflections</artifactId>
182-
<version>0.9.11</version>
183-
<scope>test</scope>
184-
</dependency>
185-
186154
<!-- container dependencies -->
187155
<dependency>
188156
<groupId>javax.servlet</groupId>
@@ -299,7 +267,7 @@
299267
<dependency>
300268
<groupId>jaxen</groupId>
301269
<artifactId>jaxen</artifactId>
302-
<version>1.1.6</version>
270+
<version>1.2.0</version>
303271
</dependency>
304272
<dependency>
305273
<groupId>org.jdom</groupId>

server/src/main/java/password/pwm/PwmApplication.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,6 @@ private void initialize( )
300300

301301
pwmScheduler.immediateExecuteInNewThread( this::postInitTasks );
302302
}
303-
304-
305303
}
306304

307305
private void postInitTasks( )

server/src/main/java/password/pwm/PwmConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public abstract class PwmConstants
168168
public static final String PARAM_USERKEY = "userKey";
169169

170170

171-
public static final String COOKIE_PERSISTENT_CONFIG_LOGIN = "persistentConfigLogin";
171+
public static final String COOKIE_PERSISTENT_CONFIG_LOGIN = "CONFIG-AUTH";
172172

173173
public static final String VALUE_REPLACEMENT_USERNAME = "%USERNAME%";
174174

server/src/main/java/password/pwm/config/PwmSettingXml.java

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import javax.xml.validation.SchemaFactory;
3636
import javax.xml.validation.Validator;
3737
import java.io.InputStream;
38+
import java.lang.ref.WeakReference;
3839
import java.time.Instant;
3940
import java.util.Collections;
4041
import java.util.LinkedHashSet;
@@ -56,12 +57,12 @@ public class PwmSettingXml
5657

5758
private static final PwmLogger LOGGER = PwmLogger.forClass( PwmSettingXml.class );
5859

59-
private static XmlDocument xmlDocCache;
60+
private static WeakReference<XmlDocument> xmlDocCache = new WeakReference<>( null );
6061
private static final AtomicInteger LOAD_COUNTER = new AtomicInteger( 0 );
6162

6263
private static XmlDocument readXml( )
6364
{
64-
final XmlDocument docRefCopy = xmlDocCache;
65+
final XmlDocument docRefCopy = xmlDocCache.get();
6566
if ( docRefCopy == null )
6667
{
6768
final InputStream inputStream = PwmSetting.class.getClassLoader().getResourceAsStream( SETTING_XML_FILENAME );
@@ -70,30 +71,9 @@ private static XmlDocument readXml( )
7071
final Instant startTime = Instant.now();
7172
final XmlDocument newDoc = XmlFactory.getFactory().parseXml( inputStream );
7273
final TimeDuration parseDuration = TimeDuration.fromCurrent( startTime );
73-
LOGGER.trace( () -> "parsed PwmSettingXml in " + parseDuration.toString() + ", loads=" + LOAD_COUNTER.getAndIncrement() );
74-
75-
xmlDocCache = newDoc;
76-
77-
// clear cached dom after 30 seconds.
78-
final Thread t = new Thread( "PwmSettingXml static cache thread" )
79-
{
80-
@Override
81-
public void run( )
82-
{
83-
try
84-
{
85-
Thread.sleep( 30_000 );
86-
}
87-
catch ( InterruptedException e )
88-
{
89-
//ignored
90-
}
91-
LOGGER.trace( () -> "cached PwmSettingXml discarded" );
92-
xmlDocCache = null;
93-
}
94-
};
95-
t.setDaemon( true );
96-
t.start();
74+
LOGGER.trace( () -> "parsed PwmSettingXml in " + parseDuration.asCompactString() + ", loads=" + LOAD_COUNTER.getAndIncrement() );
75+
76+
xmlDocCache = new WeakReference<>( newDoc );
9777

9878
return newDoc;
9979
}

0 commit comments

Comments
 (0)