par*_*boy 3 spring cas spring-security 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;
}
Run Code Online (Sandbox Code Playgroud)
这是第一个问题:应用程序未重新配置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>
Run Code Online (Sandbox Code Playgroud)
如果是这样,我需要使用哪个版本来配合启动版本包并避免冲突?
第二点是如何配置嵌入式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"/>
Run Code Online (Sandbox Code Playgroud)
是否可以使用嵌入式tomcat配置keystorefile/truststorefile?
谢谢
假设您正在使用spring-boot-starter-parent
项目的父项(或将其导入您自己的<dependencyManagement>
部分),您不需要为spring-security-cas
依赖项声明一个版本,因为Boot已经为它提供了依赖项管理.你可以这样做:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
参考文档中介绍了 SSL配置.您只需指定一些属性来配置密钥库等.例如:
server.port = 8443
server.ssl.key-store = keystore.jks
server.ssl.key-store-password = secret
server.ssl.key-password = another-secret
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6229 次 |
最近记录: |