我正在做一个测试项目,为我们未来的项目尝试spring boot。
我们正在使用jasig CAS,我正在尝试使用spring boot和嵌入式tomcat服务器进行配置。
所以我在pom.xml中添加了spring-boot-starter-security
之后,我尝试配置WebSecurityConfig -> spring提供的类来配置cas,例如,我需要配置一个入口点:
@Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
CasAuthenticationEntryPoint casAuthenticationEntryPoint = new CasAuthenticationEntryPoint();
casAuthenticationEntryPoint.setLoginUrl("https://localhost:9443/cas/login");
casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
return casAuthenticationEntryPoint;
}这是第一个问题:应用程序没有识别org.springframework.security.cas.web.CasAuthenticationEntryPoint类。
这个类似乎不是用spring-boot-starter-security导入的。
最佳实践是什么?我是否需要像以前一样在我的pom中手动添加依赖项?
示例:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
<version>${spring-security.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>如果是这样,我需要使用哪个版本才能与启动版本包匹配并避免冲突?
第二点是如何配置嵌入式tomcat来启用带有证书的ssl?
下面是我对归档存储的经典server.xml配置:
Connector emptySessionPath="true" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" URIEncoding="UTF-8"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\***\***\***\.keystore" keystorePass="***"
truststoreFile="C:\Program Files\Java\jdk1.7.0_67\jre\lib\security\cacerts"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript"/>可以用嵌入的tomcat配置keystorefile/truststorefile吗?
谢谢
发布于 2014-10-03 00:21:41
假设您使用spring-boot-starter-parent作为项目的父项目(或将其导入到您自己的Boot部分中),则不需要为spring-security-cas依赖项声明版本,因为Boot已经为它提供了依赖项管理。你可以这样做:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
</dependency>SSL配置为covered in the reference docs。你只需要指定几个属性来配置密钥库,等等。例如:
server.port = 8443
server.ssl.key-store = keystore.jks
server.ssl.key-store-password = secret
server.ssl.key-password = another-secret发布于 2014-10-03 17:45:32
我有点困惑,我正在尝试完成SSL配置,但我仍然面临着一个问题。
下面是我使用spring boot进行的tomcat配置:
server.port = 8080
server.ssl.key-store = C:\\dev\\web\\tomcat\\.keystore
server.ssl.key-store-password = changeit
server.ssl.key-password = changeit
server.ssl.trustStore = C:\\Program Files\\Java\\jdk1.7.0_67\\jre\\lib\\security\\cacerts
server.ssl.trustStorePassword = changeit我启动应用程序,没有问题,我在我的CAS服务器上被重定向,我输入登录/通过按enter,然后我得到错误:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target这就像我的证书不工作,但当我以一种经典的方式使用tomcat时(没有嵌入,我的配置在我的第一篇文章中),它工作得很好。
我错过了什么吗?
https://stackoverflow.com/questions/26161118
复制相似问题