spring-projects / spring-projects/spring-security

Restructure AuthenticationServiceException handling

Open
#12,134 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

An AuthenticationServiceException represents something that went wrong on the server side. As such, it shouldn't be handled by AuthenticationEntryPoints.

This means that likely is shouldn't be handled by ExceptionTranslationFilter or any of the authentication filters.

However, because this class extends AuthenticationException, it is required for each component to somehow opt-out of handing to its AuthenticationEntryPoint.

One way to address this is to change AuthenticationServiceException to no longer inherit from AuthenticationException. Another way would be to add a new exception like AuthenticationServerErrorException -- similar to spring-web's HttpServerErrorException -- that doesn't inherit from AuthenticationException.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how AuthenticationServiceException is handled by ExceptionTranslationFilter and the authentication filters, especially where they route AuthenticationException instances to AuthenticationEntryPoint implementations. Compare changing its inheritance with introducing an AuthenticationServerErrorException modeled on spring-web's HttpServerErrorException. Done means server-side failures are no longer routed to authentication entry points without leaving affected components inconsistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication, security
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.