-
Notifications
You must be signed in to change notification settings - Fork 193
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
Conversation
…meter for Server Proxy Refs: XRDDEV-1999
a17faec
to
000df85
Compare
Refs: XRDDEV-1999
Refs: XRDDEV-1999
Refs: XRDDEV-1999
Refs: XRDDEV-1999
Refs: XRDDEV-1999
import static ee.ria.xroad.common.ErrorCodes.X_CLIENT_PROXY_VERSION_NOT_SUPPORTED; | ||
|
||
@Slf4j | ||
public class ClientProxyVersionCheck { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public class ClientProxyVersionCheck { | |
public class ClientProxyVersionVerifier { |
.orElse(null); | ||
} | ||
|
||
void check(HttpServletRequest request) { |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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?
Refs: XRDDEV-1999
Refs: XRDDEV-1999