我正在做一个测试项目,为我们未来的项目尝试spring引导。SPRING BOOT配置Jasig CAS
我们正在使用jasig CAS,我正在尝试使用spring引导和嵌入式tomcat服务器进行配置。
所以我加在pom.xml弹簧引导启动安全
之后,我尝试配置WebSecurityConfig - >弹簧提供的类与中科院配置,比如我需要配置一个入口点:
@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不被应用reconized。
这个班似乎没有用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?
这里是我的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"/>
是否有可能配置keystorefile/truststorefile与嵌入式Tomcat的?
感谢
N.B. application.properties中配置SSL的声明样式是新的。我还计划在1.2.0发布之前稍微更改属性名称。旧版本中有一个示例,向您展示如何以编程方式执行此操作。 – 2014-10-02 18:41:29
只要你在最近的1.1.x版本中,它就会被回溯,所以你会好的 – 2014-10-02 18:45:21
感谢您的快速回复Andy! – partyboy 2014-10-03 06:22:15