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


Java HttpStatusReturningLogoutSuccessHandler类代码示例

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


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

示例1: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.sessionManagement().sessionCreationPolicy(STATELESS);
    http.apply(jwt());
    http.antMatcher("/jwt/**");
    http.csrf().disable();
    http.authorizeRequests()
        .antMatchers("/jwt/one").access("hasRole('ONE')")
        .antMatchers("/jwt/two").access("hasRole('TWO')")
        .anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/jwt/signIn")
        .permitAll();
    http.logout().logoutUrl("/jwt/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:17,代码来源:JwtApplySecurityConfiguration.java

示例2: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
            .antMatchers("/", "/home", "/login").permitAll()
            .antMatchers("/app/**").permitAll()
            .antMatchers("/vendor/**").permitAll()
            .antMatchers("/fonts/**").permitAll()
            .antMatchers("/assets/images/**").permitAll()
            .antMatchers("/*.js").permitAll()
            .antMatchers("/*.ttf").permitAll()
            .antMatchers("/*.woff2").permitAll()
            .anyRequest().authenticated()
            .and().httpBasic()
            .and()
            .logout()
            .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
            .invalidateHttpSession(true)
            .deleteCookies("JSESSIONID");
    if (Arrays.asList(environment.getActiveProfiles()).contains(MetronRestConstants.CSRF_ENABLE_PROFILE)) {
        http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
    } else {
        http.csrf().disable();
    }
}
 
开发者ID:apache,项目名称:metron,代码行数:26,代码来源:WebSecurityConfig.java

示例3: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的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

示例4: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/stormpath/**");
    http.csrf().disable();
    http.authorizeRequests()
        .antMatchers("/stormpath/one").access("hasRole('ONE')")
        .antMatchers("/stormpath/two").access("hasRole('TWO')")
        .anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/stormpath/signIn")
        .permitAll();
    http.logout().logoutUrl("/stormpath/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:15,代码来源:StormpathAuthenticationConfiguration.java

示例5: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.apply(jwt());
    http.antMatcher("/all/**");
    http.csrf().disable();
    http.authorizeRequests()
        .antMatchers("/all/one").access("hasRole('ONE')")
        .antMatchers("/all/two").access("hasRole('TWO')")
        .anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/all/signIn")
        .permitAll();
    http.logout().logoutUrl("/all/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:16,代码来源:AllApplyAuthenticationConfiguration.java

示例6: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/all/**");
    http.csrf().disable();
    http.authorizeRequests()
        .antMatchers("/all/one").access("hasRole('ONE')")
        .antMatchers("/all/two").access("hasRole('TWO')")
        .anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/all/signIn")
        .permitAll();
    http.logout().logoutUrl("/all/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:15,代码来源:AllAnnotationAuthenticationConfiguration.java

示例7: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/normal/**");
    http.csrf().disable();
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/normal/signIn")
        .permitAll();
    http.logout().logoutUrl("/normal/signOut").logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:11,代码来源:SpringSecurityConfiguration.java

示例8: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.sessionManagement().sessionCreationPolicy(STATELESS);
    http.antMatcher("/jwt/**");
    http.csrf().disable();
    http.authorizeRequests()
        .antMatchers("/jwt/one").access("hasRole('ONE')")
        .antMatchers("/jwt/two").access("hasRole('TWO')")
        .anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/jwt/signIn")
        .permitAll();
    http.logout().logoutUrl("/jwt/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:16,代码来源:JwtAnnotationSecurityConfiguration.java

示例9: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.apply(jwt());
    http.antMatcher("/custom/**");
    http.csrf().disable();
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/custom/signIn")
        .permitAll();
    http.logout().logoutUrl("/custom/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:13,代码来源:JwtCustomPrincipleSecurityConfigurationApply.java

示例10: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected final void configure(HttpSecurity http) throws Exception {
    http.antMatcher("/custom/**");
    http.csrf().disable();
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().successHandler(new NoRedirectAuthenticationSuccessHandler()).loginPage("/custom/signIn")
        .permitAll();
    http.logout().logoutUrl("/custom/signOut")
        .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
    http.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:12,代码来源:JwtCustomPrincipleSecurityConfigurationAnnotation.java

示例11: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	// @formatter:off
	http
	  //.headers()
	    //.frameOptions().sameOrigin()
	  //  .and()
	  .authorizeRequests()
	    .antMatchers("/index.html", "/csrf", "/", "/router").permitAll()
	    .antMatchers("/info", "/health").permitAll()
	    .anyRequest().authenticated()
	    .and()
	  .rememberMe()
           .rememberMeServices(this.rememberMeServices)
           .key(this.appProperties.getRemembermeCookieKey())
	    .and()
	  .formLogin()
           .successHandler(this.authenticationSuccessHandler)
           .failureHandler(new JsonAuthFailureHandler())
	    .permitAll()
	    .and()
	  .logout()
           .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
           .deleteCookies("JSESSIONID")
	    .permitAll()
	    .and()
	  .exceptionHandling()
           .authenticationEntryPoint(new Http401UnauthorizedEntryPoint());
	// @formatter:on
}
 
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:31,代码来源:SecurityConfig.java

示例12: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	if (config.getUrl().startsWith("https://")) {
		LOGGER.info("Enabled force https");
		http.requiresChannel().anyRequest().requiresSecure();
	}
	http
			// cache control
			.headers()
			.cacheControl().disable()
			.and()

			// access control
			.authorizeRequests()
			.antMatchers(

					// == static resources -> permit all
					"/css/**", "/images/**", "/js/**", "/fonts/**", "/favicon.ico",

					// == login/register/email_verify -> permit all
					"/register/**", "/login", "/email_verify/do_verify",

					// == error page -> permit all
					"/error",

					"/yggdrasil/**"

			).permitAll()
			.antMatchers(

					// == (re)send_verify_email -> permit authenticated users
					"/email_verify/**"

			).authenticated()

			// == other urls -> permit verified users
			.anyRequest().hasAuthority("ROLE_VERIFIED")
			.and()

			// login
			.exceptionHandling()
			.authenticationEntryPoint(authEntry)

			// redirect to '/email_verify' is email is not verified
			.accessDeniedHandler((request, response, ex) -> {
				if (!isAjax(request)) {
					Optional<User> user = UserService.getCurrentUser();
					if (user.isPresent() && !user.get().isEmailVerified()) {
						response.sendRedirect("/email_verify");
						return;
					}
				}
				request.setAttribute(ERROR_ATTRIBUTE, ex);
				response.sendError(SC_FORBIDDEN, E_ACCESS_DENIED);
			})
			.and()

			// logout
			.logout()
			.logoutUrl("/logout")
			.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.NO_CONTENT))
			.and();
}
 
开发者ID:yushijinhun,项目名称:akir,代码行数:64,代码来源:SecurityConfig.java

示例13: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	final RequestMatcher textHtmlMatcher = new MediaTypeRequestMatcher(
			contentNegotiationStrategy,
			MediaType.TEXT_HTML);

	final String loginPage = dashboard("/#/login");

	final BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint();
	basicAuthenticationEntryPoint.setRealmName(securityProperties.getBasic().getRealm());
	basicAuthenticationEntryPoint.afterPropertiesSet();

	http
		.csrf()
		.disable()
		.authorizeRequests()
		.antMatchers("/")
		.authenticated()
		.antMatchers(
				dashboard("/**"),
				"/authenticate",
				"/security/info",
				"/features",
				"/assets/**").permitAll()
	.and()
		.formLogin().loginPage(loginPage)
		.loginProcessingUrl(dashboard("/login"))
		.defaultSuccessUrl(dashboard("/")).permitAll()
	.and()
		.logout().logoutUrl(dashboard("/logout"))
			.logoutSuccessUrl(dashboard("/logout-success.html"))
		.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler()).permitAll()
	.and().httpBasic()
		.and().exceptionHandling()
		.defaultAuthenticationEntryPointFor(
				new LoginUrlAuthenticationEntryPoint(loginPage),
				textHtmlMatcher)
		.defaultAuthenticationEntryPointFor(basicAuthenticationEntryPoint,
				AnyRequestMatcher.INSTANCE)
	.and()
		.authorizeRequests()
		.anyRequest().authenticated();

	final SessionRepositoryFilter<ExpiringSession> sessionRepositoryFilter = new SessionRepositoryFilter<ExpiringSession>(
			sessionRepository());
	sessionRepositoryFilter
			.setHttpSessionStrategy(new HeaderHttpSessionStrategy());

	http.addFilterBefore(sessionRepositoryFilter,
			ChannelProcessingFilter.class).csrf().disable();
	http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dashboard,代码行数:53,代码来源:BasicAuthSecurityConfiguration.java

示例14: configure

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
    http
        .headers().disable()
        //.csrf().disable()
        .authorizeRequests()
            .antMatchers("/failure").permitAll()
            .antMatchers("/user/session").permitAll()
            .antMatchers("/user/createaccount").permitAll()
            .antMatchers("/user/resetPassword").permitAll()
            .antMatchers("/user/processResetPasswordUrl").permitAll()
            .antMatchers("/user/changePassword").permitAll()
            .antMatchers("/user/registrationConfirm").permitAll()
            .antMatchers("/v2/api-docs").hasAnyAuthority("admin")
            .antMatchers("/users/**").hasAnyAuthority("admin")
            .anyRequest().authenticated()
            .and()
        .exceptionHandling()
            .authenticationEntryPoint(restAuthenticationEntryPoint)
            .accessDeniedHandler(restAccessDeniedHandler)
            .and()
        .formLogin()
            .loginProcessingUrl("/authenticate")
            .successHandler(restAuthenticationSuccessHandler)
            .failureHandler(restAuthenticationFailureHandler)
            .usernameParameter("username")
            .passwordParameter("password")
            .permitAll()
            .and()
        .logout()
            .logoutUrl("/logout")
            .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())
            .deleteCookies("JSESSIONID")
            .permitAll()
            .and()
        .rememberMe()
            .rememberMeServices(rememberMeServices)
            .key(REMEMBER_ME_KEY)
            .and()
        .csrf()
            .requireCsrfProtectionMatcher(csrfRequestMatcher)
            .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
}
 
开发者ID:csokafor,项目名称:spring-security-angularjs,代码行数:44,代码来源:SecurityConfig.java

示例15: logout

import org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler; //导入依赖的package包/类
private void logout(HttpSecurity http) throws Exception {
    http.logout().logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler());
}
 
开发者ID:vitalii-dmytruk,项目名称:ConfLab,代码行数:4,代码来源:WebSecurityConfig.java


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