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


Java AccessDeniedHandlerImpl类代码示例

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


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

示例1: configure

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

    http
            .csrf()
            .disable();
    http
            .addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class)
            .addFilterAfter(samlFilter(), BasicAuthenticationFilter.class);
    http
            .authorizeRequests()
            .antMatchers("/").permitAll()
            .antMatchers("/error").permitAll()
            .antMatchers("/saml/**").permitAll()
            .antMatchers("/css/**").permitAll()
            .anyRequest().authenticated();

    http
            .exceptionHandling().accessDeniedHandler(new AccessDeniedHandlerImpl())
            .authenticationEntryPoint(getAuthEntryPoint())
            .and()
            .formLogin()
            .loginProcessingUrl("/authenticate")
            .usernameParameter("username")
            .passwordParameter("password")
            .successHandler(new FormAuthSuccessHandler())
            .failureHandler(new SimpleUrlAuthenticationFailureHandler())
            .and()
            .logout()
            .logoutUrl("/logout")
            .logoutSuccessUrl("/")
            .permitAll();
}
 
开发者ID:lhartikk,项目名称:spring-tsers-auth,代码行数:34,代码来源:WebSecurityConfig.java

示例2: exceptionTranslationFilter

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
@Bean
public ExceptionTranslationFilter exceptionTranslationFilter(){
    LoginUrlAuthenticationEntryPoint entryPoint = new LoginUrlAuthenticationEntryPoint("/index.xhtml");
    entryPoint.setForceHttps(false);
    AccessDeniedHandlerImpl handler = new AccessDeniedHandlerImpl();
    handler.setErrorPage("/index.xhtml");
    ExceptionTranslationFilter bean = new ExceptionTranslationFilter(entryPoint);
    bean.setAccessDeniedHandler(handler);
    return bean;
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:11,代码来源:SecurityConfiguration.java

示例3: nonRedirectingAccessDeniedHandler

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
@Bean
public AccessDeniedHandler nonRedirectingAccessDeniedHandler(){
    return new AccessDeniedHandlerImpl();
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:5,代码来源:SecurityConfig.java

示例4: AdminRequestedAccessDeniedHandler

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
private AdminRequestedAccessDeniedHandler(AuthenticationEntryPoint entryPoint) {
	AccessDeniedHandlerImpl deniedHandler = new AccessDeniedHandlerImpl();
	deniedHandler.setErrorPage("/error/403");
	this.deniedHandler = deniedHandler;
	this.entryPoint = entryPoint;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:7,代码来源:SecurityConfig.java

示例5: AjaxSupportedAccessDeniedHandler

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
public AjaxSupportedAccessDeniedHandler(){
	delegateAccessDeniedHandler = new AccessDeniedHandlerImpl();
}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:4,代码来源:AjaxSupportedAccessDeniedHandler.java

示例6: afterPropertiesSet

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
	AccessDeniedHandlerImpl adh = new AccessDeniedHandlerImpl();
	adh.setErrorPage(errorPage);
	this.delegateAccessDeniedHandler = adh;
}
 
开发者ID:wayshall,项目名称:onetwo,代码行数:7,代码来源:AjaxSupportedAccessDeniedHandler.java

示例7: accessDeniedHandler

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
@Bean
public AccessDeniedHandler accessDeniedHandler() {
    LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler> handlers = new LinkedHashMap<>();
    handlers.put(CsrfException.class, new CsrfTokenExceptionHandler());
    return new DelegatingAccessDeniedHandler(handlers, new AccessDeniedHandlerImpl());
}
 
开发者ID:vitalii-dmytruk,项目名称:ConfLab,代码行数:7,代码来源:WebSecurityConfig.java

示例8: parse

import org.springframework.security.web.access.AccessDeniedHandlerImpl; //导入依赖的package包/类
public BeanDefinition parse(Element element, ParserContext parserContext) {
  BeanDefinitionBuilder consumerContextFilterBean = BeanDefinitionBuilder.rootBeanDefinition(OAuthConsumerContextFilter.class);

  String failureHandlerRef = element.getAttribute("failure-handler-ref");
  if (StringUtils.hasText(failureHandlerRef)) {
    consumerContextFilterBean.addPropertyReference("OAuthFailureHandler", failureHandlerRef);
  }
  else {
    String failurePage = element.getAttribute("oauth-failure-page");
    if (StringUtils.hasText(failurePage)) {
      AccessDeniedHandlerImpl failureHandler = new AccessDeniedHandlerImpl();
      failureHandler.setErrorPage(failurePage);
      consumerContextFilterBean.addPropertyValue("OAuthFailureHandler", failureHandler);
    }
  }

  String resourceDetailsRef = element.getAttribute("resource-details-service-ref");
  String supportRef = element.getAttribute("support-ref");
  if (!StringUtils.hasText(supportRef)) {
    BeanDefinitionBuilder consumerSupportBean = BeanDefinitionBuilder.rootBeanDefinition(CoreOAuthConsumerSupport.class);

    if (StringUtils.hasText(resourceDetailsRef)) {
      consumerSupportBean.addPropertyReference("protectedResourceDetailsService", resourceDetailsRef);
    }
    parserContext.getRegistry().registerBeanDefinition("oauthConsumerSupport", consumerSupportBean.getBeanDefinition());
    supportRef = "oauthConsumerSupport";
  }
  consumerContextFilterBean.addPropertyReference("consumerSupport", supportRef);

  String tokenServicesFactoryRef = element.getAttribute("token-services-ref");
  if (StringUtils.hasText(tokenServicesFactoryRef)) {
    consumerContextFilterBean.addPropertyReference("tokenServices", tokenServicesFactoryRef);
  }

  String rememberMeServicesRef = element.getAttribute("remember-me-services-ref");
  if (StringUtils.hasText(rememberMeServicesRef)) {
    consumerContextFilterBean.addPropertyReference("rememberMeServices", rememberMeServicesRef);
  }

  String redirectStrategyRef = element.getAttribute("redirect-strategy-ref");
  if (StringUtils.hasText(redirectStrategyRef)) {
    consumerContextFilterBean.addPropertyReference("redirectStrategy", redirectStrategyRef);
  }

  parserContext.getRegistry().registerBeanDefinition("oauthConsumerContextFilter", consumerContextFilterBean.getBeanDefinition());
  List<BeanMetadataElement> filterChain = ConfigUtils.findFilterChain(parserContext, element.getAttribute("filter-chain-ref"));
  filterChain.add(filterChain.size(), new RuntimeBeanReference("oauthConsumerContextFilter"));

  BeanDefinition fids = ConfigUtils.createSecurityMetadataSource(element, parserContext);
  if (fids != null) {
    BeanDefinitionBuilder consumerAccessFilterBean = BeanDefinitionBuilder.rootBeanDefinition(OAuthConsumerProcessingFilter.class);

    if (StringUtils.hasText(resourceDetailsRef)) {
      consumerAccessFilterBean.addPropertyReference("protectedResourceDetailsService", resourceDetailsRef);
    }

    String requireAuthenticated = element.getAttribute("requireAuthenticated");
    if (StringUtils.hasText(requireAuthenticated)) {
      consumerAccessFilterBean.addPropertyValue("requireAuthenticated", requireAuthenticated);
    }

    consumerAccessFilterBean.addPropertyValue("objectDefinitionSource", fids);
    parserContext.getRegistry().registerBeanDefinition("oauthConsumerFilter", consumerAccessFilterBean.getBeanDefinition());
    filterChain.add(filterChain.size(), new RuntimeBeanReference("oauthConsumerFilter"));
  }

  return null;
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:69,代码来源:OAuthConsumerBeanDefinitionParser.java


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