Search code examples
spring-securitythymeleaf

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).

Solution

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

    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:th="http://www.thymeleaf.org"
        xmlns:sec="http://www.thymeleaf.org">