Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce "minimum supported Client version" configuration parameter for Server Proxy #1741

Merged
merged 10 commits into from
Aug 28, 2023

Conversation

andresrosenthal
Copy link
Contributor

Refs: XRDDEV-1999

@enelir enelir self-requested a review August 25, 2023 05:01
@enelir enelir marked this pull request as ready for review August 25, 2023 05:02
Refs: XRDDEV-1999
import static ee.ria.xroad.common.ErrorCodes.X_CLIENT_PROXY_VERSION_NOT_SUPPORTED;

@Slf4j
public class ClientProxyVersionCheck {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public class ClientProxyVersionCheck {
public class ClientProxyVersionVerifier {

.orElse(null);
}

void check(HttpServletRequest request) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this class does seem like an utility class I think this method should should be made static.
Note that then there's no need to inject an instance of this class to ServerProxyHandler


void check(HttpServletRequest request) {
String clientVersion = getVersion(request.getHeader(MimeUtils.HEADER_PROXY_VERSION));
String thisVersion = getVersion(ProxyMain.readProxyVersion());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line could be moved to the line just before the if (!clientVersion.equals(thisVersion)) { check, where thisVersion variable is used for the first time.

when(request.getHeader(MimeUtils.HEADER_PROXY_VERSION)).thenReturn(CLIENT_VERSION_6_26_3);
clientProxyVersionCheck = new ClientProxyVersionCheck();

assertThrows(CodedException.class, () -> clientProxyVersionCheck.check(request));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also assert exception's message?

@enelir enelir merged commit 0b59049 into develop Aug 28, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants