Skip to content

Commit

Permalink
fix: code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasLohoff committed May 2, 2024
1 parent 32619fa commit c819531
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class AuthController {

@GetMapping("/isSessionValid")
public ResponseEntity<?> isSessionValid(Authentication authentication) {
public ResponseEntity<String> isSessionValid(Authentication authentication) {
log.debug("Checking if user is logged in.");

if (authentication != null && authentication.isAuthenticated()) {
Expand Down
6 changes: 3 additions & 3 deletions shogun-boot/src/main/resources/templates/error/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
border-radius: 8px;
-moz-border-radius: 8px;
margin: auto 70px auto 70px;
#padding: 50px;
top: 50%;
position: absolute;
transform: translate(0, -50%);
Expand Down Expand Up @@ -86,6 +85,7 @@
margin-left: auto;
}
</style>
<title>SHOGun - Error</title>
</head>
<body>
<div id="error">
Expand All @@ -94,14 +94,14 @@
<h1>Oops!</h1>
</div>
<div class="error-code">
<p th:text="${status}"/>
<p th:text="${status}"></p>
</div>
<div class="error-text">
The page you're looking for is not available.
</div>
<div class="error-img">
<!--<img th:src="@{404.gif}"/>-->
<img src="https://media.tenor.com/images/2e7080b4048c2975ab525027a5af85f2/tenor.gif">
<img src="https://media.tenor.com/images/2e7080b4048c2975ab525027a5af85f2/tenor.gif" alt="Error">
</div>
</div>

Expand Down
12 changes: 6 additions & 6 deletions shogun-boot/src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<header
class="container d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center col-md-3 mb-2 mb-md-0 text-dark text-decoration-none">
<img class="header-image" src="./assets/img/shogun_logo.png">
<img class="header-image" src="./assets/img/shogun_logo.png" alt="SHOGun logo">
</a>
<ul class="nav col-md-3">
<li class="nav-item">
Expand Down Expand Up @@ -103,7 +103,7 @@ <h2 class="pb-2">Welcome to SHOGun</h2>
<div style="display: none" id="keycloak-host" th:text="${@environment.getProperty('KEYCLOAK_HOST')}"></div>
<a href="/admin">
<button id="admin-panel-btn" class="btn btn-primary">
Open Admin Panel <i class="fas fa-lock"></i>
Open Admin Panel <em class="fas fa-lock"></em>
</button>
</a>
<h3 class="pb-2 pt-4">Applications</h3>
Expand All @@ -117,15 +117,15 @@ <h3 class="pb-2 pt-4">Applications</h3>
&copy; 2021 - present <a href="https://www.terrestris.de">terrestris GmbH & Co. KG</a>
</p>
<p class="col-md-3 mb-0 text-muted">
<i class="fas fa-plug"></i>
<em class="fas fa-plug"></em>
<a href="./swagger-ui/index.html">Swagger / OpenAPI</a>
</p>
<p class="col-md-3 mb-0 text-muted">
<i class="fas fa-project-diagram"></i>
<em class="fas fa-project-diagram"></em>
<a href="./graphiql">GraphiQL</a>
</p>
<p class="col-md-3 mb-0 text-muted">
<i class="fab fa-github"></i>
<em class="fab fa-github"></em>
<a href="https://github.com/terrestris/shogun">GitHub</a>
</p>
</footer>
Expand Down Expand Up @@ -191,7 +191,7 @@ <h3 class="pb-2 pt-4">Applications</h3>
appInfos.forEach(app => {
const html = `<shogun-app app='${app.id}'>` +
`<a style='visibility: hidden' class='admin-btn' title='Edit application' slot='admin-btn' href='/admin/portal/application/${app.id}'>` +
`<i class='fas fa-cog'></i></a>` +
`<em class='fas fa-cog'></em></a>` +
`<span slot='app-title'>${app.name}</span>` +
`<span slot='app-info'>${app.description}</span>` +
`</shogun-app>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class GeoServerInterceptorController {
protected GeoServerInterceptorService service;

@RequestMapping(value = {"/geoserver.action", "/geoserver.action/{endpoint}"}, method = {RequestMethod.GET, RequestMethod.POST})
public ResponseEntity<?> interceptGeoServerRequest(HttpServletRequest request, Optional<String> endpoint) {
public ResponseEntity<byte[]> interceptGeoServerRequest(HttpServletRequest request, Optional<String> endpoint) {
HttpHeaders responseHeaders = new HttpHeaders();
HttpStatus responseStatus;
byte[] responseBody;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Part;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -65,6 +66,7 @@ public class HttpUtil {
/**
* The timeout for all outgoing HTTP connections.
*/
@Getter
private static int httpTimeout;
/**
* The default timeout given by the config beans.
Expand All @@ -76,14 +78,14 @@ public class HttpUtil {
private static String AUTHORIZATION_HEADER = "authorization";

/**
* Returns the full webapplication URI from a given request.
* Returns the full web application URI from a given request.
* <p>
* Example:
* <p>
* The following GET-request:
* http://localhost:8080/shogun/user/resetPassword.action
* <a href="http://localhost:8080/shogun/user/resetPassword.action">...</a>
* will result in
* http://localhost:8080/shogun/
* <a href="http://localhost:8080/shogun/">...</a>
*
* @param request
* @return
Expand Down Expand Up @@ -2185,13 +2187,6 @@ private static HttpHost getSystemProxy(URI uri) throws UnknownHostException {
return systemProxy;
}

/**
* @return the httpTimeout
*/
public static int getHttpTimeout() {
return httpTimeout;
}

/**
* @param httpTimeout the httpTimeout to set
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public GroupRepresentation addGroup(String groupName) throws WebApplicationExcep
if (!availableGroups.isEmpty()) {
log.debug("Group {} already exists.", groupName);

return availableGroups.get(0);
return availableGroups.getFirst();
}

GroupRepresentation group = new GroupRepresentation();
Expand Down

0 comments on commit c819531

Please sign in to comment.