2014-09-01 1 views
0

나는 다음과 같은 봄 보안 구성을 어떻게 POST로 대신 http GET을 기반으로 작동하도록 로그인 로그인 URL을 변경하십시오 :포스트 봄 보안 대신 얻을 수 로그인을 변경하는 방법

당신이 봄 보안을 통해 방법 게시물 양식을 보내려면

*http://localhost/myapp/j_security_check?j_username=test&j_password=test*

이것은 자세한 내용은 내 구성 XML 파일

<beans:beans xmlns="http://www.springframework.org/schema/security" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> 

    <http access-denied-page="/WEB-INF/pages/accessdenied.jsp" auto-config="true" use-expressions="true"> 

     <intercept-url pattern="/admin" access="hasRole('ROLE_ADMIN')" method="GET"/> 
     <intercept-url pattern="/user" access="hasRole('ROLE_USER')"/> 

     <form-login 
      always-use-default-target="true" 
      authentication-failure-url="/loginfailed" 
      default-target-url="/landing" 
      login-page="/login" /> 

     <logout 
       invalidate-session="true" 
       logout-success-url="/login?logout" /> 

     <form-login 
      login-page="/login" 
      default-target-url="/welcome" 
      authentication-failure-url="/login?error" 
      username-parameter="username" 
      password-parameter="password" /> 
     <logout logout-success-url="/login?logout" /> --> 

    </http> 

    <beans:bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> 
     <beans:property name="userDetailsService" ref="userDetailsService" ></beans:property>  
    </beans:bean> 

    <beans:bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager" > 
     <beans:property name="providers"> 
      <beans:list> 
       <beans:ref local="daoAuthenticationProvider"/> 
      </beans:list> 
     </beans:property> 
    </beans:bean> 

    <authentication-manager> 
     <authentication-provider user-service-ref="userDetailsService"> 
     </authentication-provider> 
    </authentication-manager>' 
</beans:beans> 
+2

왜? 일반적으로 요청 매개 변수로 사용자 이름과 암호를 전달하지 않으려 고합니다. –

+0

클라이언트는 get 및 post 메서드를 사용하여 응용 프로그램에 로그인하려고합니다. –

+0

[Spring 3.0 Security http GET 로그인] 가능한 복제본 (http://stackoverflow.com/questions/13814346/spring-3-0-security-http-get-login) –

답변

0

입니다. 이 토큰을 양식에 추가해야합니다.

<input type="hidden" name="${_csrf.parameterName}" 
          value="${_csrf.token}" />