【发布时间】:2014-11-27 11:01:50
【问题描述】:
我正在制作一个测试项目,为我们未来的项目尝试 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 with certificate?
这是我用于 CAS 的经典 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 ?
谢谢
【问题讨论】:
标签: spring spring-security spring-boot cas