Skip to content

Commit 9c896a6

Browse files
committed
Update Togglz to 2.6.1.Final.
Changelog: - https://www.togglz.org/whats-new.html - https://www.togglz.org/updating-notes.html No functional changes.
2 parents aa1615e + cdbf68e commit 9c896a6

File tree

4 files changed

+9
-54
lines changed

4 files changed

+9
-54
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@
593593
<!-- Redefine default value from spring-boot-dependencies (https://github.com/spring-projects/spring-boot/blob/v1.5.15.RELEASE/spring-boot-dependencies/pom.xml) -->
594594
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
595595

596-
<togglz.version>2.5.0.Final</togglz.version>
596+
<togglz.version>2.6.1.Final</togglz.version>
597597
<war.plugin.version>3.2.0</war.plugin.version>
598598
<wiremock.plugin.version>2.13.1</wiremock.plugin.version>
599599
</properties>

src/main/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriter.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
3737

3838
private static final String ADD_IMAGE_PAGE_PATTERN = "/series/(add|\\d+|\\d+/(ask|image))";
3939

40-
private static final String TOGGLZ_PAGES_PATTERN = Url.TOGGLZ_CONSOLE_PAGE + '/';
41-
4240
private static final String H2_CONSOLE_PATTERN = Url.H2_CONSOLE_PAGE + '/';
4341

4442
// default policy prevents loading resources from any source
@@ -88,10 +86,6 @@ class ContentSecurityPolicyHeaderWriter implements HeaderWriter {
8886
private static final String STYLE_COLLECTION_INFO =
8987
" https://www.gstatic.com 'sha256-/kXZODfqoc2myS1eI6wr0HH8lUt+vRhW8H/oL+YJcMg='";
9088

91-
// - 'sha256-biL...' is required for 'display: none;' inline CSS for Togglz
92-
private static final String STYLE_TOGGLZ =
93-
" 'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='";
94-
9589
// - 'sha256-biL...' is required for 'display: none;' inline CSS
9690
// - 'sha256-ZdH...' is required for 'display: none' inline CSS
9791
// - 'sha256-aqN...' is required for 'display:none' inline CSS
@@ -196,9 +190,6 @@ protected String constructDirectives(String uri) {
196190
sb.append(STYLE_SERIES_ADD_PAGE);
197191
}
198192

199-
} else if (uri.startsWith(TOGGLZ_PAGES_PATTERN)) {
200-
sb.append(STYLE_TOGGLZ);
201-
202193
} else if (onH2ConsolePage) {
203194
sb.append(STYLE_H2_CONSOLE);
204195
}

src/main/java/ru/mystamps/web/support/togglz/TogglzConfig.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import com.github.heneke.thymeleaf.togglz.TogglzDialect;
3030
import org.togglz.console.TogglzConsoleServlet;
31+
import org.togglz.core.logging.LoggingStateRepository;
3132
import org.togglz.core.manager.FeatureManager;
3233
import org.togglz.core.manager.FeatureManagerBuilder;
3334
import org.togglz.core.repository.cache.CachingStateRepository;
@@ -47,7 +48,13 @@ public class TogglzConfig {
4748
@Bean
4849
public FeatureManager getFeatureManager() {
4950
return new FeatureManagerBuilder()
50-
.stateRepository(new CachingStateRepository(new JDBCStateRepository(dataSource)))
51+
.stateRepository(
52+
new LoggingStateRepository(
53+
new CachingStateRepository(
54+
new JDBCStateRepository(dataSource)
55+
)
56+
)
57+
)
5158
.featureEnum(Features.class)
5259
.userProvider(new SpringSecurityUserProvider(StringAuthority.MANAGE_TOGGLZ))
5360
.build();

src/test/java/ru/mystamps/web/support/spring/security/ContentSecurityPolicyHeaderWriterTest.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -330,49 +330,6 @@ public void onSeriesAddPageWithResourcesFromCdn() {
330330
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_ADD_SERIES_PAGE)));
331331
}
332332

333-
@Test
334-
public void onTogglzConsoleWithLocalResources() {
335-
ContentSecurityPolicyHeaderWriter writer =
336-
new ContentSecurityPolicyHeaderWriter(true, bool());
337-
String[] directives = writer.constructDirectives("/togglz/").split(";");
338-
339-
// test only a directive that is differ from the index page
340-
assertThat(
341-
directives,
342-
hasItemInArray(
343-
"style-src "
344-
+ "https://cdn.rawgit.com "
345-
+ "'self' "
346-
+ "'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='"
347-
)
348-
);
349-
350-
// hope that all other directives are the same as on the index page
351-
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES)));
352-
}
353-
354-
@Test
355-
public void onTogglzConsoleWithResourcesFromCdn() {
356-
ContentSecurityPolicyHeaderWriter writer =
357-
new ContentSecurityPolicyHeaderWriter(false, bool());
358-
String[] directives = writer.constructDirectives("/togglz/").split(";");
359-
360-
// test only a directive that is differ from the index page
361-
assertThat(
362-
directives,
363-
hasItemInArray(
364-
"style-src "
365-
+ "https://cdn.rawgit.com "
366-
+ "https://stamps.filezz.ru "
367-
+ "https://maxcdn.bootstrapcdn.com "
368-
+ "'sha256-biLFinpqYMtWHmXfkA1BPeCY0/fNt46SAZ+BBk5YUog='"
369-
)
370-
);
371-
372-
// hope that all other directives are the same as on the index page
373-
assertThat(directives, is(arrayWithSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES)));
374-
}
375-
376333
@Test
377334
public void onH2ConsoleWithLocalResources() {
378335
ContentSecurityPolicyHeaderWriter writer =

0 commit comments

Comments
 (0)