fix code smells

This commit is contained in:
verboomp
2026-01-21 09:40:43 +01:00
parent 2c14caa6ca
commit 47ee7c3c25
5 changed files with 12 additions and 29 deletions

View File

@@ -9,7 +9,7 @@
<relativePath>../hartmann-foto-documentation/pom.xml</relativePath>
</parent>
<artifactId>hartmann-foto-documentation-app</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hartmann-foto-documentation app</name>
<build>
@@ -42,17 +42,17 @@
<!-- Elytron secrity used for username/password login -->
<dependency>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron</artifactId>
<version>2.5.2.Final</version>
<scope>provided</scope>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron</artifactId>
<version>2.5.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron-credential</artifactId>
<version>2.5.2.Final</version>
<scope>provided</scope>
<groupId>org.wildfly.security</groupId>
<artifactId>wildfly-elytron-credential</artifactId>
<version>2.5.2.Final</version>
<scope>provided</scope>
</dependency>
<!-- Apache POI -->

View File

@@ -2,7 +2,6 @@ package marketing.heyday.hartmann.fotodocumentation.core.utils;
import java.nio.charset.Charset;
import java.security.Principal;
import java.util.Optional;
import org.apache.commons.codec.binary.Base64;
@@ -42,14 +41,6 @@ public class LoginUtils {
return authenticate(userPass._1, userPass._2);
}
public Optional<String> getSecurityToken(HttpServletRequest httpServletRequest) {
Optional<String[]> headerOpt = extractAuthHeader(httpServletRequest);
if (headerOpt.isPresent() && headerOpt.get().length > 2) {
return Optional.ofNullable(headerOpt.get()[2]);
}
return Optional.empty();
}
private Optional<SecurityIdentity> authenticate(String username, String password) {
try {
Principal principal = new NamePrincipal(username);

View File

@@ -55,7 +55,7 @@ public class CustomerPictureResource {
Optional<SecurityIdentity> identity = loginUtils.authenticate(httpServletRequest);
if (identity.isEmpty()) {
LOG.debug("identity empty login invalid");
return Response.status(401).build();
return Response.status(Status.UNAUTHORIZED).build();
}