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


Java Http403ForbiddenEntryPoint类代码示例

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


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

示例1: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的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.Http403ForbiddenEntryPoint; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
	http
			// disable CSRF, http basic, form login
			.csrf().disable() //
			.httpBasic().disable() //
			.formLogin().disable()

			// ReST is stateless, no sessions
			.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) //

			.and()

			// return 403 when not authenticated
			.exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint());

	// Let child classes set up authorization paths
	setupAuthorization(http);

	http.addFilterBefore(jsonWebTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
 
开发者ID:thomas-kendall,项目名称:trivia-microservices,代码行数:22,代码来源:JsonWebTokenSecurityConfig.java

示例3: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
/**
 * Configure HttpSecurity. This includes:<br>
 * - resources requiring authorized <br>
 * - resources that are free to access <br>
 * - csrf token mapping <br>
 * - construction of the security filter chain
 *
 * @param httpSecurity
 * @throws Exception
 */
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
            .csrf().disable().headers().frameOptions().disable().and()
            .antMatcher("/**").authorizeRequests()
            .antMatchers("/login/**").permitAll()
            .antMatchers("/abilities/**").permitAll()
            .antMatchers("/jsondoc/**").permitAll()
            .antMatchers("/jsondoc-ui.html").permitAll()
            .antMatchers("/webjars/jsondoc-ui-webjar/**").permitAll()
            .anyRequest().authenticated().and()
            .exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint()).and();

    httpSecurity.addFilterBefore(statelessJwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
    httpSecurity.addFilterBefore(createOAuth2Filter(), BasicAuthenticationFilter.class);
}
 
开发者ID:HelfenKannJeder,项目名称:come2help,代码行数:28,代码来源:OAuth2ClientConfigurer.java

示例4: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
@Override
protected void configure(final HttpSecurity httpSecurity) throws Exception {

	final String contextPath = servletContext.getContextPath();

	httpSecurity.csrf().disable() // Disable CSRF
			.addFilter(jSONUsernamePasswordAuthenticationFilter) // Custom username/password filter
			.addFilterAfter(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) // API token filter
			.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) // Session less

	.and().exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint()) // Entry point

	.and().authorizeRequests().antMatchers(contextPath + "/auth/login", contextPath + "/swagger/login", contextPath + "/swagger/jquery.min.js").permitAll() // Login and Swagger login resources access
			.antMatchers(contextPath + "/*", contextPath + "/swagger/**").hasRole("ADMIN") // Admin access to Swagger
			.antMatchers(contextPath + "/**").hasAnyRole("USER", "ADMIN"); // API access
}
 
开发者ID:Sylvain-Bugat,项目名称:swagger-cxf-rest-skeleton,代码行数:17,代码来源:SecurityConfiguration.java

示例5: configure

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

示例6: configure

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

示例7: configure

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

示例8: configure

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

示例9: configure

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

示例10: configure

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

示例11: configure

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

示例12: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .csrf().disable()
            .headers().cacheControl().and().and()
            .exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint()).and()
            .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
            .addFilterBefore(authenticationFilter(), UsernamePasswordAuthenticationFilter.class)
            .authorizeRequests()
            .antMatchers("/favicon.ico", "/**/*.html", "/**/*.css", "/**/*.js", "/**/*.gif").permitAll()
            .antMatchers("/api/public/**").permitAll()
            .antMatchers(HttpMethod.POST, "/api/users").permitAll()
            .anyRequest().authenticated();
}
 
开发者ID:nidi3,项目名称:jwt-with-spring,代码行数:15,代码来源:SecurityConfig.java

