org.springframework.social.security.SocialAuthenticationFilter Java Examples

The following examples show how to use org.springframework.social.security.SocialAuthenticationFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PreSpringSocialConfigurer.java    From pre with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected <T> T postProcess(T object) {
	SocialAuthenticationFilter filter = (SocialAuthenticationFilter) super.postProcess(object);
	filter.setFilterProcessesUrl(filterProcessesUrl);
	filter.setSignupUrl("/socialSignUp");
	filter.setAuthenticationSuccessHandler(preAuthenticationSuccessHandler);
	return (T) filter;
}
 
Example #2
Source File: PcSpringSocialConfigurer.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
/**
 * Post process t.
 *
 * @param <T>    the type parameter
 * @param object the object
 *
 * @return the t
 */
@SuppressWarnings("unchecked")
@Override
protected <T> T postProcess(T object) {
	SocialAuthenticationFilter filter = (SocialAuthenticationFilter) super.postProcess(object);
	filter.setFilterProcessesUrl(filterProcessesUrl);
	if (socialAuthenticationFilterPostProcessor != null) {
		socialAuthenticationFilterPostProcessor.process(filter);
	}
	return (T) filter;
}
 
Example #3
Source File: FebsSpringSocialConfigurer.java    From FEBS-Security with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected <T> T postProcess(T object) {
    SocialAuthenticationFilter socialAuthenticationFilter = (SocialAuthenticationFilter)super.postProcess(object);
    socialAuthenticationFilter.setFilterProcessesUrl(filterProcessesUrl);
    socialAuthenticationFilter.setSignupUrl(febsSecurityProperties.getSocial().getSocialRedirectUrl());
    socialAuthenticationFilter.setAuthenticationSuccessHandler(febsAuthenticationSucessHandler);
    return (T) socialAuthenticationFilter;
}
 
Example #4
Source File: StatelessAuthenticationSecurityConfig.java    From boot-stateless-social with MIT License 5 votes vote down vote up
@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));
}
 
Example #5
Source File: SecurityConfig.java    From JiwhizBlogWeb with Apache License 2.0 5 votes vote down vote up
@Bean
public SocialAuthenticationFilter socialAuthenticationFilter() throws Exception{
    SocialAuthenticationFilter filter = new SocialAuthenticationFilter(
    		authenticationManager(), userIdSource,
            usersConnectionRepository, socialAuthenticationServiceLocator);
    filter.setFilterProcessesUrl("/signin");  //TODO fix the deprecated call.
    filter.setSignupUrl(null); 
    filter.setConnectionAddedRedirectUrl("/#/myAccount");
    filter.setPostLoginUrl("/#/myAccount"); //always open account profile page after login
    filter.setRememberMeServices(rememberMeServices());
    return filter;
}
 
Example #6
Source File: SocialSecurityConfigurer.java    From cola with MIT License 4 votes vote down vote up
@Override
protected <T> T postProcess(T object) {
	SocialAuthenticationFilter filter = (SocialAuthenticationFilter) super.postProcess(object);
	filter.setFilterProcessesUrl(filterProcessesUrl);
	return (T) filter;
}
 
Example #7
Source File: AppSocialAuthenticationFilterPostProcessor.java    From paascloud-master with Apache License 2.0 4 votes vote down vote up
@Override
public void process(final SocialAuthenticationFilter socialAuthenticationFilter) {
	socialAuthenticationFilter.setAuthenticationSuccessHandler(pcAuthenticationSuccessHandler);
}
 
Example #8
Source File: SocialAuthenticationFilterPostProcessor.java    From paascloud-master with Apache License 2.0 2 votes vote down vote up
/**
 * Process.
 *
 * @param socialAuthenticationFilter the social authentication filter
 */
void process(SocialAuthenticationFilter socialAuthenticationFilter);