Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
Using apache Shiro with Spring MVC non xml project

I have a project in which i am using Spring mvc 4 and i need to include there apache shiro security. I've tried to search over the web for a solution for my problem but didn't managed to fins something. Although there is a guide at Shiro's web site, but this example is only for xml configured Spring project, and my project doesn't contain any xml at all, and when i am trying to configure Shiro with annotation only it fails. When i run this project i have an access to all of my end points, and non of them is being restricted by Shiro. I guess that my configuration is wrong but i am unable to figure out which part of it is wrong. I am not allowed to use Spring boot (i know that there is examples for that). here is my configuration class:

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.myproject.menu")
public class AppConfiguration extends WebMvcConfigurerAdapter{


@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/**").addResourceLocations("/");
}

@Bean(name="shiroFilter")
public ShiroFilterFactoryBean shiroFilter (){
    ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
    shiroFilter.setLoginUrl("/MenuTest/login");
    shiroFilter.setFilterChainDefinitions("/MenuTest/init=anon");
    shiroFilter.setFilterChainDefinitions("/MenuTest/**=authc");
    shiroFilter.setSecurityManager(realm());
    return shiroFilter;
}

private DefaultWebSecurityManager realm(){
    DefaultWebSecurityManager realm = new DefaultWebSecurityManager();
    return realm;
}
}

Thx in advance!

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Take a look at the 1.4.0 (RC2) release. There is updated Spring and Spring-Boot support.

And examples in the source tree: https://github.com/apache/shiro/tree/master/samples/spring-mvc

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda