1. java
  2. android
  3. c#
  4. .net
  5. javascript
  6. php
  7. jquery
  8. html
  9. sql

Problema com o spring security

> Olha pessoal ! estou com um problema!  estou desenvolvendo uma
> aplicação java web usando o spring security 4.0  JPA, JSF e
> Primefaces. O problema é o seguinte quando eu aplico o filtro do
> spring e faz a autenticação e direciona para a pagina correta mas
> nessa pagina dashboard.xhtml tem um menu que quando eu clico nele era
> para chamar um bean(controller) só que não faz não nem aparece erro
> nenhum !
> 
> 
> 
> **spring-security.xml**
> 
> 
> <?xml version="1.0" encoding="UTF-8"?> <beans
> xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
>     xmlns:sec="http://www.springframework.org/schema/security"
>     xsi:schemaLocation="     http://www.springframework.org/schema/beans 
>     http://www.springframework.org/schema/beans/spring-beans.xsd
>     http://www.springframework.org/schema/context 
>     http://www.springframework.org/schema/context/spring-context.xsd
>     http://www.springframework.org/schema/security
>        http://www.springframework.org/schema/security/spring-security.xsd ">
> 
> 
>     <!--******************************************************************************************* -->     <!-- O Código deve permanecer limpo e de fácil manutenção, nunca deixe dívidas técnicas por aqui -->
>     <!--******************************************************************************************* -->
> 
> 
> 
>     <!-- Habilita a utilização de annotations nos Beans -->
>     <context:annotation-config />
> 
> 
>     <!-- ******************* AUTHENTICATION PROVIDER ******************
> -->     <sec:http>         <sec:intercept-url pattern="/login" access="permitAll" />         <sec:intercept-url pattern="/**"
> access="isAuthenticated()" />
>                  <!-- Page level Spring Security : Enable Primefaces -->
>        <sec:intercept-url pattern="/javax.faces.resource/**" access="hasRole('ROLE_USER')"/>         <sec:intercept-url pattern="/js/**"
> access="hasRole('ROLE_USER')" />
>            <sec:intercept-url pattern="/css/**" access="hasRole('ROLE_USER')"/>
>            <sec:intercept-url pattern="/fonts/**" access="hasRole('ROLE_USER')" />
>            <sec:intercept-url pattern="/img/**" access="hasRole('ROLE_USER')" />
>            
>            <sec:intercept-url pattern="/paginas/dashboard.xhtml" access="hasRole('ROLE_USER')" />
>            <sec:intercept-url pattern="/paginas/global/perfil/**" access="hasRole('ROLE_ADMIN')" />         <sec:intercept-url
> pattern="/paginas/global/usuario/**" access="hasRole('ROLE_USER')" />
>         <sec:intercept-url pattern="/paginas/global/pessoa/**"
> access="hasRole('ROLE_ADMIN')" />         <sec:intercept-url
> pattern="/paginas/global/sistema/**" access="hasRole('ROLE_ADMIN')" />
>         <sec:intercept-url pattern="/paginas/global/usuario/**"
> access="hasRole('ROLE_ADMIN')" />
>                  <sec:form-login login-page="/login"    default-target-url="/paginas/dashboard.xhtml"
>             authentication-failure-url="/login"/>
>                      <sec:logout logout-url="/logout" logout-success-url="/login" />
>                  <sec:csrf />     </sec:http>
> 
>     <bean id="autenticacaoService"
>         class="br.com.nomeDaEmpresa.webcore.negocio.service.global.seguranca.AutenticacaoServiceImpl">
>     </bean>
> 
>     <sec:authentication-manager>         <sec:authentication-provider
> ref="autenticacaoService" />     </sec:authentication-manager>
>           </beans>
> 
> 
> 
> 
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> 
> **web.xml**
> 
> 
> <?xml version="1.0" encoding="UTF-8"?> <web-app
> xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
>             http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
>          version="3.1">
>             <display-name>webcore</display-name>
> 
>     <welcome-file-list>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> 
>     <!--******************************************************************************************* -->     <!-- Configuraçãod do JSF -->     <!--******************************************************************************************* -->          <servlet>         <servlet-name>Faces Servlet</servlet-name>         <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>     </servlet>
> 
>     <servlet-mapping>         <servlet-name>Faces Servlet</servlet-name>
>         <url-pattern>*.jsf</url-pattern>     </servlet-mapping>     
>     <servlet-mapping>         <servlet-name>Faces Servlet</servlet-name>
>         <url-pattern>*.xhtml</url-pattern>     </servlet-mapping>
>     
> 
>     <context-param>         <param-name>javax.faces.PROJECT_STAGE</param-name>
>         <param-value>Development</param-value>     </context-param>
>           <context-param>         <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>         <param-value>.xhtml</param-value>     </context-param>     
>     <context-param>
>         <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
>         <param-value>/WEB-INF/tags/nomeDaEmpresa.taglib.xml</param-value>
>     </context-param>
> 
> 
>     <!--******************************************************************************************* -->     <!-- Tema do primefaces -->     <!--******************************************************************************************* -->
> 
>     <c


----------


ontext-param>  
>         <param-name>primefaces.THEME</param-name>  
>         <param-value>bootstrap</param-value>       </context-param> 
> 
> 
> 
>     <!--******************************************************************************************* -->     <!-- Configuração do Spring -->     <!--******************************************************************************************* -->         <context-param>
>             <param-name>contextConfigLocation</param-name>
>             <param-value>/WEB-INF/spring/applicationContext.xml
>             </param-value>         </context-param>
> 
>          <listener>
>             <listener-class>
>                 org.springframework.web.context.ContextLoaderListener
>             </listener-class>
>         </listener>
>         
>         <!--
>         
>         Foi removido o Spring MVC devido a bugs no redirecionamento
>         
>          <listener>
>             <listener-class>
>                 org.springframework.web.context.request.RequestContextListener
>             </listener-class>
>         </listener>
>         
>         <servlet>             <servlet-name>dispatcher</servlet-name>             <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>             <load-on-startup>1</load-on-startup>         </servlet>
> 
>         <servlet-mapping>             <servlet-name>dispatcher</servlet-name>
>             <url-pattern>/</url-pattern>         </servlet-mapping> -->
>         
>              <!--******************************************************************************************* -->     <!-- FILTROS DO JPA  -->     <!--******************************************************************************************* -->
>         
>         
>         <filter>             <filter-name>OpenEntityManagerInViewFilter</filter-name>
>             <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
>         </filter>
>         
>         
>         <filter-mapping>
>             <filter-name>OpenEntityManagerInViewFilter</filter-name>
>             <url-pattern>/*</url-pattern>         </filter-mapping>
>              <!-- ******************************************************************************************* -->     <!--             CONFIGURAÇÃO DO SPRING SECURITY  ||  FILTROS DE SEGURANÇA DA APLICAÇÃO          -->     <!--
> ******************************************************************************************* -->
>         <filter>
>             <filter-name>springSecurityFilterChain</filter-name>
>             <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
>         </filter>
>         <filter-mapping>
>             <filter-name>springSecurityFilterChain</filter-name>
>             <url-pattern>/*</url-pattern>
>             <dispatcher>FORWARD</dispatcher>
>             <dispatcher>REQUEST</dispatcher>
>         </filter-mapping>
>        
>        
>       
> 
>      <!--******************************************************************************************* -->     <!-- Enconding helper filter   || FORÇA O ENCODING PARA UTF-8 -->     <!--*******************************************************************************************        
>         <filter>
>             <filter-name>encodingFilter</filter-name>
>             <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
>             <init-param>
>                 <param-name>encoding</param-name>
>                 <param-value>UTF-8</param-value>
>             </init-param>
>             <init-param>
>                 <param-name>forceEncoding</param-name>
>                 <param-value>true</param-value>
>             </init-param>
>         </filter>
>         <filter-mapping>
>             <filter-name>encodingFilter</filter-name>
>             <servlet-name>dispatcher</servlet-name>
>         </filter-mapping>         -->
>                  <!-- ************************************************************************************* -->         <!--                       PAGINAS CUSTOMIZADAS DE ERROS                                   -->         <!-- ************************************************************************************* -->
>                  <error-page>             <error-code>404</error-code>             <location>/error404</location>         </error-page>
>                  <error-page>             <error-code>403</error-code>             <location>/erroAutenticacao</location>         </error-page>
>                  <error-page>             <exception-type>javax.faces.application.ViewExpiredException</exception-type>
>             <location>/tempoExpirado</location>         </error-page>    </web-app>
  1. Você vai ver essas setas em qualquer página de pergunta. Com elas, você pode dizer se uma pergunta ou uma resposta foram relevantes ou não.
  2. Edite sua pergunta ou resposta caso queira alterar ou adicionar detalhes.
  3. Caso haja alguma dúvida sobre a pergunta, adicione um comentário. O espaço de respostas deve ser utilizado apenas para responder a pergunta.
  4. Se o autor da pergunta marcar uma resposta como solucionada, esta marca aparecerá.
  5. Clique aqui para mais detalhes sobre o funcionamento do GUJ!

1 resposta

Não é a resposta que estava procurando? Procure outras perguntas com as tags spring-security ou faça a sua própria pergunta.