示例13: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
@Override
public void configure(HttpSecurity http) throws Exception {
    PreAuthenticatedAuthenticationProvider casAuthenticationProvider = new PreAuthenticatedAuthenticationProvider();
    casAuthenticationProvider.setPreAuthenticatedUserDetailsService(
            new UserDetailsByNameServiceWrapper<>(peticionamentoUserDetailService.orElseThrow(() ->
                            SingularServerException.rethrow(
                                    String.format("Bean %s do tipo %s não pode ser nulo. Para utilizar a configuração de segurança %s é preciso declarar um bean do tipo %s identificado pelo nome %s .",
                                            UserDetailsService.class.getName(),
                                            "peticionamentoUserDetailService",
                                            SingularCASSpringSecurityConfig.class.getName(),
                                            UserDetailsService.class.getName(),
                                            "peticionamentoUserDetailService"
                                    ))
            )
            )
    );

    ProviderManager authenticationManager = new ProviderManager(Arrays.asList(new AuthenticationProvider[]{casAuthenticationProvider}));

    J2eePreAuthenticatedProcessingFilter j2eeFilter = new J2eePreAuthenticatedProcessingFilter();
    j2eeFilter.setAuthenticationManager(authenticationManager);

    http
            .regexMatcher(getContext().getPathRegex())
            .httpBasic().authenticationEntryPoint(new Http403ForbiddenEntryPoint())
            .and()
            .csrf().disable()
            .headers().frameOptions().sameOrigin()
            .and()
            .jee().j2eePreAuthenticatedProcessingFilter(j2eeFilter)
            .and()
            .authorizeRequests()
            .antMatchers(getContext().getContextPath()).authenticated();

}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:36,代码来源:SingularCASSpringSecurityConfig.java

示例14: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
/**
 * Configure HttpSecurity. This includes:<br>
 * - resources requiring authorized <br>
 * - resources that are free to access <br>
 * - csrf token mapping <br>
 * - construction of the security filter chain
 *
 * @param httpSecurity
 * @throws Exception
 */
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .csrf().disable()
            .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).enableSessionUrlRewriting(false).and()
            .antMatcher("/**").authorizeRequests()
            .antMatchers("/login/**").permitAll()
            .anyRequest().authenticated().and()
            .exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint()).and()
            .addFilterBefore(statelessJwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class)
            .addFilterBefore(createSsoFilter(facebook(), facebookSuccessHandler(), "/login/facebook"), BasicAuthenticationFilter.class);
}
 
开发者ID:andreas-eberle,项目名称:spring-oauth2-jwt-minimal,代码行数:23,代码来源:OAuth2ClientConfigurer.java

示例15: configure

import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; //导入依赖的package包/类
@SuppressWarnings("ProhibitedExceptionDeclared")
@Override
protected void configure(final HttpSecurity http) throws Exception {
    final LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
    entryPoints.put(new AntPathRequestMatcher("/api/**"), new Http403ForbiddenEntryPoint());
    entryPoints.put(AnyRequestMatcher.INSTANCE, new LoginUrlAuthenticationEntryPoint(FindController.DEFAULT_LOGIN_PAGE));
    final AuthenticationEntryPoint authenticationEntryPoint = new DelegatingAuthenticationEntryPoint(entryPoints);

    http
        .csrf()
            .disable()
        .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .accessDeniedPage("/authentication-error")
            .and()
        .logout()
            .logoutUrl("/logout")
            .logoutSuccessUrl(FindController.DEFAULT_LOGIN_PAGE)
            .and()
        .authorizeRequests()
            .antMatchers(FindController.APP_PATH + "/**").hasAnyRole(FindRole.USER.name())
            .antMatchers(FindController.CONFIG_PATH).hasRole(FindRole.CONFIG.name())
            .antMatchers("/api/public/**").hasRole(FindRole.USER.name())
            .antMatchers("/api/bi/**").hasRole(FindRole.BI.name())
            .antMatchers("/api/config/**").hasRole(FindRole.CONFIG.name())
            .antMatchers("/api/admin/**").hasRole(FindRole.ADMIN.name())
            .antMatchers(FindController.DEFAULT_LOGIN_PAGE).permitAll()
            .antMatchers(FindController.LOGIN_PATH).permitAll()
            .antMatchers("/").permitAll()
            .anyRequest().denyAll()
            .and()
        .headers()
            .defaultsDisabled()
            .frameOptions()
            .sameOrigin();

    idolSecurityCustomizer.customize(http, authenticationManager());
}
 
开发者ID:hpe-idol,项目名称:find,代码行数:39,代码来源:IdolSecurity.java


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