Tabnine Logo
Http403ForbiddenEntryPoint
Code IndexAdd Tabnine to your IDE (free)

How to use
Http403ForbiddenEntryPoint
in
org.springframework.security.web.authentication

Best Java code snippets using org.springframework.security.web.authentication.Http403ForbiddenEntryPoint (Showing top 20 results out of 315)

origin: geoserver/geoserver

@Override
public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException {
  super.initializeFromConfig(config);
  aep = new Http403ForbiddenEntryPoint();
}
origin: spring-projects/spring-flex

  super.commence(request, response, authException);
  return;
} catch (HttpMessageNotReadableException ex) {
  log.info("Authentication failure detected, but request could not be read as AMF.", ex);
  super.commence(request, response, authException);
  return;
super.commence(request, response, authException);
origin: spring-projects/spring-security

private AuthenticationEntryPoint createDefaultEntryPoint(H http) {
  if (this.defaultEntryPointMappings.isEmpty()) {
    return new Http403ForbiddenEntryPoint();
  }
  if (this.defaultEntryPointMappings.size() == 1) {
    return this.defaultEntryPointMappings.values().iterator().next();
  }
  DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(
      this.defaultEntryPointMappings);
  entryPoint.setDefaultEntryPoint(this.defaultEntryPointMappings.values().iterator()
      .next());
  return entryPoint;
}
origin: geoserver/geoserver

@Override
public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException {
  super.initializeFromConfig(config);
  aep = new Http403ForbiddenEntryPoint();
  CredentialsFromRequestHeaderFilterConfig authConfig =
      (CredentialsFromRequestHeaderFilterConfig) config;
  userNameHeaderName = authConfig.getUserNameHeaderName();
  passwordHeaderName = authConfig.getPasswordHeaderName();
  userNameRegex = Pattern.compile(authConfig.getUserNameRegex());
  passwordRegex = Pattern.compile(authConfig.getPasswordRegex());
  decodeURI = authConfig.isParseAsUriComponents();
  // digest used to create a cacheKey containing the user password
  try {
    digest = MessageDigest.getInstance("MD5");
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("No MD5 algorithm available!");
  }
}
origin: spring-projects/spring-security

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
// @formatter:on
origin: spring-projects/spring-security

/**
 * Populates a {@link PreAuthenticatedAuthenticationProvider} into
 * {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
 * and a {@link Http403ForbiddenEntryPoint} into
 * {@link HttpSecurityBuilder#setSharedObject(Class, Object)}
 *
 * @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
 */
@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider
      .setPreAuthenticatedUserDetailsService(getUserDetailsService());
  authenticationProvider = postProcess(authenticationProvider);
  // @formatter:off
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
  // @formatter:on
}
origin: psi-probe/psi-probe

/**
 * Gets the http 403 forbidden entry point.
 *
 * @return the http 403 forbidden entry point
 */
@Bean(name = "preAuthenticatedProcessingFilterEntryPoint")
public Http403ForbiddenEntryPoint getHttp403ForbiddenEntryPoint() {
 return new Http403ForbiddenEntryPoint();
}
origin: org.springframework.security/spring-security-config

private AuthenticationEntryPoint createDefaultEntryPoint(H http) {
  if (this.defaultEntryPointMappings.isEmpty()) {
    return new Http403ForbiddenEntryPoint();
  }
  if (this.defaultEntryPointMappings.size() == 1) {
    return this.defaultEntryPointMappings.values().iterator().next();
  }
  DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(
      this.defaultEntryPointMappings);
  entryPoint.setDefaultEntryPoint(this.defaultEntryPointMappings.values().iterator()
      .next());
  return entryPoint;
}
origin: org.springframework.security/spring-security-config

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
// @formatter:on
origin: org.springframework.security/spring-security-config

/**
 * Populates a {@link PreAuthenticatedAuthenticationProvider} into
 * {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
 * and a {@link Http403ForbiddenEntryPoint} into
 * {@link HttpSecurityBuilder#setSharedObject(Class, Object)}
 *
 * @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
 */
@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider
      .setPreAuthenticatedUserDetailsService(getUserDetailsService());
  authenticationProvider = postProcess(authenticationProvider);
  // @formatter:off
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
  // @formatter:on
}
origin: stackoverflow.com

 .invalidateHttpSession(true)
.and()
.exceptionHandling()
.authenticationEntryPoint(new Http403ForbiddenEntryPoint())
.and()
.csrf()//Disabled CSRF protection
.disable();
origin: stackoverflow.com

static HttpSecurity configureHttpSec(HttpSecurity http, String urlBase) throws Exception {
 http   .csrf().disable()
     .exceptionHandling().authenticationEntryPoint(new Http403ForbiddenEntryPoint())
 .and() .antMatchers(urlBase+"/**").authorizeRequests().anyRequest().authenticated()
 .and() .httpBasic()
 .and() .logout().logoutUrl(urlBase+"/logout").logoutSuccessHandler((req,resp,auth) -> {})
 ;
 return http;
}
origin: stackoverflow.com

 @Override
protected void configure(HttpSecurity http) throws Exception {
http
  .formLogin()
    ...
    .successHandler(your authentication success handler object)
    .failureHandler(your authentication failure handler object)
    .and()
  .logout()
    ...
    .logoutSuccessHandler(your logout success handler object)
    .and()
  .exceptionHandling()
    .authenticationEntryPoint(new Http403ForbiddenEntryPoint())
  ...
}
origin: apache/servicemix-bundles

private AuthenticationEntryPoint createDefaultEntryPoint(H http) {
  if (this.defaultEntryPointMappings.isEmpty()) {
    return new Http403ForbiddenEntryPoint();
  }
  if (this.defaultEntryPointMappings.size() == 1) {
    return this.defaultEntryPointMappings.values().iterator().next();
  }
  DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(
      this.defaultEntryPointMappings);
  entryPoint.setDefaultEntryPoint(this.defaultEntryPointMappings.values().iterator()
      .next());
  return entryPoint;
}
origin: org.springframework.security/spring-security-javaconfig

/**
 * Gets the {@link AuthenticationEntryPoint} according to the rules specified by {@link #authenticationEntryPoint(AuthenticationEntryPoint)}
 * @param http the {@link HttpSecurity} used to look up shared {@link AuthenticationEntryPoint}
 * @return the {@link AuthenticationEntryPoint} to use
 */
private AuthenticationEntryPoint getEntryPoint(H http) {
  AuthenticationEntryPoint entryPoint = this.authenticationEntryPoint;
  if(entryPoint == null) {
    AuthenticationEntryPoint sharedEntryPoint = http.getSharedObject(AuthenticationEntryPoint.class);
    if(sharedEntryPoint != null) {
      entryPoint = sharedEntryPoint;
    } else {
      entryPoint = new Http403ForbiddenEntryPoint();
    }
  }
  return entryPoint;
}
origin: stackoverflow.com

 @Configuration
@Order(1)
public static class ApiLoginWebSecurityConfigurationAdapter extends
    WebSecurityConfigurerAdapter {

  @Autowired
  private Http403ForbiddenEntryPoint forbiddenEntryPoint;

  @Bean
  public Http403ForbiddenEntryPoint forbiddenEntryPoint() {
    return new Http403ForbiddenEntryPoint();
  }

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http.antMatcher("/api/**")
        .authorizeRequests()
        .anyRequest().fullyAuthenticated()
      .and()
        .httpBasic()
        .authenticationEntryPoint(forbiddenEntryPoint)
      .and()
        .csrf().disable();
    // @formatter:on
  }
}
origin: naturalprogrammer/spring-lemon

/**
 * Configures exception-handling
 */
protected void exceptionHandling(HttpSecurity http) throws Exception {
  
  http
  .exceptionHandling()
  
    /***********************************************
     * To prevent redirection to the login page
     * when someone tries to access a restricted page
     **********************************************/
    .authenticationEntryPoint(new Http403ForbiddenEntryPoint());
}
origin: spring-cloud/spring-cloud-gcp

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http
        .authorizeRequests().antMatchers("/topsecret").authenticated()
        .and()
        .oauth2ResourceServer()
          .jwt()
          .and()
          .authenticationEntryPoint(new Http403ForbiddenEntryPoint());
  }
}
origin: stackoverflow.com

.and()
.exceptionHandling()
.authenticationEntryPoint(new Http403ForbiddenEntryPoint())
.and()
origin: stackoverflow.com

final LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> map = new LinkedHashMap();
map.put(new AntPathRequestMatcher("/"), new LoginUrlAuthenticationEntryPoint("/login"));
map.put(new AntPathRequestMatcher("/api_v1/**"), new Http403ForbiddenEntryPoint());
org.springframework.security.web.authenticationHttp403ForbiddenEntryPoint

Javadoc

In the pre-authenticated authentication case (unlike CAS, for example) the user will already have been identified through some external mechanism and a secure context established by the time the security-enforcement filter is invoked.

Therefore this class isn't actually responsible for the commencement of authentication, as it is in the case of other providers. It will be called if the user is rejected by the AbstractPreAuthenticatedProcessingFilter, resulting in a null authentication.

The commence method will always return an HttpServletResponse.SC_FORBIDDEN (403 error).

Most used methods

  • <init>
  • commence
    Always returns a 403 error code to the client.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Best IntelliJ plugins
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