Package org.springframework.security.web.authentication.www

# Class BasicAuthenticationConverter

java.lang.Object
org.springframework.security.web.authentication.www.BasicAuthenticationConverter

All Implemented Interfaces:
  `AuthenticationConverter`

public class BasicAuthenticationConverter extends Object implements AuthenticationConverter
Converts from a HttpServletRequest to `UsernamePasswordAuthenticationToken` that can be authenticated. Null authentication possible if there was no Authorization header with Basic authentication scheme.

Since:
  5.2.0

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`AUTHENTICATION_SCHEME_BASIC`

## Constructor Summary

Constructors
Constructor
Description
`BasicAuthenticationConverter()`
`BasicAuthenticationConverter(org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?> authenticationDetailsSource)`

## Method Summary

Modifier and Type
Method
Description
`org.springframework.security.authentication.UsernamePasswordAuthenticationToken`
`convert(jakarta.servlet.http.HttpServletRequest request)`
`org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?>`
`getAuthenticationDetailsSource()`
`Charset`
`getCredentialsCharset()`
`protected Charset`
`getCredentialsCharset(jakarta.servlet.http.HttpServletRequest request)`
`void`
`setAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?> authenticationDetailsSource)`
`void`
`setCredentialsCharset(Charset credentialsCharset)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### AUTHENTICATION_SCHEME_BASIC

public static final String AUTHENTICATION_SCHEME_BASIC

See Also:
  - Constant Field Values

## Constructor Details

### BasicAuthenticationConverter

public BasicAuthenticationConverter()

### BasicAuthenticationConverter

public BasicAuthenticationConverter(org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?> authenticationDetailsSource)

## Method Details

### getCredentialsCharset

public Charset getCredentialsCharset()

### setCredentialsCharset

public void setCredentialsCharset(Charset credentialsCharset)

### getAuthenticationDetailsSource

public org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?> getAuthenticationDetailsSource()

### setAuthenticationDetailsSource

public void setAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<jakarta.servlet.http.HttpServletRequest,?> authenticationDetailsSource)

### convert

public org.springframework.security.authentication.UsernamePasswordAuthenticationToken convert(jakarta.servlet.http.HttpServletRequest request)

Specified by:
  `convert` in interface `AuthenticationConverter`

### getCredentialsCharset

protected Charset getCredentialsCharset(jakarta.servlet.http.HttpServletRequest request)