Home Ask Login Register

Developers Planet

Your answer is one click away!

fuzzy28 February 2016

Undefined attribute name (sec:authentication)

I'm using Thymleaf in my spring security simple POC. Below is my sample code in home.html file.

Hello <span sec:authentication="name">User</span>!i

How to get rid of the html warning

Undefined attribute name (sec:authentication).


romach February 2016

1) Add this dependency to pom.xml:


2) Add additional dialect to templateEngine bean:

<!-- Thymeleaf Template Engine (Spring4-specific version) -->
<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
    <property name="templateResolvers">
            <ref bean="templateResolver" />
    <property name="additionalDialects">
             <bean class="org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect" />

fuzzy28 February 2016

I Just duplicate the namespace for sec tag and html warning disappear

<html xmlns="http://www.w3.org/1999/xhtml"

Post Status

Asked in February 2016
Viewed 3,105 times
Voted 8
Answered 2 times


Leave an answer

Quote of the day: live life