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


Java SecurityContextPersistenceFilter类代码示例

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


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

示例1: configure

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	final Filter corsFilter = context.getBean(ICorsFilterConfig.class).corsFilter();
	final AuthenticationEntryPoint basicAuthenticationEntryPoint = context.getBean(
			BASIC_AUTH_BEAN_NAME,
			AuthenticationEntryPoint.class);
	http
			.antMatcher(JwtRestServiceConfig.REST_API_URL_PREFIX + "/**")
			// As of Spring Security 4.0, CSRF protection is enabled by default.
			.csrf().disable()
			// Configure CORS
			.addFilterBefore(corsFilter, SecurityContextPersistenceFilter.class)
			.authorizeRequests()
			.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
			.antMatchers("/**").hasAnyAuthority(ROLE_USER)
			.and()
			.httpBasic().authenticationEntryPoint(basicAuthenticationEntryPoint);
}
 
开发者ID:activeviam,项目名称:autopivot,代码行数:19,代码来源:SecurityConfig.java

示例2: filterChain

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
private List<SecurityFilterChain> filterChain() {
List<SecurityFilterChain> filters = new ArrayList<SecurityFilterChain>(12);
       RequestMatcher req = new AntPathRequestMatcher("/**");
       
       filters.add(new DefaultSecurityFilterChain(req, new SecurityContextPersistenceFilter(), 
               logoutFilter(),cojAuthenticationProcessingFilter(),new SecurityContextHolderAwareRequestFilter(),
               rememberMeAuthenticationFilter(),anonymousAuthenticationFilter(),exceptionTranslationFilter(),filterInvocationInterceptor()
               ));
return filters;
   }
 
开发者ID:dovier,项目名称:coj-web,代码行数:11,代码来源:SecurityConfiguration.java

示例3: configure

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
@Override
public void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().permitAll().and().formLogin().loginPage("/signin").defaultSuccessUrl("/blog").and().logout().logoutUrl("/logout").logoutSuccessUrl("/blog").and().rememberMe().rememberMeParameter("remember-me").and().csrf().disable();

    User admin = userRepository.findByUsername("admin");
    if (admin == null)
        admin = new User("admin", "123456");
    admin.setAdmin(true);
    admin.setPassword("123456");
    userRepository.save(admin);
    http.addFilterAfter(new DevSigninFilter(userRepository), SecurityContextPersistenceFilter.class);
}
 
开发者ID:lixiaocong,项目名称:lxcCMS,代码行数:13,代码来源:DevWebSecurityConfig.java

示例4: filterChainProxy

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
/**
 * Gets a filter chain proxy.
 *
 * @param trustedUserAuthenticationFilter the trusted user authentication filter.
 * @param httpHeaderAuthenticationFilter the HTTP header authentication filter.
 *
 * @return the filter chain proxy.
 */
@Bean
public FilterChainProxy filterChainProxy(final TrustedUserAuthenticationFilter trustedUserAuthenticationFilter,
    final HttpHeaderAuthenticationFilter httpHeaderAuthenticationFilter)
{
    return new FilterChainProxy(new SecurityFilterChain()
    {
        @Override
        public boolean matches(HttpServletRequest request)
        {
            // Match all URLs.
            return true;
        }

        @Override
        public List<Filter> getFilters()
        {
            List<Filter> filters = new ArrayList<>();

            // Required filter to store session information between HTTP requests.
            filters.add(new SecurityContextPersistenceFilter());

            // Trusted user filter to bypass security based on SpEL expression environment property.
            filters.add(trustedUserAuthenticationFilter);

            // Filter that authenticates based on http headers.
            if (Boolean.valueOf(configurationHelper.getProperty(ConfigurationValue.SECURITY_HTTP_HEADER_ENABLED)))
            {
                filters.add(httpHeaderAuthenticationFilter);
            }

            // Anonymous user filter.
            filters.add(new AnonymousAuthenticationFilter("AnonymousFilterKey"));

            return filters;
        }
    });
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:46,代码来源:AppSpringModuleConfig.java

示例5: configure

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .csrf().disable()
            .authorizeRequests()
            .antMatchers("/",
                    "/login",
                    "/login**",
                    "/register.html",
                    "/action/register",
                    "/action/verify/*",
                    "/js/**")
            .permitAll()
            .anyRequest()
            .authenticated()
            .and()
            .formLogin()
            .loginPage("/login.html")
            .loginProcessingUrl("/login")
            .usernameParameter("username")
            .passwordParameter("password")
            .defaultSuccessUrl("/conversation.html")
            .failureUrl("/login.html?error=true")
            .permitAll()
            .and()
            .logout()
            .logoutUrl("/logout.html")
            .logoutSuccessUrl("/login.html")
            .permitAll()
            .and()
            .addFilterBefore(ssoFilters(), BasicAuthenticationFilter.class)
            .addFilterAfter(oAuth2ClientContextFilter, SecurityContextPersistenceFilter.class);
}
 
开发者ID:mslosarz,项目名称:nextrtc-videochat-with-rest,代码行数:34,代码来源:WebSecurityConfig.java

示例6: getServletFilters

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
@Override
protected Filter[] getServletFilters() {
    return new Filter[]{
            new MDCInsertingServletFilter(),
            new HiddenHttpMethodFilter(),
            new OpenEntityManagerInViewFilter(),
            new RequestContextFilter(),
            new SecurityContextPersistenceFilter()
    };
}
 
开发者ID:martinlau,项目名称:unidle-old,代码行数:11,代码来源:DispatcherServletInitializer.java

示例7: securityContextPersistenceFilterWithASCFalse

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
public SecurityContextPersistenceFilter securityContextPersistenceFilterWithASCFalse() {
    // return new SecurityContextPersistenceFilter(new HttpSessionSecurityContextRepository());// this stores token in httpSession
    return new SecurityContextPersistenceFilter(statelessSecurityContextRepository());
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:5,代码来源:WebSecurityConfig.java

示例8: securityContextPersistenceFilterWithASCFalse

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
public SecurityContextPersistenceFilter securityContextPersistenceFilterWithASCFalse() {
    logger.info("securityContextPersistenceFilterWithASCFalse");
    // return new SecurityContextPersistenceFilter(new HttpSessionSecurityContextRepository());// this stores token in httpSession
    return new SecurityContextPersistenceFilter(statelessSecurityContextRepository());
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:6,代码来源:WebSecurityConfig.java

示例9: addSecurityContextPersistenceFilter

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
private void addSecurityContextPersistenceFilter(List<Filter> filters, SecurityContextRepository contextRepository) {
    SecurityContextPersistenceFilter securityContextFilter = new SecurityContextPersistenceFilter(contextRepository);
    filters.add(securityContextFilter);
}
 
开发者ID:motech,项目名称:motech,代码行数:5,代码来源:SecurityRuleBuilder.java

示例10: getSecurityContextPersistenceFilter

import org.springframework.security.web.context.SecurityContextPersistenceFilter; //导入依赖的package包/类
/**
 * Gets the security context persistence filter.
 *
 * @return the security context persistence filter
 */
@Bean(name = "sif")
public SecurityContextPersistenceFilter getSecurityContextPersistenceFilter() {
  return new SecurityContextPersistenceFilter();
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:10,代码来源:ProbeSecurityConfig.java


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