胸腺SEC:授权和SEC:身份验证属性,不对生产生效,而是在IDE上工作良好



美好的一天,就我而言,一切都很好,在Localhost IDE上工作得很好,但是在Linux Thymeleaf SEC下的现场:授权和SEC:认证属性,没有生效。

   <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
            <version>3.0.11.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
            <version>3.0.4.RELEASE</version>
        </dependency>
        <!-- marked the embedded servlet container as provided -->

这是html

<li sec:authorize="isAnonymous()"><a class="inner-link" href="/login" title="Login">Login</a></li>
                            <li sec:authorize="isAuthenticated()"><a  class="inner-link" th:href="@{/profile}" title="Profile">Profile</a></li>

没有错误或警告启动。请建议

挣扎4天后,我一直在buote本地机器和Linux服务器上使用此配置:pom.xml

        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
        </dependency>
        <!-- marked the embedded servlet container as provided -->

它不适用于父版本3或toper,也不适用于V 1.5及向下。在SecurityConfig中,我添加了一个bean

 @Bean
    public SpringSecurityDialect securityDialect() {
        return new SpringSecurityDialect();
    }

谢谢

最新更新