lundi 20 avril 2015

Spring security: requires-channel="https" causes ERR_CONNECTION_REFUSED

I'm having a problem while trying to redirect to https using <intercept-url ... requires-channel="https"/> , I get an error in browser console, saying:

"GET https://localhost:8443/xxx/authenticate.htmnet::ERR_CONNECTION_REFUSED"

spring-security.xml contains:

<http auto-config="true" use-expressions="true">

    <intercept-url pattern="/authenticate.htm" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')" requires-channel="https"/>

    <form-login login-page="/index.htm" default-target-url="/authenticate.htm"
        authentication-failure-url="/loginfailed.htm" username-parameter="j_username"
        password-parameter="j_password" />

    <!-- <session-management invalid-session-url="/loginfailed.htm"> <concurrency-control 
        error-if-maximum-exceeded="true" max-sessions="1"> </concurrency-control> 
        </session-management> -->

    <logout invalidate-session="false" logout-success-url="/index.htm" />

    <port-mappings>
        <port-mapping http="8080" https="443"/>
    </port-mappings>

</http>

My logincontroller contains:

@RequestMapping(value = "/authenticate.htm", method = RequestMethod.GET)
public String autenticate(Model model, HttpSession session){

    model.addAttribute("msg", "Successfully logged in");
    return "success";
}

Is there any wrong with my code? Please suggest a method to resolve this issue.

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire