Test security dialect auto-config without Spring Security
Closes gh-31097
This commit is contained in:
parent
4eb778df43
commit
5e78bef9f8
|
@ -27,6 +27,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
import org.thymeleaf.context.IContext;
|
||||
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
|
||||
import org.thymeleaf.extras.springsecurity5.util.SpringSecurityContextUtils;
|
||||
import org.thymeleaf.spring5.ISpringWebFluxTemplateEngine;
|
||||
import org.thymeleaf.spring5.SpringWebFluxTemplateEngine;
|
||||
|
@ -36,6 +37,7 @@ import org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver;
|
|||
import org.thymeleaf.templateresolver.ITemplateResolver;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
|
@ -217,6 +219,12 @@ class ThymeleafReactiveAutoConfigurationTests {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void securityDialectAutoConfigurationBacksOffWithoutSpringSecurity() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.security"))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(SpringSecurityDialect.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void renderTemplate() {
|
||||
this.contextRunner.run((context) -> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -31,6 +31,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
|||
import org.thymeleaf.TemplateEngine;
|
||||
import org.thymeleaf.context.Context;
|
||||
import org.thymeleaf.context.WebContext;
|
||||
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
|
||||
import org.thymeleaf.spring5.SpringTemplateEngine;
|
||||
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
|
||||
import org.thymeleaf.spring5.view.ThymeleafView;
|
||||
|
@ -231,6 +232,12 @@ class ThymeleafServletAutoConfigurationTests {
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void securityDialectAutoConfigurationBacksOffWithoutSpringSecurity() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.security"))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(SpringSecurityDialect.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void renderTemplate() {
|
||||
this.contextRunner.run((context) -> {
|
||||
|
|
Loading…
Reference in New Issue