@Override public void configure(HttpSecurity http) throws Exception { http.antMatcher("/ui/**").authorizeRequests().antMatchers("/ui/test") .permitAll().anyRequest().authenticated().and().exceptionHandling() .authenticationEntryPoint( new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)); }
/** * {@inheritDoc} */ @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().fullyAuthenticated() .and().httpBasic().authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED)) .and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and().csrf().disable(); }
@Bean public HttpStatusEntryPoint authenticationEntryPoint() { return new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED); }
/** * Returns the default {@link AuthenticationEntryPoint} to use * for the fallback basic HTTP authentication. * * @return The default {@link AuthenticationEntryPoint} for the * fallback HTTP basic authentication. */ @Bean(name=BASIC_AUTH_BEAN_NAME) public AuthenticationEntryPoint basicAuthenticationEntryPoint() { return new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED); }