当前位置: 首页>>代码示例>>Java>>正文


Java AntPathRequestMatcher类代码示例

本文整理汇总了Java中org.springframework.security.web.util.matcher.AntPathRequestMatcher的典型用法代码示例。如果您正苦于以下问题:Java AntPathRequestMatcher类的具体用法?Java AntPathRequestMatcher怎么用?Java AntPathRequestMatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AntPathRequestMatcher类属于org.springframework.security.web.util.matcher包,在下文中一共展示了AntPathRequestMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception{
    http.addFilterBefore(characterEncodingFilter(), CsrfFilter.class);
    http.authorizeRequests()
            .antMatchers("/","/category/**","/article/add","/user/update").access("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN') or hasRole('ROLE_MODERATOR')")
            .antMatchers("/admin","/admin/**").access("hasRole('ROLE_ADMIN')")
            .and()
            .formLogin()
            .loginPage("/login")
            .usernameParameter("ssoId")
            .passwordParameter("password")
            .failureHandler(new CustomAuthenticationFailureHandler())
            .defaultSuccessUrl("/")
            .and()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/login?logout").deleteCookies("JSESSIONID")
            .invalidateHttpSession(true)
            .and()
            .rememberMe().tokenRepository(persistentTokenRepository()).tokenValiditySeconds(86400)
            .and()
            .csrf()
            .and()
            .exceptionHandling().accessDeniedPage("/error");

    http.sessionManagement().maximumSessions(1).sessionRegistry(sessionRegistry());
}
 
开发者ID:Exercon,项目名称:AntiSocial-Platform,代码行数:27,代码来源:SecurityConfiguration.java

示例2: samlFilter

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Bean
public FilterChainProxy samlFilter() throws Exception {
    List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"),
            samlEntryPoint()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"),
            samlLogoutFilter()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/metadata/**"),
            metadataDisplayFilter()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"),
            samlWebSSOProcessingFilter()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSOHoK/**"),
            samlWebSSOHoKProcessingFilter()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"),
            samlLogoutProcessingFilter()));
    chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/discovery/**"),
            samlIDPDiscovery()));
    return new FilterChainProxy(chains);
}
 
开发者ID:lhartikk,项目名称:spring-tsers-auth,代码行数:20,代码来源:WebSecurityConfig.java

示例3: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
   protected void configure(HttpSecurity http) throws Exception
   {
      
     // EXAMPLE OF AUTHENTICATION AND AUTHORIZATION
      
      http.csrf().disable().
      authorizeRequests()
      //TODO: verificar se da pra deixar um matcher só
    .antMatchers("/admin").hasRole("ADMIN")
    .antMatchers("/admin/**").hasRole("ADMIN")
    .antMatchers("/cadastro/**").permitAll()
    .antMatchers("/evaluate").permitAll()
    .antMatchers("/vQtDNoCxpCa8QIAZPWeIMt4hPuLwZ8a/").permitAll()
    .antMatchers("/modulo/cultura/missao/deliver").permitAll()
    .antMatchers("/entrega/submit").permitAll()
    
//      .antMatchers(HttpMethod.POST,"/specificUrl").hasRole("ADMIN")
//      .antMatchers("/url3/**").permitAll()
      .anyRequest().authenticated()
      .and()
      .formLogin().loginPage("/login"). permitAll()
      .and()
      .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
      
   }
 
开发者ID:ismartonline,项目名称:ismartonline,代码行数:27,代码来源:SecurityConfiguration.java

示例4: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    List<RequestMatcher> csrfMethods = new ArrayList<>();
    Arrays.asList( "POST", "PUT", "PATCH", "DELETE" )
            .forEach( method -> csrfMethods.add( new AntPathRequestMatcher( "/**", method ) ) );
    http
            .sessionManagement().sessionCreationPolicy( SessionCreationPolicy.STATELESS ).and()
            .exceptionHandling().authenticationEntryPoint( restAuthenticationEntryPoint ).and()
            .authorizeRequests()
            .antMatchers(
                    HttpMethod.GET,
                    "/",
                    "/webjars/**",
                    "/*.html",
                    "/favicon.ico",
                    "/**/*.html",
                    "/**/*.css",
                    "/**/*.js"
            ).permitAll()
            .antMatchers("/auth/**").permitAll()
            .anyRequest().authenticated().and()
            .addFilterBefore(new TokenAuthenticationFilter(tokenHelper, jwtUserDetailsService), BasicAuthenticationFilter.class);

    http.csrf().disable();
}
 
开发者ID:bfwg,项目名称:springboot-jwt-starter,代码行数:26,代码来源:WebSecurityConfig.java

示例5: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .authorizeRequests()
            .antMatchers("/", "/login", "/register")
            .permitAll()
            .anyRequest()
            .authenticated()
            .and()
            .formLogin()
            .loginPage("/login")
            .defaultSuccessUrl("/profile")
            .and()
            .logout()
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/login");
}
 
开发者ID:plkpiotr,项目名称:forum,代码行数:18,代码来源:SecurityConfiguration.java

示例6: authInterceptor

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Bean
public AuthenticationInterceptor authInterceptor() {
    List<RequestMatcher> matchers = ImmutableList.of(
        new AntPathRequestMatcher("/flows/**"),
        new AntPathRequestMatcher("/user/register"),
        new AntPathRequestMatcher("/user/delete"),
        new AntPathRequestMatcher("/user"),
        new AntPathRequestMatcher("/user/role/update"),
        new AntPathRequestMatcher("/jobs/**"),
        new AntPathRequestMatcher("/credentials/*"),
        new AntPathRequestMatcher("/actions/**"),
        new AntPathRequestMatcher("/message/**"),
        new AntPathRequestMatcher("/agents/create"),
        new AntPathRequestMatcher("/agents"),
        new AntPathRequestMatcher("/roles/**"),
        new AntPathRequestMatcher("/thread/config")
    );
    return new AuthenticationInterceptor(matchers);
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:20,代码来源:WebConfig.java

示例7: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception{
    http.authorizeRequests()
            .antMatchers("/","/category/**","/article/add","/user/update").access("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN') or hasRole('ROLE_MODERATOR')")
            .antMatchers("/admin","/admin/**").access("hasRole('ROLE_ADMIN')")
            .and()
            .formLogin()
            .loginPage("/login")
            .usernameParameter("ssoId")
            .passwordParameter("password")
            .failureHandler(new CustomAuthenticationFailureHandler())
            .defaultSuccessUrl("/")
            .and()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/login?logout").deleteCookies("JSESSIONID")
            .invalidateHttpSession(true)
            .and()
            .rememberMe().tokenRepository(persistentTokenRepository()).tokenValiditySeconds(86400)
            .and()
            .csrf()
            .and()
            .exceptionHandling().accessDeniedPage("/oups");

    http.sessionManagement().maximumSessions(1).sessionRegistry(sessionRegistry());
}
 
开发者ID:Exercon,项目名称:AntiSocial-Platform,代码行数:26,代码来源:SecurityConfiguration.java

示例8: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
            .antMatchers("/produtos/form").hasRole("ADMIN")
            .antMatchers("/shopping/**").permitAll()
            .antMatchers(HttpMethod.POST, "/produtos").hasRole("ADMIN")
            .antMatchers("/produtos/**").permitAll()
            .antMatchers("/").permitAll()
            .antMatchers("/user/**").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin().loginPage("/login").permitAll().successHandler(
                    new RedirectAfterLogin())
            // para definir para onde vai depois de fazer o login
            .and()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher(
                            "/logout"))
            .logoutSuccessHandler(new RedirectAfterLogout());
}
 
开发者ID:nailtonvieira,项目名称:pswot-cloud-java-spring-webapp,代码行数:20,代码来源:SecurityConfiguration.java

示例9: springSecurityFilterChain

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Bean(name = "springSecurityFilterChain")
public FilterChainProxy springSecurityFilterChain() throws ServletException, Exception {

    final List<SecurityFilterChain> listOfFilterChains = new ArrayList<SecurityFilterChain>();

    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/cors")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/dump")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/validatorUrl")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-resources")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/ui")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/security")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/v2/api-docs")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-ui.html")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/webjars/**")));
    // no filters
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/webjars/**")));// no filters
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/*"), securityContextPersistenceFilterWithASCFalse(),
            usernamePasswordAuthenticationFilter(), sessionManagementFilter(), exceptionTranslationFilter(), filterSecurityInterceptor()));

    final FilterChainProxy filterChainProxy = new FilterChainProxy(listOfFilterChains);

    return filterChainProxy;
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:24,代码来源:WebSecurityConfig.java

示例10: springSecurityFilterChain

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Bean(name = "springSecurityFilterChain")
public FilterChainProxy springSecurityFilterChain() throws ServletException, Exception {

    final List<SecurityFilterChain> listOfFilterChains = new ArrayList<SecurityFilterChain>();
    // listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/login"), new NoSecurityFilter()));

    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/validatorUrl")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-resources")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/ui")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/configuration/security")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/v2/api-docs")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/swagger-ui.html")));
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/webjars/**")));
    // no filters
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/webjars/**")));// no filters
    listOfFilterChains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/api/**"), securityContextPersistenceFilterWithASCFalse(),
            exceptionTranslationFilter(), filterSecurityInterceptor()));

    final FilterChainProxy filterChainProxy = new FilterChainProxy(listOfFilterChains);

    return filterChainProxy;
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:23,代码来源:WebSecurityConfig.java

示例11: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected void configure(final HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .authorizeRequests()
            .antMatchers("/fonts/**").permitAll()
            .antMatchers("/register").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin().loginPage("/login").permitAll()
            .and()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).permitAll()
            .and()
            .exceptionHandling().accessDeniedPage("/access?error")
            .and().headers().xssProtection().block(false).xssProtectionEnabled(false).and() // Default setting for Spring Boot to activate XSS Protection (dont fix!)
            .and().csrf().disable(); // FIXME [dh] Enabling CSRF prevents file upload, must be fixed
}
 
开发者ID:Omegapoint,项目名称:facepalm,代码行数:18,代码来源:SecurityConfig.java

示例12: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    logger.debug("Configuring web security");

    http.headers().cacheControl().disable();
    http.authorizeRequests()
            // TODO (move img to images)
            // TODO (move intl to js/intl)
            .antMatchers("/intl/*", "/img/*", "/fonts/*", "/webjars/**", "/cli/**").permitAll()
            .regexMatchers("/login\\?.*").permitAll()
            .anyRequest().fullyAuthenticated()
            .and()
            .formLogin()
            .loginPage("/login").permitAll()
            .successHandler(new ShowPageAuthenticationSuccessHandler())
            .and()
            .logout().logoutSuccessUrl("/login?logout").permitAll();

    http.exceptionHandling().defaultAuthenticationEntryPointFor(new Http401AuthenticationEntryPoint("API_UNAUTHORIZED"), new AntPathRequestMatcher("/api/*"));
    http.exceptionHandling().defaultAuthenticationEntryPointFor(new LoginUrlAuthenticationEntryPoint("/login"), new AntPathRequestMatcher("/*"));
}
 
开发者ID:box,项目名称:mojito,代码行数:22,代码来源:WebSecurityConfig.java

示例13: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {

    httpSecurity
            .authorizeRequests()
            .antMatchers("/", "/esparkHome").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/esparkLoginPage")
            .defaultSuccessUrl("/esparkUserPage")
            .permitAll()
            .and()
            .csrf().disable()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/esparkHome")
            .permitAll();

}
 
开发者ID:adarshkumarsingh83,项目名称:spring_boot,代码行数:20,代码来源:SecurityConfiguration.java

示例14: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .authorizeRequests()
            .antMatchers("/", "/esparkHome").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/esparkLoginPage")
            .defaultSuccessUrl("/esparkUserPage")
            .permitAll()
            .and()
            .csrf().disable()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
             .logoutSuccessUrl("/esparkHome")
            .permitAll();

}
 
开发者ID:adarshkumarsingh83,项目名称:spring_boot,代码行数:19,代码来源:WebSecurityConfiguration.java

示例15: configure

import org.springframework.security.web.util.matcher.AntPathRequestMatcher; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .authorizeRequests()
            .antMatchers("/", "/esparkHome").permitAll()
            .antMatchers("/espark/info").hasAnyRole("ADMIN","USER")
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/esparkLoginPage")
            .defaultSuccessUrl("/esparkUserPage")
            .permitAll()
            .and()
            .csrf().disable()
            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
            .logoutSuccessUrl("/esparkHome?logout=true")
            .permitAll();

}
 
开发者ID:adarshkumarsingh83,项目名称:spring_boot,代码行数:20,代码来源:SecurityConfiguration.java


注:本文中的org.springframework.security.web.util.matcher.AntPathRequestMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。