-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add security-constraint to web.xml #5827
Conversation
SonarCloud Quality Gate failed. 0 Bugs 63.2% Coverage The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
@@ -103,8 +115,13 @@ private void addEndpoints(List<String> urlMappings) { | |||
log.info("registering public endpoint with url [{}]", publicUrl); | |||
publicEndpoints.add(publicUrl); | |||
} else { |
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.
} else { | |
} else if(config.getSecurityRoles().isEmpty()) { | |
log.info("registering public endpoint with url pattern [{}]", url); | |
publicEndpoints.add(url); | |
} else { | |
log.info("registering private endpoint with url pattern [{}]", url); | |
privateEndpoints.add(url); | |
} |
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.
is de huidge opzet met in het else block weer een if/else statement echt nodig?
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.
De eerste if past de url aan, deze zet hem direct.
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.
Dat snap, ik geef ook niet de suggestie om de if's te combineren...
Naar mijn idee is het if/else statement in het else block overbodig and kan het als volgt geschreven worden:
if(url.charAt(0) == '!') {
String publicUrl = url.substring(1);
log.info("registering public endpoint with url [{}]", publicUrl);
publicEndpoints.add(publicUrl);
} else if(config.getSecurityRoles().isEmpty()) {
log.info("registering public endpoint with url pattern [{}]", url);
publicEndpoints.add(url);
} else {
log.info("registering private endpoint with url pattern [{}]", url);
privateEndpoints.add(url);
}
effectief doet dit hetzelfde...
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.
Ik denk dat
boolean isExcludedUrl = url.charAt(0) == '!';
if(isExcludedUrl || config.getSecurityRoles().isEmpty()) {
String publicUrl = isExcludedUrl ? url.substring(1) : url;
log.info("registering public endpoint with url [{}]", publicUrl);
publicEndpoints.add(publicUrl);
} else {
log.info("registering private endpoint with url pattern [{}]", url);
privateEndpoints.add(url);
}
dan misschien nog net iets netter is. Ik zal dit in een volgend pr meenemen.
No description provided.