Tabnine Logo
AccessDeniedHandlerImpl.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.springframework.security.web.access.AccessDeniedHandlerImpl
constructor

Best Java code snippets using org.springframework.security.web.access.AccessDeniedHandlerImpl.<init> (Showing top 19 results out of 315)

origin: spring-projects/spring-security

private AccessDeniedHandler createDefaultDeniedHandler(H http) {
  if (this.defaultDeniedHandlerMappings.isEmpty()) {
    return new AccessDeniedHandlerImpl();
  }
  if (this.defaultDeniedHandlerMappings.size() == 1) {
    return this.defaultDeniedHandlerMappings.values().iterator().next();
  }
  return new RequestMatcherDelegatingAccessDeniedHandler(
      this.defaultDeniedHandlerMappings,
      new AccessDeniedHandlerImpl());
}
origin: spring-projects/spring-security

/**
 * Shortcut to specify the {@link AccessDeniedHandler} to be used is a specific error
 * page
 *
 * @param accessDeniedUrl the URL to the access denied page (i.e. /errors/401)
 * @return the {@link ExceptionHandlingConfigurer} for further customization
 * @see AccessDeniedHandlerImpl
 * @see #accessDeniedHandler(org.springframework.security.web.access.AccessDeniedHandler)
 */
public ExceptionHandlingConfigurer<H> accessDeniedPage(String accessDeniedUrl) {
  AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
  accessDeniedHandler.setErrorPage(accessDeniedUrl);
  return accessDeniedHandler(accessDeniedHandler);
}
origin: spring-projects/spring-security-oauth

String failurePage = element.getAttribute("oauth-failure-page");
if (StringUtils.hasText(failurePage)) {
 AccessDeniedHandlerImpl failureHandler = new AccessDeniedHandlerImpl();
 failureHandler.setErrorPage(failurePage);
 consumerContextFilterBean.addPropertyValue("OAuthFailureHandler", failureHandler);
origin: spring-projects/spring-security

/**
 * Gets the default {@link AccessDeniedHandler} from the
 * {@link ExceptionHandlingConfigurer#getAccessDeniedHandler()} or create a
 * {@link AccessDeniedHandlerImpl} if not available.
 *
 * @param http the {@link HttpSecurityBuilder}
 * @return the {@link AccessDeniedHandler}
 */
@SuppressWarnings("unchecked")
private AccessDeniedHandler getDefaultAccessDeniedHandler(H http) {
  ExceptionHandlingConfigurer<H> exceptionConfig = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  AccessDeniedHandler handler = null;
  if (exceptionConfig != null) {
    handler = exceptionConfig.getAccessDeniedHandler();
  }
  if (handler == null) {
    handler = new AccessDeniedHandlerImpl();
  }
  return handler;
}
origin: spring-projects/spring-security

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http
      .authorizeRequests()
        .anyRequest().denyAll()
        .and()
      .exceptionHandling()
        .defaultAccessDeniedHandlerFor(
            this.teapotDeniedHandler,
            new AntPathRequestMatcher("/hello/**"))
        .defaultAccessDeniedHandlerFor(
            new AccessDeniedHandlerImpl(),
            AnyRequestMatcher.INSTANCE);
    // @formatter:on
  }
}
origin: spring-projects/spring-security

@Override
protected void configure(HttpSecurity http) throws Exception {
  // @formatter:off
  http
    .authorizeRequests()
      .anyRequest().denyAll()
      .and()
    .exceptionHandling()
      .defaultAccessDeniedHandlerFor(new AccessDeniedHandlerImpl(), request -> false)
      .and()
    .httpBasic()
      .and()
    .oauth2ResourceServer()
      .jwt();
  // @formatter:on
}
origin: geoserver/geoserver

ExceptionTranslationFilter filter = new ExceptionTranslationFilter(ep, cache);
AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
origin: org.springframework.security/spring-security-config

private AccessDeniedHandler createDefaultDeniedHandler(H http) {
  if (this.defaultDeniedHandlerMappings.isEmpty()) {
    return new AccessDeniedHandlerImpl();
  }
  if (this.defaultDeniedHandlerMappings.size() == 1) {
    return this.defaultDeniedHandlerMappings.values().iterator().next();
  }
  return new RequestMatcherDelegatingAccessDeniedHandler(
      this.defaultDeniedHandlerMappings,
      new AccessDeniedHandlerImpl());
}
origin: org.springframework.security/spring-security-config

/**
 * Shortcut to specify the {@link AccessDeniedHandler} to be used is a specific error
 * page
 *
 * @param accessDeniedUrl the URL to the access denied page (i.e. /errors/401)
 * @return the {@link ExceptionHandlingConfigurer} for further customization
 * @see AccessDeniedHandlerImpl
 * @see #accessDeniedHandler(org.springframework.security.web.access.AccessDeniedHandler)
 */
public ExceptionHandlingConfigurer<H> accessDeniedPage(String accessDeniedUrl) {
  AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
  accessDeniedHandler.setErrorPage(accessDeniedUrl);
  return accessDeniedHandler(accessDeniedHandler);
}
origin: org.springframework.security/spring-security-config

/**
 * Gets the default {@link AccessDeniedHandler} from the
 * {@link ExceptionHandlingConfigurer#getAccessDeniedHandler()} or create a
 * {@link AccessDeniedHandlerImpl} if not available.
 *
 * @param http the {@link HttpSecurityBuilder}
 * @return the {@link AccessDeniedHandler}
 */
@SuppressWarnings("unchecked")
private AccessDeniedHandler getDefaultAccessDeniedHandler(H http) {
  ExceptionHandlingConfigurer<H> exceptionConfig = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  AccessDeniedHandler handler = null;
  if (exceptionConfig != null) {
    handler = exceptionConfig.getAccessDeniedHandler();
  }
  if (handler == null) {
    handler = new AccessDeniedHandlerImpl();
  }
  return handler;
}
origin: apache/servicemix-bundles

private AccessDeniedHandler createDefaultDeniedHandler(H http) {
  if (this.defaultDeniedHandlerMappings.isEmpty()) {
    return new AccessDeniedHandlerImpl();
  }
  if (this.defaultDeniedHandlerMappings.size() == 1) {
    return this.defaultDeniedHandlerMappings.values().iterator().next();
  }
  return new RequestMatcherDelegatingAccessDeniedHandler(
      this.defaultDeniedHandlerMappings,
      new AccessDeniedHandlerImpl());
}
origin: org.springframework.security/spring-security-javaconfig

/**
 * Shortcut to specify the {@link AccessDeniedHandler} to be used is a specific error page
 *
 * @param accessDeniedUrl the URL to the access denied page (i.e. /errors/401)
 * @return the {@link ExceptionHandlingConfigurer} for further customization
 * @see AccessDeniedHandlerImpl
 * @see {@link #accessDeniedHandler(org.springframework.security.web.access.AccessDeniedHandler)}
 */
public ExceptionHandlingConfigurer<H> accessDeniedPage(String accessDeniedUrl) {
  AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
  accessDeniedHandler.setErrorPage(accessDeniedUrl);
  return accessDeniedHandler(accessDeniedHandler);
}
origin: apache/servicemix-bundles

/**
 * Shortcut to specify the {@link AccessDeniedHandler} to be used is a specific error
 * page
 *
 * @param accessDeniedUrl the URL to the access denied page (i.e. /errors/401)
 * @return the {@link ExceptionHandlingConfigurer} for further customization
 * @see AccessDeniedHandlerImpl
 * @see #accessDeniedHandler(org.springframework.security.web.access.AccessDeniedHandler)
 */
public ExceptionHandlingConfigurer<H> accessDeniedPage(String accessDeniedUrl) {
  AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
  accessDeniedHandler.setErrorPage(accessDeniedUrl);
  return accessDeniedHandler(accessDeniedHandler);
}
origin: stackoverflow.com

 @Order(1)
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

  //
  // ...
  //

  @Override
  protected void configure(HttpSecurity http) throws Exception {

    http.exceptionHandling().accessDeniedHandler(new AccessDeniedHandlerImpl() {
      @Override
      public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
        super.handle(request, response, accessDeniedException);
        accessDeniedException.printStackTrace();
      }
    });

    //
    // ...
    //

  }

}
origin: stackoverflow.com

 public class MyAccessDeniedHandler implements AccessDeniedHandler {

  private AccessDeniedHandlerImpl accessDeniedHandlerImpl = new AccessDeniedHandlerImpl();

  public void handle(HttpServletRequest request, HttpServletResponse response,
      AccessDeniedException accessDeniedException) throws IOException, ServletException {

    //Some CSRF related code 

    // Then call accessDeniedHandlerImpl.handle to handle request
    accessDeniedHandlerImpl.handle(request, response, accessDeniedException);
  }

  /**
   * The error page to use. Must begin with a "/" and is interpreted relative to the current context root.
   *
   * @param errorPage the dispatcher path to display
   *
   * @throws IllegalArgumentException if the argument doesn't comply with the above limitations
   * @see AccessDeniedHandlerImpl#setErrorPage(String)
   */
  public void setErrorPage(String errorPage) {
    // You can set custom error page here 
    accessDeniedHandlerImpl.setErrorPage(errorPage);
  }
}
origin: apache/servicemix-bundles

/**
 * Gets the default {@link AccessDeniedHandler} from the
 * {@link ExceptionHandlingConfigurer#getAccessDeniedHandler()} or create a
 * {@link AccessDeniedHandlerImpl} if not available.
 *
 * @param http the {@link HttpSecurityBuilder}
 * @return the {@link AccessDeniedHandler}
 */
@SuppressWarnings("unchecked")
private AccessDeniedHandler getDefaultAccessDeniedHandler(H http) {
  ExceptionHandlingConfigurer<H> exceptionConfig = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  AccessDeniedHandler handler = null;
  if (exceptionConfig != null) {
    handler = exceptionConfig.getAccessDeniedHandler();
  }
  if (handler == null) {
    handler = new AccessDeniedHandlerImpl();
  }
  return handler;
}
origin: socialsignin/spring-social-security

 = new AccessDeniedHandlerImpl();
request.setAttribute(REQUIRED_PROVIDERS_REQUEST_ATTRIBUTE_NAME, requiredProviderIds);
providerSpecificAccessDeniedHandler.setErrorPage(connectWithProviderUrlPrefix + "/" + requiredProviderIds.iterator().next());
   = new AccessDeniedHandlerImpl();
  defaultAccessDeniedHandler.setErrorPage(defaultAccessDeniedUrl);
  defaultAccessDeniedHandler.handle(request, response, accessDeniedException);
origin: stackoverflow.com

exceptionTranslationFilter.setAccessDeniedHandler(new AccessDeniedHandlerImpl());
exceptionTranslationFilter.afterPropertiesSet();
origin: stackoverflow.com

ExceptionTranslationFilter exceptionTranslationFilter = new ExceptionTranslationFilter(
    new LoginUrlAuthenticationEntryPoint("/login"));
AccessDeniedHandlerImpl accessDeniedHandlerImpl = new AccessDeniedHandlerImpl();
accessDeniedHandlerImpl.setErrorPage("/exception");
exceptionTranslationFilter
org.springframework.security.web.accessAccessDeniedHandlerImpl<init>

Popular methods of AccessDeniedHandlerImpl

  • setErrorPage
  • handle

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now