congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
HttpSecurityBuilder.getConfigurer
Code IndexAdd Tabnine to your IDE (free)

How to use
getConfigurer
method
in
org.springframework.security.config.annotation.web.HttpSecurityBuilder

Best Java code snippets using org.springframework.security.config.annotation.web.HttpSecurityBuilder.getConfigurer (Showing top 20 results out of 315)

origin: spring-projects/spring-security

private void registerDefaultEntryPoint(H http) {
  ExceptionHandlingConfigurer<H> exceptionHandling = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionHandling == null) {
    return;
  }
  exceptionHandling.defaultAuthenticationEntryPointFor(
      this.authenticationEntryPoint,
      this.requestMatcher);
}
origin: spring-projects/spring-security

private void registerDefaultCsrfOverride(H http) {
  CsrfConfigurer<H> csrf = http
      .getConfigurer(CsrfConfigurer.class);
  if (csrf == null) {
    return;
  }
  csrf.ignoringRequestMatchers(this.requestMatcher);
}
origin: spring-projects/spring-security

private void registerDefaultAccessDeniedHandler(H http) {
  ExceptionHandlingConfigurer<H> exceptionHandling = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionHandling == null) {
    return;
  }
  exceptionHandling.defaultAccessDeniedHandlerFor(
      this.accessDeniedHandler,
      this.requestMatcher);
}
origin: spring-projects/spring-security

/**
 * Gets the default {@link InvalidSessionStrategy} from the
 * {@link SessionManagementConfigurer#getInvalidSessionStrategy()} or null if not
 * available.
 *
 * @param http the {@link HttpSecurityBuilder}
 * @return the {@link InvalidSessionStrategy}
 */
@SuppressWarnings("unchecked")
private InvalidSessionStrategy getInvalidSessionStrategy(H http) {
  SessionManagementConfigurer<H> sessionManagement = http
      .getConfigurer(SessionManagementConfigurer.class);
  if (sessionManagement == null) {
    return null;
  }
  return sessionManagement.getInvalidSessionStrategy();
}
origin: spring-projects/spring-security

private void registerDefaultEntryPoint(B http, RequestMatcher preferredMatcher) {
  ExceptionHandlingConfigurer<B> exceptionHandling = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionHandling == null) {
    return;
  }
  exceptionHandling.defaultAuthenticationEntryPointFor(
      postProcess(this.authenticationEntryPoint), preferredMatcher);
}
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

@SuppressWarnings("unchecked")
protected final void registerAuthenticationEntryPoint(B http, AuthenticationEntryPoint authenticationEntryPoint) {
  ExceptionHandlingConfigurer<B> exceptionHandling = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionHandling == null) {
    return;
  }
  exceptionHandling.defaultAuthenticationEntryPointFor(
      postProcess(authenticationEntryPoint), getAuthenticationEntryPointMatcher(http));
}
origin: spring-projects/spring-security

private void registerDefaultLogoutSuccessHandler(B http, RequestMatcher preferredMatcher) {
  LogoutConfigurer<B> logout = http
      .getConfigurer(LogoutConfigurer.class);
  if (logout == null) {
    return;
  }
  LogoutConfigurer<B> handler = logout.defaultLogoutSuccessHandlerFor(
      postProcess(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.NO_CONTENT)), preferredMatcher);
}
origin: spring-projects/spring-security

@SuppressWarnings("unchecked")
public static void permitAll(
    HttpSecurityBuilder<? extends HttpSecurityBuilder<?>> http,
    RequestMatcher... requestMatchers) {
  ExpressionUrlAuthorizationConfigurer<?> configurer = http
      .getConfigurer(ExpressionUrlAuthorizationConfigurer.class);
  if (configurer == null) {
    throw new IllegalStateException(
        "permitAll only works with HttpSecurity.authorizeRequests()");
  }
  for (RequestMatcher matcher : requestMatchers) {
    if (matcher != null) {
      configurer
          .getRegistry()
          .addMapping(
              0,
              new UrlMapping(
                  matcher,
                  SecurityConfig
                      .createList(ExpressionUrlAuthorizationConfigurer.permitAll)));
    }
  }
}
origin: spring-projects/spring-security

@Override
@SuppressWarnings("unchecked")
public void configure(H http) throws Exception {
  AuthenticationEntryPoint authenticationEntryPoint = null;
  ExceptionHandlingConfigurer<?> exceptionConf = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionConf != null) {
    authenticationEntryPoint = exceptionConf.getAuthenticationEntryPoint();
  }
  if (loginPageGeneratingFilter.isEnabled() && authenticationEntryPoint == null) {
    loginPageGeneratingFilter = postProcess(loginPageGeneratingFilter);
    http.addFilter(loginPageGeneratingFilter);
    http.addFilter(this.logoutPageGeneratingFilter);
  }
}
origin: spring-projects/spring-security

/**
 * Updates the default values for authentication.
 *
 * @throws Exception
 */
protected final void updateAuthenticationDefaults() {
  if (loginProcessingUrl == null) {
    loginProcessingUrl(loginPage);
  }
  if (failureHandler == null) {
    failureUrl(loginPage + "?error");
  }
  final LogoutConfigurer<B> logoutConfigurer = getBuilder().getConfigurer(
      LogoutConfigurer.class);
  if (logoutConfigurer != null && !logoutConfigurer.isCustomLogoutSuccess()) {
    logoutConfigurer.logoutSuccessUrl(loginPage + "?logout");
  }
}
origin: spring-projects/spring-security

    new RequestHeaderRequestMatcher("X-Requested-With", "XMLHttpRequest"));
boolean isCsrfEnabled = http.getConfigurer(CsrfConfigurer.class) != null;
origin: spring-projects/spring-security

    .getSharedObject(AuthenticationManager.class));
ExceptionHandlingConfigurer<H> exceptionConf = http
    .getConfigurer(ExceptionHandlingConfigurer.class);
AuthenticationEntryPoint authenticationEntryPoint = exceptionConf == null ? null
    : exceptionConf.getAuthenticationEntryPoint(http);
securityContextRequestFilter
    .setAuthenticationEntryPoint(authenticationEntryPoint);
LogoutConfigurer<H> logoutConf = http.getConfigurer(LogoutConfigurer.class);
List<LogoutHandler> logoutHandlers = logoutConf == null ? null : logoutConf
    .getLogoutHandlers();
origin: spring-projects/spring-security

@SuppressWarnings("unchecked")
@Override
public void configure(H http) throws Exception {
  CsrfFilter filter = new CsrfFilter(this.csrfTokenRepository);
  RequestMatcher requireCsrfProtectionMatcher = getRequireCsrfProtectionMatcher();
  if (requireCsrfProtectionMatcher != null) {
    filter.setRequireCsrfProtectionMatcher(requireCsrfProtectionMatcher);
  }
  AccessDeniedHandler accessDeniedHandler = createAccessDeniedHandler(http);
  if (accessDeniedHandler != null) {
    filter.setAccessDeniedHandler(accessDeniedHandler);
  }
  LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
  if (logoutConfigurer != null) {
    logoutConfigurer
        .addLogoutHandler(new CsrfLogoutHandler(this.csrfTokenRepository));
  }
  SessionManagementConfigurer<H> sessionConfigurer = http
      .getConfigurer(SessionManagementConfigurer.class);
  if (sessionConfigurer != null) {
    sessionConfigurer.addSessionAuthenticationStrategy(
        new CsrfAuthenticationStrategy(this.csrfTokenRepository));
  }
  filter = postProcess(filter);
  http.addFilter(filter);
}
origin: spring-projects/spring-security

  @Override
  @SuppressWarnings("unchecked")
  public void configure(H http) throws Exception {

    SecurityContextRepository securityContextRepository = http
        .getSharedObject(SecurityContextRepository.class);
    if (securityContextRepository == null) {
      securityContextRepository = new HttpSessionSecurityContextRepository();
    }
    SecurityContextPersistenceFilter securityContextFilter = new SecurityContextPersistenceFilter(
        securityContextRepository);
    SessionManagementConfigurer<?> sessionManagement = http
        .getConfigurer(SessionManagementConfigurer.class);
    SessionCreationPolicy sessionCreationPolicy = sessionManagement == null ? null
        : sessionManagement.getSessionCreationPolicy();
    if (SessionCreationPolicy.ALWAYS == sessionCreationPolicy) {
      securityContextFilter.setForceEagerSessionCreation(true);
    }
    securityContextFilter = postProcess(securityContextFilter);
    http.addFilter(securityContextFilter);
  }
}
origin: spring-projects/spring-security

@SuppressWarnings("unchecked")
@Override
public void init(H http) throws Exception {
  validateInput();
  String key = getKey();
  RememberMeServices rememberMeServices = getRememberMeServices(http, key);
  http.setSharedObject(RememberMeServices.class, rememberMeServices);
  LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
  if (logoutConfigurer != null && this.logoutHandler != null) {
    logoutConfigurer.addLogoutHandler(this.logoutHandler);
  }
  RememberMeAuthenticationProvider authenticationProvider = new RememberMeAuthenticationProvider(
      key);
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: spring-projects/spring-security

  @SuppressWarnings("unchecked")
  private RequestMatcher getLogoutRequestMatcher(H http) {
    if (logoutRequestMatcher != null) {
      return logoutRequestMatcher;
    }
    if (http.getConfigurer(CsrfConfigurer.class) != null) {
      this.logoutRequestMatcher = new AntPathRequestMatcher(this.logoutUrl, "POST");
    }
    else {
      this.logoutRequestMatcher = new OrRequestMatcher(
        new AntPathRequestMatcher(this.logoutUrl, "GET"),
        new AntPathRequestMatcher(this.logoutUrl, "POST"),
        new AntPathRequestMatcher(this.logoutUrl, "PUT"),
        new AntPathRequestMatcher(this.logoutUrl, "DELETE")
      );
    }
    return this.logoutRequestMatcher;
  }
}
origin: org.springframework.security/spring-security-config

private void registerDefaultAccessDeniedHandler(H http) {
  ExceptionHandlingConfigurer<H> exceptionHandling = http
      .getConfigurer(ExceptionHandlingConfigurer.class);
  if (exceptionHandling == null) {
    return;
  }
  exceptionHandling.defaultAccessDeniedHandlerFor(
      this.accessDeniedHandler,
      this.requestMatcher);
}
origin: org.springframework.security/spring-security-config

private void registerDefaultCsrfOverride(H http) {
  CsrfConfigurer<H> csrf = http
      .getConfigurer(CsrfConfigurer.class);
  if (csrf == null) {
    return;
  }
  csrf.ignoringRequestMatchers(this.requestMatcher);
}
origin: org.springframework.security/spring-security-config

private void registerDefaultLogoutSuccessHandler(B http, RequestMatcher preferredMatcher) {
  LogoutConfigurer<B> logout = http
      .getConfigurer(LogoutConfigurer.class);
  if (logout == null) {
    return;
  }
  LogoutConfigurer<B> handler = logout.defaultLogoutSuccessHandlerFor(
      postProcess(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.NO_CONTENT)), preferredMatcher);
}
org.springframework.security.config.annotation.webHttpSecurityBuildergetConfigurer

Javadoc

Gets the SecurityConfigurer by its class name or null if not found. Note that object hierarchies are not considered.

Popular methods of HttpSecurityBuilder

  • getSharedObject
    Gets a shared Object. Note that object heirarchies are not considered.
  • addFilter
    Adds a Filter that must be an instance of or extend one of the Filters provided within the Security
  • authenticationProvider
    Allows adding an additional AuthenticationProvider to be used
  • removeConfigurer
    Removes the SecurityConfigurer by its class name ornull if not found. Note that object hierarchies a
  • setSharedObject
    Sets an object that is shared by multiple SecurityConfigurer.
  • addFilterBefore
    Allows adding a Filter before one of the known Filterclasses. The known Filter instances are either
  • getAuthenticationManager

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • startActivity (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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