Skip to content

Add Support for AuthenticationConverter to AbstractAuthenticationProcessingFilter #16793

@jzheaux

Description

@jzheaux

The primary reason for classes needing to override attemptAuthentication is that AbstractAuthenticationProcessingFilter doesn't have a way to get the authentication request to then pass it AuthenticationManager.

Adding AuthenticationConverter will allow applications to favor composition over inheritance by giving a default implementation of attemptAuthentication:

Authentication authentication = this.authenticationConverter.convert(request);
if (authentication == null) {
	return null;
}
Authentication result = this.authenticationManager.authenticate(authentication);
if (result == null) {
	throw new ServletException("AuthenticationManager should not return null Authentication object.");
}
return result;

This is the same implementation of attemptAuthentication as AuthenticationFilter.

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions