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

Java SpringSocialConfigurer类代码示例

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

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



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

示例1: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {

    final int REMEMBER_ME_SECONDS = 86400;  // 24h
    http
            .authorizeRequests()
            .antMatchers("/", "/welcome*", "/files/**", "/tracks/*").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin().loginPage(WELCOME).permitAll()
            .usernameParameter(Constants.EMAIL)
            .successHandler(successHandler())
            .failureHandler(failureHandler())
            .and()
            .rememberMe().tokenValiditySeconds(REMEMBER_ME_SECONDS)
            .rememberMeParameter("_spring_security_remember_me")
            .and()
            .logout().permitAll()
            .and()
            .apply(new SpringSocialConfigurer()
                    .postLoginUrl(MAIN)
                    .defaultFailureUrl(WELCOME)
                    .alwaysUsePostLoginUrl(true));
}
 
开发者ID:music-for-all,项目名称:music-for-all-application,代码行数:25,代码来源:SecurityConfig.java


示例2: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
public void configure(HttpSecurity http) throws Exception {
  http
      .csrf().disable()
      .httpBasic()
        .authenticationEntryPoint(new AwesomeAgileAuthenticationEntryPoint())
        .and()
      .logout()
        // TODO signout isn't currently handled
        .logoutUrl("/signout")
        .deleteCookies("JSESSIONID")
        .and()
      .authorizeRequests()
        .antMatchers("/index.html", "/", "/auth/**", "/info", "/health",
            "/images/**", "/css/**", "/js/**", "/node_modules/**", "/partials/**")
          .permitAll()
        .anyRequest()
          .authenticated()
        .and()
      .rememberMe()
        .and()
      .apply(new SpringSocialConfigurer());
}
 
开发者ID:cs71-caffeine,项目名称:awesome-agile,代码行数:23,代码来源:SecurityConfig.java


示例3: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .formLogin()
            .loginPage("/login")
            .loginProcessingUrl("/login/authenticate")
            .failureUrl("/login?param.error=bad_credentials")
            .permitAll()
            .and()
            .authorizeRequests()
            .antMatchers("/favicon.ico", "/static-resources/**").permitAll()
            .antMatchers("/**").authenticated()
            .and()
            .rememberMe()
            .and()
            .apply(new SpringSocialConfigurer());
}
 
开发者ID:miosman,项目名称:kotoby,代码行数:18,代码来源:SecurityConfiguration.java


示例4: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {

    http
        .formLogin()
            .loginPage("/login")
            .loginProcessingUrl("/login/authenticate")
            .failureUrl("/login?param.error=bad_credentials")
            .permitAll()
    .and()
        .logout()
            .logoutUrl("/logout")
            .deleteCookies("JSESSIONID")
    .and()
        .authorizeRequests()
            .antMatchers("/favicon.ico", "/static-resources/**").permitAll()
            .antMatchers("/**").authenticated()
    .and()
        .rememberMe()
    .and()
        .apply(new SpringSocialConfigurer()
            .postLoginUrl("/")
            .alwaysUsePostLoginUrl(true));
}
 
开发者ID:callistaenterprise,项目名称:blog-social-login-with-spring-social,代码行数:25,代码来源:SecurityConfiguration.java


示例5: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	http
		.formLogin()
			.loginPage("/signin")
			.loginProcessingUrl("/signin/authenticate")
			.failureUrl("/signin?param.error=bad_credentials")
		.and()
			.logout()
				.logoutUrl("/signout")
				.deleteCookies("JSESSIONID")
		.and()
			.authorizeRequests()
				.antMatchers("/admin/**", "/favicon.ico", "/resources/**", "/auth/**", "/signin/**", "/signup/**", "/disconnect/facebook").permitAll()
				.antMatchers("/**").authenticated()
		.and()
			.rememberMe()
		.and()
			.apply(new SpringSocialConfigurer())
			.and().setSharedObject(ApplicationContext.class, context);
}
 
开发者ID:joshlong,项目名称:javaconfig-ftw,代码行数:22,代码来源:SecurityConfig.java


示例6: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	http
		.formLogin()
			.loginPage("/signin")
			.loginProcessingUrl("/signin/authenticate")
			.failureUrl("/signin?param.error=bad_credentials")
		.and()
			.logout()
				.logoutUrl("/signout")
				.deleteCookies("JSESSIONID")
		.and()
			.authorizeRequests()
				.antMatchers("/_ah/**", "/admin/**", "/favicon.ico", "/resources/**", "/auth/**", "/signin/**", "/signup/**", "/disconnect/facebook").permitAll()
				.antMatchers("/**").authenticated()
		.and()
			.rememberMe()
		.and()
			.apply(new SpringSocialConfigurer())
			.and().setSharedObject(ApplicationContext.class, context);
}
 
开发者ID:amobiz,项目名称:spring-social-showcase-sec-appengine,代码行数:22,代码来源:SecurityConfig.java


示例7: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	http.authorizeRequests()
			.antMatchers("/oauth/authorize").authenticated()
			.and()
		.formLogin().permitAll()
			.loginPage("/login")
			.loginProcessingUrl("/auth/login")
			.failureUrl("/login?error")
			.and()
		.rememberMe()
			.rememberMeParameter("remember-me")
			.rememberMeServices(rememberMeServices)
			.and()
		.logout()
			.invalidateHttpSession(true)
			.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
			.logoutUrl("/auth/logout")
			.permitAll()
			.and()
		.headers()
			.frameOptions().sameOrigin()
			.and()
		.sessionManagement()
			.maximumSessions(10)
			.sessionRegistry(sessionRegistry)
			.and()
		.sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
			.and()
		.csrf()
			.requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize"))
			.disable()
		.cors().and()
		.apply(new SpringSocialConfigurer());
}
 
开发者ID:codenergic,项目名称:theskeleton,代码行数:36,代码来源:WebSecurityConfig.java


示例8: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	http
			.authorizeRequests()
			.antMatchers("/admin/**", "/dev/**")
				.access("@webUserSecurity.canAccessAdmin(authentication)")
			.antMatchers("/**").permitAll()
			.anyRequest()
			.authenticated()
			.and()
			.anonymous()
				.principal(ANONYMOUS)
			.and()
			.formLogin()
			.loginPage("/signin")
			.loginProcessingUrl("/signin/authenticate")
			.failureHandler(authenticationFailureHandler)
			.permitAll()
			.and()
			.logout()
			.deleteCookies("remember-me")
			.permitAll()
			.and()
			.rememberMe()
			.and()
			.exceptionHandling()
			.accessDeniedPage("/403")
			.and()
			.apply(new SpringSocialConfigurer()
					.postLoginUrl("/")
					.alwaysUsePostLoginUrl(true));

}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:34,代码来源:SecurityConfig.java


示例9: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http
        .requestMatchers().antMatchers(
        "/",
        "/manage/**",
        "/signin",
        "/auth/**",
        "/password/**",
        "/oauth/authorize",
        "/oauth/confirm_access"
    ).and()
        .authorizeRequests()
        .antMatchers("/signup", "/auth/**", "/password/**").permitAll()
        .antMatchers("/manage/**").hasRole("ADMIN")
        .anyRequest().authenticated()
        .and()
        .formLogin()
        .loginPage("/signin")
        .loginProcessingUrl("/signin/authenticate")
        .permitAll()
        .and()
        .logout()
        .logoutRequestMatcher(new AntPathRequestMatcher("/signout")).permitAll()
        .and()
        .apply(new SpringSocialConfigurer().postLoginUrl("/"));
    // @formatter:on
}
 
开发者ID:leon,项目名称:spring-oauth-social-microservice-starter,代码行数:30,代码来源:SecurityConfig.java


示例10: springSocialConfigurer

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Bean
public SpringSocialConfigurer springSocialConfigurer() {
    log.debug("New instance of " + SpringSocialConfigurer.class);

    return new SpringSocialConfigurer()
        .postLoginUrl("/#/")
        .alwaysUsePostLoginUrl(true);
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:9,代码来源:SocialConfig.java


示例11: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	// Set a custom successHandler on the SocialAuthenticationFilter
	final SpringSocialConfigurer socialConfigurer = new SpringSocialConfigurer();
	socialConfigurer.addObjectPostProcessor(new ObjectPostProcessor<SocialAuthenticationFilter>() {
		@Override
		public <O extends SocialAuthenticationFilter> O postProcess(O socialAuthenticationFilter) {
			socialAuthenticationFilter.setAuthenticationSuccessHandler(socialAuthenticationSuccessHandler);
			return socialAuthenticationFilter;
		}
	});

	http.exceptionHandling().and().anonymous().and().servletApi().and().headers().cacheControl().and()
			.authorizeRequests()

			//allow anonymous font and template requests
			.antMatchers("/").permitAll()
			.antMatchers("/favicon.ico").permitAll()
			.antMatchers("/resources/**").permitAll()

			//allow anonymous calls to social login
			.antMatchers("/auth/**").permitAll()

			//allow anonymous GETs to API
			.antMatchers(HttpMethod.GET, "/api/**").permitAll()

			//defined Admin only API area
			.antMatchers("/admin/**").hasRole("ADMIN")

			//all other request need to be authenticated
			.antMatchers(HttpMethod.GET, "/api/users/current/details").hasRole("USER")
			.anyRequest().hasRole("USER").and()

			// add custom authentication filter for complete stateless JWT based authentication
			.addFilterBefore(statelessAuthenticationFilter, AbstractPreAuthenticatedProcessingFilter.class)

			// apply the configuration from the socialConfigurer (adds the SocialAuthenticationFilter)
			.apply(socialConfigurer.userIdSource(userIdSource));
}
 
开发者ID:Robbert1,项目名称:boot-stateless-social,代码行数:40,代码来源:StatelessAuthenticationSecurityConfig.java


示例12: securityConfigurer

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Bean
public SecurityConfigurer securityConfigurer() {
    return new SpringSocialConfigurer().connectionAddedRedirectUrl("/").postLoginUrl("/").alwaysUsePostLoginUrl(true);
}
 
开发者ID:Turbots,项目名称:SpringOne2016,代码行数:5,代码来源:SecurityConfiguration.java


示例13: configure

import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {

    http.csrf().disable();

    http.headers().frameOptions().disable();

    http.authorizeRequests().antMatchers("/", "/logout").permitAll();

    http.authorizeRequests().antMatchers("/users/**", "/postSignIn")
            .access("hasRole('ROLE_USER')");


    http.authorizeRequests().and().logout().logoutUrl("/logout").logoutSuccessUrl("/");

    http.apply(new SpringSocialConfigurer().postLoginUrl("/postSignIn"));

}
 
开发者ID:DmitriyLy,项目名称:travel_portal,代码行数:19,代码来源:WebSecurityConfig.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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