why Spring Security Exception Translation Filter creates 403 Response Code for default configuration -


i pretty new spring security land. using programmatic configuration of spring security servletapi() pretty neat.

here configuration:

  @override    protected void configure(httpsecurity http) throws exception {       http          .securitycontext().and()          .servletapi().and()          .authorizeurls()          .antmatchers("/login").permitall()          .antmatchers("/").permitall()          .antmatchers("/**").authenticated();    } 

i using http servlet api login not using filter this.

in case unauthorised request, exceptiontranslationfilter uses http403entryforbiddenentrypoint return 403 forbidden status.

in scenario:

  1. if user not authenticated, 401 status code should return.
  2. if user authenticated not authorised, 403 status code should return.

but default configuration creates 403 status both case.

here questions:

  1. why default entry point http403entryforbiddenentrypoint? can 401?
  2. if change http403entryforbiddenentrypoint http401entryforbiddenentrypoint, create problem?

thanks


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -