Skip to content

BasicAuthenticationFilter could check the scheme more efficiently #6183

@jzheaux

Description

@jzheaux

BasicAuthenticationFilter checks that the Authorization header starts with the "basic" scheme:

if (header == null || !header.toLowerCase().startsWith("basic ")) {

However, this is not as efficient as it could be, since it needs to lowercase the entire header just to compare the first few characters.

org.springframework.util.StringUtils#startsWithIgnoreCase is nice for situations like these:

if (!StringUtils.startsWithIgnoreCase("basic ")) {

It would be great to do the same for the WebFlux counterpart, ServerHttpBasicAuthenticationConverter.

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)status: first-timers-onlyAn issue that can only be worked on by brand new contributorstype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions