Use Server<Description>AuthenticationConverter
Issue gh-4615
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class FormLoginAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
public class ServerFormLoginAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
|
||||
private String usernameParameter = "username";
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import reactor.core.publisher.Mono;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class HttpBasicAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
public class ServerHttpBasicAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
|
||||
public static final String BASIC = "Basic ";
|
||||
|
||||
+2
-3
@@ -23,8 +23,7 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.security.authentication.ReactiveAuthenticationManager;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextImpl;
|
||||
import org.springframework.security.web.server.AuthenticationEntryPoint;
|
||||
import org.springframework.security.web.server.HttpBasicAuthenticationConverter;
|
||||
import org.springframework.security.web.server.ServerHttpBasicAuthenticationConverter;
|
||||
import org.springframework.security.web.server.WebFilterExchange;
|
||||
import org.springframework.security.web.server.authentication.www.HttpBasicAuthenticationEntryPoint;
|
||||
import org.springframework.security.web.server.context.SecurityContextRepository;
|
||||
@@ -48,7 +47,7 @@ public class AuthenticationWebFilter implements WebFilter {
|
||||
|
||||
private AuthenticationSuccessHandler authenticationSuccessHandler = new WebFilterChainAuthenticationSuccessHandler();
|
||||
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new HttpBasicAuthenticationConverter();
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
|
||||
|
||||
private AuthenticationFailureHandler authenticationFailureHandler = new AuthenticationEntryPointFailureHandler(new HttpBasicAuthenticationEntryPoint());
|
||||
|
||||
|
||||
+2
-2
@@ -35,13 +35,13 @@ import static org.mockito.Mockito.when;
|
||||
* @since 5.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class FormLoginAuthenticationConverterTests {
|
||||
public class ServerFormLoginAuthenticationConverterTests {
|
||||
@Mock
|
||||
private ServerWebExchange exchange;
|
||||
|
||||
private MultiValueMap<String,String> data = new LinkedMultiValueMap<>();
|
||||
|
||||
private FormLoginAuthenticationConverter converter = new FormLoginAuthenticationConverter();
|
||||
private ServerFormLoginAuthenticationConverter converter = new ServerFormLoginAuthenticationConverter();
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
+2
-3
@@ -22,7 +22,6 @@ import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -30,9 +29,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class HttpBasicAuthenticationConverterTests {
|
||||
public class ServerHttpBasicAuthenticationConverterTests {
|
||||
|
||||
HttpBasicAuthenticationConverter converter = new HttpBasicAuthenticationConverter();
|
||||
ServerHttpBasicAuthenticationConverter converter = new ServerHttpBasicAuthenticationConverter();
|
||||
MockServerHttpRequest.BaseBuilder<?> request = MockServerHttpRequest.get("/");
|
||||
|
||||
@Test
|
||||
Reference in New Issue
Block a user