mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 09:12:14 +00:00
Polish AbstractAuthenticationTargetUrlRequestHandler
PR gh-16557 Signed-off-by: Max Batischev <mblancer@mail.ru>
This commit is contained in:
parent
56d255018c
commit
c7673e8f2f
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -195,8 +195,10 @@ public abstract class AbstractAuthenticationTargetUrlRequestHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows overriding of the behaviour when redirecting to a target URL.
|
* Allows overriding of the behaviour when redirecting to a target URL.
|
||||||
|
* @param redirectStrategy {@link RedirectStrategy} to use
|
||||||
*/
|
*/
|
||||||
public void setRedirectStrategy(RedirectStrategy redirectStrategy) {
|
public void setRedirectStrategy(RedirectStrategy redirectStrategy) {
|
||||||
|
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
|
||||||
this.redirectStrategy = redirectStrategy;
|
this.redirectStrategy = redirectStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@ import org.springframework.mock.web.MockHttpServletRequest;
|
|||||||
import org.springframework.mock.web.MockHttpServletResponse;
|
import org.springframework.mock.web.MockHttpServletResponse;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Dayan Kodippily
|
* @author Dayan Kodippily
|
||||||
@ -108,4 +109,9 @@ public class AbstractAuthenticationTargetUrlRequestHandlerTests {
|
|||||||
assertThat(this.handler.determineTargetUrl(this.request, this.response)).isEqualTo(DEFAULT_TARGET_URL);
|
assertThat(this.handler.determineTargetUrl(this.request, this.response)).isEqualTo(DEFAULT_TARGET_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void setRedirectStrategyWhenGivenNullThenThrowsException() {
|
||||||
|
assertThatIllegalArgumentException().isThrownBy(() -> this.handler.setRedirectStrategy(null));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user