Skip to content

sec:authorize="isAnonymous()" no longer works with thymeleaf-extras-springsecurity5 #70

@maykon-oliveira

Description

@maykon-oliveira

I have a Spring Boot 2.3.1 application that uses thymeleaf-extras-springsecurity5. The sec:authorize="isAnonymous()" it's not workning when user is no logged in. The sec:authorize="isAuthenticated()" works fine, after I login, the button logout appears.

pom.xml

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>2.3.1.RELEASE</version>
        </dependency>

statement

<a sec:authorize="isAnonymous()" href="#" th:href="@{/login}"
     class="whitespace-no-wrap text-base leading-6 font-medium text-gray-500 hover:text-gray-900 focus:outline-none focus:text-gray-900">
       isAnonymous
</a>

Github repo: https://github.com/maykon-oliveira/exame-chunin-devdojo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions