當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。