0

I'm using Spring 3.2 + primefaces 3.5 + hibernate 4.1.9 The security context is:

<http auto-config='false' use-expressions="true"   >
    <intercept-url pattern="/**/login"  access="permitAll" requires-channel="https"/>
    <intercept-url pattern="/**/registration" access="permitAll" requires-channel="https" />
    <intercept-url pattern="/**/cart" access="permitAll" requires-channel="https"  />
    <intercept-url pattern="/**/cart/**" access="hasAnyRole('USER','ADMIN')" requires-channel="https" />
    <intercept-url pattern="/pages/adm/**" access="hasRole('ADMIN')" requires-channel="https" />
    <intercept-url pattern="/*/account**" access="hasAnyRole('USER','ADMIN')" requires-channel="https" />
    <intercept-url pattern="/**" requires-channel="any" />

    <form-login login-page="/loginRedirect"             
        authentication-failure-handler-ref="pennyUrlAuthenticationFailureHandler"
        authentication-success-handler-ref="pennyAuthSuccessHandler"
        default-target-url="/pages/account/orders.xhtml" />
    <logout logout-success-url="/"  invalidate-session="true"/>
</http>

If I go to a page that requires HTTPS, for the rest of session, it will use the HTTPS protocol, even if the user is not authenticated. If I go to https ://mystite/en/cart, HTTPS will be used for all browsing session.

I do not want to switch HTTPS to HTTP forever, but only if the user is not authenticated. Can I force the HTTP for non-authenticated users?

1 Answer 1

1

If I go to a page that requires HTTPS, for the rest of session, it will use the HTTPS protocol, even if the user is not authenticated.

That's correct because of

<intercept-url pattern="/**/cart/**" access="hasAnyRole('USER','ADMIN')" requires-channel="https" />

Also, because of

<intercept-url pattern="/**" requires-channel="any" />

it will stick with HTTPS once the user requested a resource that requires HTTPS. Why would it have to switch back if you say any (HTTPS is as good as any)?

Can I force the HTTP for non-authenticated users?

No, not that I know of. Personally, I don't think this would make much sense either.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.