Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6e531090
Commit
6e531090
authored
Oct 13, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch from thymeleaf-extras-springsecurity4 to extras-springsecurity5
Closes gh-14806
parent
1ac48ee8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
6 deletions
+51
-6
pom.xml
spring-boot-project/spring-boot-autoconfigure/pom.xml
+1
-1
ThymeleafAutoConfiguration.java
...t/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
+1
-1
ThymeleafReactiveAutoConfigurationTests.java
...re/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java
+23
-0
ThymeleafServletAutoConfigurationTests.java
...ure/thymeleaf/ThymeleafServletAutoConfigurationTests.java
+21
-0
security-dialect.html
...figure/src/test/resources/templates/security-dialect.html
+1
-0
pom.xml
spring-boot-project/spring-boot-dependencies/pom.xml
+3
-3
pom.xml
spring-boot-project/spring-boot-docs/pom.xml
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/pom.xml
View file @
6e531090
...
...
@@ -655,7 +655,7 @@
</dependency>
<dependency>
<groupId>
org.thymeleaf.extras
</groupId>
<artifactId>
thymeleaf-extras-springsecurity
4
</artifactId>
<artifactId>
thymeleaf-extras-springsecurity
5
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java
View file @
6e531090
...
...
@@ -28,7 +28,7 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.thymeleaf.dialect.IDialect
;
import
org.thymeleaf.extras.java8time.dialect.Java8TimeDialect
;
import
org.thymeleaf.extras.springsecurity
4
.dialect.SpringSecurityDialect
;
import
org.thymeleaf.extras.springsecurity
5
.dialect.SpringSecurityDialect
;
import
org.thymeleaf.spring5.ISpringWebFluxTemplateEngine
;
import
org.thymeleaf.spring5.SpringTemplateEngine
;
import
org.thymeleaf.spring5.SpringWebFluxTemplateEngine
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafReactiveAutoConfigurationTests.java
View file @
6e531090
...
...
@@ -27,8 +27,11 @@ import org.junit.Rule;
import
org.junit.Test
;
import
org.thymeleaf.TemplateEngine
;
import
org.thymeleaf.context.Context
;
import
org.thymeleaf.context.IContext
;
import
org.thymeleaf.extras.springsecurity5.util.SpringSecurityContextUtils
;
import
org.thymeleaf.spring5.ISpringWebFluxTemplateEngine
;
import
org.thymeleaf.spring5.SpringWebFluxTemplateEngine
;
import
org.thymeleaf.spring5.context.webflux.SpringWebFluxContext
;
import
org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
;
import
org.thymeleaf.spring5.view.reactive.ThymeleafReactiveViewResolver
;
import
org.thymeleaf.templateresolver.ITemplateResolver
;
...
...
@@ -42,6 +45,10 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.http.MediaType
;
import
org.springframework.mock.http.server.reactive.MockServerHttpRequest
;
import
org.springframework.mock.web.server.MockServerWebExchange
;
import
org.springframework.security.authentication.TestingAuthenticationToken
;
import
org.springframework.security.core.context.SecurityContextImpl
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -190,6 +197,22 @@ public class ThymeleafReactiveAutoConfigurationTests {
assertThat
(
result
).
isEqualTo
(
"<html><body>2015-11-24</body></html>"
);
}
@Test
public
void
useSecurityDialect
()
{
load
(
BaseConfiguration
.
class
);
ISpringWebFluxTemplateEngine
engine
=
this
.
context
.
getBean
(
ISpringWebFluxTemplateEngine
.
class
);
MockServerWebExchange
exchange
=
MockServerWebExchange
.
from
(
MockServerHttpRequest
.
get
(
"/test"
).
build
());
exchange
.
getAttributes
().
put
(
SpringSecurityContextUtils
.
SECURITY_CONTEXT_MODEL_ATTRIBUTE_NAME
,
new
SecurityContextImpl
(
new
TestingAuthenticationToken
(
"alice"
,
"admin"
)));
IContext
attrs
=
new
SpringWebFluxContext
(
exchange
);
String
result
=
engine
.
process
(
"security-dialect"
,
attrs
);
assertThat
(
result
).
isEqualTo
(
"<html><body><div>alice</div></body></html>\n"
);
}
@Test
public
void
renderTemplate
()
{
load
(
BaseConfiguration
.
class
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafServletAutoConfigurationTests.java
View file @
6e531090
...
...
@@ -30,6 +30,7 @@ import org.junit.Rule;
import
org.junit.Test
;
import
org.thymeleaf.TemplateEngine
;
import
org.thymeleaf.context.Context
;
import
org.thymeleaf.context.WebContext
;
import
org.thymeleaf.spring5.SpringTemplateEngine
;
import
org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver
;
import
org.thymeleaf.spring5.view.ThymeleafView
;
...
...
@@ -48,6 +49,9 @@ import org.springframework.context.annotation.Import;
import
org.springframework.mock.web.MockHttpServletRequest
;
import
org.springframework.mock.web.MockHttpServletResponse
;
import
org.springframework.mock.web.MockServletContext
;
import
org.springframework.security.authentication.TestingAuthenticationToken
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextImpl
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
org.springframework.web.servlet.ViewResolver
;
...
...
@@ -183,6 +187,23 @@ public class ThymeleafServletAutoConfigurationTests {
assertThat
(
result
).
isEqualTo
(
"<html><body>2015-11-24</body></html>"
);
}
@Test
public
void
useSecurityDialect
()
{
load
(
BaseConfiguration
.
class
);
TemplateEngine
engine
=
this
.
context
.
getBean
(
TemplateEngine
.
class
);
WebContext
attrs
=
new
WebContext
(
new
MockHttpServletRequest
(),
new
MockHttpServletResponse
(),
new
MockServletContext
());
try
{
SecurityContextHolder
.
setContext
(
new
SecurityContextImpl
(
new
TestingAuthenticationToken
(
"alice"
,
"admin"
)));
String
result
=
engine
.
process
(
"security-dialect"
,
attrs
);
assertThat
(
result
).
isEqualTo
(
"<html><body><div>alice</div></body></html>\n"
);
}
finally
{
SecurityContextHolder
.
clearContext
();
}
}
@Test
public
void
renderTemplate
()
{
load
(
BaseConfiguration
.
class
);
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/resources/templates/security-dialect.html
0 → 100644
View file @
6e531090
<html><body><div
sec:authentication=
"name"
></div></body></html>
spring-boot-project/spring-boot-dependencies/pom.xml
View file @
6e531090
...
...
@@ -182,7 +182,7 @@
<sun-mail.version>
${javax-mail.version}
</sun-mail.version>
<saaj-impl.version>
1.5.0
</saaj-impl.version>
<thymeleaf.version>
3.0.10.RELEASE
</thymeleaf.version>
<thymeleaf-extras-springsecurity
4.version>
3.0.2.RELEASE
</thymeleaf-extras-springsecurity4
.version>
<thymeleaf-extras-springsecurity
5.version>
3.0.3.RELEASE
</thymeleaf-extras-springsecurity5
.version>
<thymeleaf-layout-dialect.version>
2.3.0
</thymeleaf-layout-dialect.version>
<thymeleaf-extras-data-attribute.version>
2.0.1
</thymeleaf-extras-data-attribute.version>
<thymeleaf-extras-java8time.version>
3.0.1.RELEASE
</thymeleaf-extras-java8time.version>
...
...
@@ -2937,8 +2937,8 @@
</dependency>
<dependency>
<groupId>
org.thymeleaf.extras
</groupId>
<artifactId>
thymeleaf-extras-springsecurity
4
</artifactId>
<version>
${thymeleaf-extras-springsecurity
4
.version}
</version>
<artifactId>
thymeleaf-extras-springsecurity
5
</artifactId>
<version>
${thymeleaf-extras-springsecurity
5
.version}
</version>
</dependency>
<dependency>
<groupId>
org.webjars
</groupId>
...
...
spring-boot-project/spring-boot-docs/pom.xml
View file @
6e531090
...
...
@@ -904,7 +904,7 @@
</dependency>
<dependency>
<groupId>
org.thymeleaf.extras
</groupId>
<artifactId>
thymeleaf-extras-springsecurity
4
</artifactId>
<artifactId>
thymeleaf-extras-springsecurity
5
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment