• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RememberMeAuthenticationFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: customizeRememberMe

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Override
protected void customizeRememberMe(HttpSecurity http) throws Exception {
  UserDetailsService userDetailsService = lookup("userDetailsService");
  PersistentTokenRepository persistentTokenRepository = lookup("persistentTokenRepository");
  AbstractRememberMeServices rememberMeServices = lookup("rememberMeServices");
  RememberMeAuthenticationFilter rememberMeAuthenticationFilter =
      lookup("rememberMeAuthenticationFilter");

  http.rememberMe()
      .userDetailsService(userDetailsService)
      .tokenRepository(persistentTokenRepository)
      .rememberMeServices(rememberMeServices)
      .key(rememberMeServices.getKey())
      .and()
      .logout()
      .logoutUrl(LOGOUT_ENDPOINT)
      .and()
      .addFilterAt(rememberMeAuthenticationFilter, RememberMeAuthenticationFilter.class);
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:20,代码来源:AuthSecurityConfiguration.java


示例2: configure

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
  AbstractPreAuthenticatedProcessingFilter accessTokenAuthenticationFilter = accessTokenAuthenticationFilter();
  
  http
    .addFilterBefore(accessTokenAuthenticationFilter, RememberMeAuthenticationFilter.class)
    .csrf().disable()
    .exceptionHandling().authenticationEntryPoint(getAuthenticationEntryPoint())
    .and()
    .authorizeRequests()
    .requestMatchers(request -> request.getRequestURI().startsWith(loginPath)).anonymous()
    .requestMatchers(request -> request.getRequestURI().equals(userPath) && request.getMethod().equalsIgnoreCase("POST")).anonymous()
    .requestMatchers(request -> request.getRequestURI().startsWith(passwordRequestPath)).permitAll()
    .requestMatchers(request -> request.getRequestURI().startsWith(apiBasePath + getPathFromResource(PasswordRequest.class))).anonymous()
    .requestMatchers(request -> request.getRequestURI().startsWith(apiBasePath)).authenticated()
    .and()
    .formLogin()
    .loginPage(loginPath)
    .usernameParameter("username")
    .passwordParameter("password")
    .successHandler(loginSuccessHandler())
    .failureHandler(loginFailureHandler())
    .permitAll()
    .and()
    .logout()
    .logoutUrl(logoutPath)
    .logoutSuccessHandler(logoutSuccessHandler())
    .permitAll();

  http.rememberMe().rememberMeServices(rememberMeServices()).key("token");
}
 
开发者ID:adrobisch,项目名称:putput,代码行数:32,代码来源:WebSecurityConfig.java


示例3: init

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
    ArtifactorySystemProperties properties =
            ((ArtifactoryHome) filterConfig.getServletContext().getAttribute(ArtifactoryHome.SERVLET_CTX_ATTR))
                    .getArtifactoryProperties();
    ConstantValues disableRememberMeProp = ConstantValues.securityDisableRememberMe;
    Boolean disableRememberMe = properties.getBooleanProperty(disableRememberMeProp);
    if (!disableRememberMe) {
        ServletContext servletContext = filterConfig.getServletContext();
        ArtifactoryContext context = RequestUtils.getArtifactoryContext(servletContext);
        rememberMeDelegateFilter = context.beanForType(RememberMeAuthenticationFilter.class);
        rememberMeDelegateFilter.init(filterConfig);
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:15,代码来源:ArtifactoryRememberMeFilter.java


示例4: rememberMeAuthenticationFilter

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Bean
RememberMeAuthenticationFilter rememberMeAuthenticationFilter() throws Exception {
    return new RememberMeAuthenticationFilter(authenticationManager(), persistentTokenBasedRememberMeServices());
}
 
开发者ID:AgainstWind,项目名称:spring-cloud-demos,代码行数:5,代码来源:SecurityConfig.java


示例5: configure

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    /**
     * To keep readability, please do not use IDE's code organization feature for this code.
     *
     * Current format for security configuration is:
     *  .security feature() // Feature method to config
     *      .feature-specific configurations()
     *      .and() // And of the configuration for the feature
     *  .another security feature()
     *      .configuration()
     */
    http
        .authorizeRequests()
            .antMatchers("/api/session").permitAll()
            .antMatchers("/h2-console/**").permitAll()
            .antMatchers("/api/**").authenticated()
            .and()
        .headers()
            .frameOptions().disable() // for h2
            .and()
        .requestCache()
            .requestCache(new NullRequestCache())
            .and()
        .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
            .and()
        .rememberMe()
            .rememberMeServices(rememberMeServices())
            .key(oSoonProperties.getRememberMeKey())
            .and()
        .csrf()
            .disable()
        .logout()
            .logoutRequestMatcher(r -> r.getMethod().equalsIgnoreCase("DELETE") && r.getRequestURI().equalsIgnoreCase("/api/session"))
            .logoutSuccessUrl("/")
            .clearAuthentication(true)
            .deleteCookies(oSoonProperties.getCookieName())
            .and()
        .addFilterBefore(rememberMeAuthenticationFilter(), RememberMeAuthenticationFilter.class);
}
 
开发者ID:spring-sprout,项目名称:osoon,代码行数:42,代码来源:SecurityConfig.java


示例6: rememberMeAuthenticationFilter

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
@Bean
public RememberMeAuthenticationFilter rememberMeAuthenticationFilter(){
    return new RememberMeAuthenticationFilter(authenticationManager(),rememberMeServices());
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:5,代码来源:SecurityConfiguration.java


示例7: configure

import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter; //导入依赖的package包/类
/**
 * Configures the protected private resources.
 *
 * @param http HTTP sec object
 * @throws Exception ex
 */
@Override
protected void configure(HttpSecurity http) throws Exception {
	ConfigObject protectedResources = Config.getConfig().getObject("security.protected");
	ConfigValue apiSec = Config.getConfig().getValue("security.api_security");
	boolean enableRestFilter = apiSec != null && Boolean.TRUE.equals(apiSec.unwrapped());
	String signinPath = Config.getConfigParam("security.signin", "/signin");
	String signoutPath = Config.getConfigParam("security.signout", "/signout");
	String accessDeniedPath = Config.getConfigParam("security.access_denied", "/403");
	String signoutSuccessPath = Config.getConfigParam("security.signout_success", signinPath);

	// If API security is disabled don't add the API endpoint to the list of protected resources
	if (enableRestFilter) {
		http.authorizeRequests().requestMatchers(RestRequestMatcher.INSTANCE);
	}

	parseProtectedResources(http, protectedResources);

	if (Config.getConfigBoolean("security.csrf_protection", true)) {
		http.csrf().requireCsrfProtectionMatcher(CsrfProtectionRequestMatcher.INSTANCE).
				csrfTokenRepository(csrfTokenRepository);
	} else {
		http.csrf().disable();
	}

	http.sessionManagement().enableSessionUrlRewriting(false);
	http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);
	http.sessionManagement().sessionAuthenticationStrategy(new NullAuthenticatedSessionStrategy());
	http.exceptionHandling().authenticationEntryPoint(new SimpleAuthenticationEntryPoint(signinPath));
	http.exceptionHandling().accessDeniedHandler(new SimpleAccessDeniedHandler(accessDeniedPath));
	http.requestCache().requestCache(new SimpleRequestCache());
	http.logout().logoutUrl(signoutPath).logoutSuccessUrl(signoutSuccessPath);
	http.rememberMe().rememberMeServices(rememberMeServices);

	registerAuthFilters(http);

	if (enableRestFilter) {
		if (jwtFilter != null) {
			jwtFilter.setAuthenticationManager(authenticationManager());
			http.addFilterBefore(jwtFilter, RememberMeAuthenticationFilter.class);
		}
		RestAuthFilter restFilter = new RestAuthFilter();
		http.addFilterAfter(restFilter, JWTRestfulAuthFilter.class);
	}
}
 
开发者ID:Erudika,项目名称:para,代码行数:51,代码来源:SecurityConfig.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RC6Engine类代码示例发布时间:2022-05-22
下一篇:
Java JsonParser类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap