sec:authorize not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

sec:authorize not working

Jose Luis Salvador
Hi to everyone!

Got problems with sec:authorize and spring Boot. Not able to make it work.

In my Thymeleaf template I'm using:

sec:authorize="hasAnyAuthority('ROOT', 'USER')"

and it's pointing to the right xmlns: xmlns:sec="http://www.thymeleaf.org/extras/spring-security"

But it does nothing. Even if I use sec:qwer="blablabla" it doesnt show no errors.

My pom dependencies are:

<dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-security</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-thymeleaf</artifactId>
                </dependency>
                <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
            <version>3.0.1.RELEASE</version>
        </dependency>
        <dependency>
    <groupId>nz.net.ultraq.thymeleaf</groupId>
    <artifactId>thymeleaf-layout-dialect</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
                </dependency>

with:

<properties>
                <java.version>1.8</java.version>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
               
               
        <thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
        <thymeleaf-layout-dialect.version>2.4.1</thymeleaf-layout-dialect.version>
        <thymeleaf-extras-springsecurity4.version>3.0.4.RELEASE</thymeleaf-extras-springsecurity4.version>
        </properties>

┬┐What am I doing wrong? Can somebody help me?