本文整理汇总了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));
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}
示例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
}
示例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);
}
示例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));
}
示例12: securityConfigurer
import org.springframework.social.security.SpringSocialConfigurer; //导入依赖的package包/类
@Bean
public SecurityConfigurer securityConfigurer() {
return new SpringSocialConfigurer().connectionAddedRedirectUrl("/").postLoginUrl("/").alwaysUsePostLoginUrl(true);
}
示例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"));
}