Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maykon-oliveira opened this issue Jul 18, 2020 · 3 comments

Comments

@maykon-oliveira
Copy link

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

@ultraq
Copy link
Member

ultraq commented Jul 20, 2020

I don't know very much about WebFlux and Reactive stuff, but it looks like there might be a problem w/ the combination of Thymeleaf + Spring Security + WebFlux as this has also been reported in #68

@roshanbachhav
Copy link

sec:authorize="isAnonymous()" when not working then check following dependency

             <dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter</artifactId>
	</dependency>

@towfiq-bK
Copy link

try adding below code:
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants