gpt4 book ai didi

java - Spring saml 演示构建问题

转载 作者:行者123 更新时间:2023-12-05 07:41:47 26 4
gpt4 key购买 nike

我们公司正计划迁移到使用 SAML 进行身份验证,因此我正在使用示例演示来完成本教程,以了解如何使用 spring 框架和 Okta 实现 saml。我正在按照教程(此处:https://www.youtube.com/watch?v=JBtyGfrz-jA)进行操作,但是当我到达实现 SecurityConfiguration 的部分(视频的 ~5:09)时,它会抛出代码错误:

import static org.springframework.security.extensions.saml2.config.SAMLConfigurer.saml;

当我尝试构建它抛出的项目时:

com/example/SecurityConfiguration.java:[3,67] package org.springframework.security.extensions.saml2.config does not exist
com/example/SecurityConfiguration.java:[3,1] static import only from classes and interfaces
com/example/SecurityConfiguration.java:[39,20] cannot find symbol

我认为问题在于 maven 导入了错误的 jar 文件,但我尝试了许多不同版本的 org.springframework.security.extensions,但没有一个允许 SecurityConfiguration.java 找到 saml() 方法。

这是 pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.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-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml-dsl</artifactId>
<version>1.0.0.M3</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>

最佳答案

当将 spring-security-saml-dsl(注意:不是 spring-security-saml2-core)从 1.0.2.RELEASE 移动到 1.0.3.RELEASE 时,Spring 搞砸了他们的项目文件。

将 spring-security-saml-dsl 的版本更改为 1.0.2.RELEASE 后应该可以解决此问题。

关于java - Spring saml 演示构建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45149936/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com