0 Вопрос: я разрабатываю веб-приложение с Java, если я создаю аутентификацию с помощью Spring Security, она не работает

вопрос создан в Thu, May 2, 2019 12:00 AM

J2EE веб-приложение с аутентификацией Spring Security мой код правильный, без исключений, но я не могу войти и перенаправить на страницу неудачного входа Я разрабатываю свое приложение с помощью eclipse, проекта Spring mvc, Tomcat 8, MySQL

15:43:16.476 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.FilterChainProxy - /j_spring_security_check?username=sousou@d&password=123456 at position 1 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
15:43:16.478 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - HttpSession returned null object for SPRING_SECURITY_CONTEXT
15:43:16.478 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository - No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@5d2fc5. A new one will be created.
15:43:16.488 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.FilterChainProxy - /j_spring_security_check?username=sousou@d&password=123456 at position 2 of 11 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
15:43:16.490 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.FilterChainProxy - /j_spring_security_check?username=sousou@d&password=123456 at position 3 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
15:43:16.492 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.FilterChainProxy - /j_spring_security_check?username=sousou@d&password=123456 at position 4 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
15:43:16.492 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter - Request is to process authentication
15:43:16.497 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.AuthenticationServiceException: Authentication method not supported: GET
15:43:16.498 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter - Updated SecurityContextHolder to contain null Authentication
15:43:16.499 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter - Delegating to authentication failure handler org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler@147c3d7
15:43:16.499 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler - Redirecting to /failedlogin
15:43:16.500 [http-nio-9090-exec-19] DEBUG org.springframework.security.web.DefaultRedirectStrategy - Redirecting to '/it/failedlogin'

...

              <form  role="form" action="j_spring_security_check" > 
                     <div class="form-group mb-4">
                            <label for="Email">Identifiant</label>
                            <input type="text" class="form-control"   name="username">  
                                 <!--small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small-->
                     </div>

                     <div class="form-group mb-4">
                            <label for="Password">Mot de passe</label>
                            <input type="password" class="form-control" name="password">
                     </div>


                                <div class="d-flex justify-content-center mt-3 login_container mb-3">
                                  <input type="submit" class="btn btn-success" value="connection" >
                                 </div>



                        <div class="text-center">
                       <span class="small" >créer un nouveau compte </span> <a class="small" href="/it/inscription/nouveau"> s'inscrire!</a>
                        </div>                                                              
              </form>

              ...

* application-config .xml *          

        <s:intercept-url pattern="/actualite/" access="ROLE_ADMIN , ROLE_USER"/>
        <!--    <s:intercept-url pattern="" access="ROLE_ADMIN"/> -->


        <s:form-login login-page="/" default-target-url="/home/" authentication-failure-url="/failedlogin"></s:form-login>


        <s:access-denied-handler error-page="/403/"></s:access-denied-handler>
        <s:logout   logout-success-url="/" delete-cookies="JSESSIONID"></s:logout>

    </s:http>

    <s:authentication-provider> 
    <!--   <s:password-encoder hash="md5"/> -->
     <s:jdbc-user-service data-source-ref="dataSource"
      users-by-username-query="select login, pwd ,actived from compte where login = ?"
      authorities-by-username-query="select v.login, r.nameRole from compte v ,roles r where v.idCpt = r.idCpt and v.login = ?"/>
    </s:authentication-provider>

р>     

1
0 ответов                              0                         
источник размещен Вот