【发布时间】:2011-05-31 01:38:33
【问题描述】:
我正在使用 jsf 2 + jaas + ssl + tomcat 6.0.26
我的网站中有 2 条路径:
/faces/protected/* 使用 SSL
/faces/unprotected/* 不使用 SSL。
我已经把它放在了我的 web.xml 中:
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/faces/login.jsp</form-login-page>
<form-error-page>/faces/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Resource</web-resource-name>
<description/>
<url-pattern>/faces/unprotected/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>C</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Resource</web-resource-name>
<description />
<url-pattern>/faces/protected/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>HEAD</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>C</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<description> Role Client </description>
<role-name>C</role-name>
</security-role>
这是我的 server.xml:
<Connector port="8080" protocol="HTTP/1.1"
maxThreads="400"
maxKeepAliveRequests="1"
acceptCount="100"
connectionTimeout="3000"
redirectPort="8443"
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/javascript,text/css,text/html, text/xml,text/plain,application/x-javascript,application/javascript,application/xhtml+xml" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" SSLEnabled="true"
maxThreads="400" scheme="https" secure="true"
clientAuth="optional" sslProtocol="TLS"
SSLCertificateFile="path/to/crt"
SSLCertificateKeyFile="path/to/pem"/>
当我进入受保护的路径时,它会切换到 HTTPS(端口 8443),但是当我进入路径 /faces/unprotected/somthing... 时,它仍然使用 HTTPS。
我想要的是当我进入未受保护的路径时,它会恢复为非 SSL 通信(否则,当我在浏览器中设置确切地址时,我必须再次重新登录)。
我的配置有什么问题?
有没有办法让我做这样的事情?
是否可以在不要求第二次认证的情况下调用页面?
【问题讨论】:
-
只需重新安装它会是一个更简单的解决方案