开发者

Add http or https based on certain condition

开发者 https://www.devze.com 2023-02-10 21:02 出处:网络
I\'m working on web application that is built on Spring Framework and also uses spring security. I want users of the application to opt whether they want to use the application in SSL or not. Which m

I'm working on web application that is built on Spring Framework and also uses spring security.

I want users of the application to opt whether they want to use the application in SSL or not. Which means whether the application runs in https:开发者_运维百科// or http:// is conditional based on the logged in user.

Any brilliant ideas how can I achieve this.

I'm Using Tomcat and SSL is already configured.


Take a look at the ChannelProcessingFilter and the classes that it uses (ChannelDecisionManagerImpl, SecureChannelProcessor, RetryWithHttpsEntryPoint).

By default it is set up to redirect based on URL. It is first in the filter chain.

You would want to add a filter towards the end of the chain (after authentication has been done) that does the redirect.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号