added frontend
This commit is contained in:
@@ -43,6 +43,6 @@ public class CustomerPictureService extends AbstractService {
|
||||
// FIXME: do query
|
||||
List<Customer> customers = queryService.callNamedQueryList(Customer.FIND_ALL);
|
||||
customers.forEach(c -> c.getPictures().size());
|
||||
return customers.parallelStream().map(c -> CustomerListValue.builder(c)).toList();
|
||||
return customers.parallelStream().map(CustomerListValue::builder).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ public class JwtTokenUtil {
|
||||
private static final long REFRESH_TOKEN_VALIDITY = 30 * 24 * 60 * 60 * 1000L; // 30 days
|
||||
private static final long TEMP_2FA_TOKEN_VALIDITY = 5 * 60 * 1000L; // 5 minutes
|
||||
|
||||
private static final String ISSUER = "skillmatrix-jwt-issuer";
|
||||
private static final String AUDIENCE = "skillmatrix-api";
|
||||
private static final String ISSUER = "foto-jwt-issuer";
|
||||
private static final String AUDIENCE = "foto-api";
|
||||
|
||||
private PrivateKey privateKey;
|
||||
private PublicKey publicKey;
|
||||
|
||||
@@ -43,13 +43,13 @@ public class LoginUtils {
|
||||
|
||||
private Optional<SecurityIdentity> authenticate(String username, String password) {
|
||||
try {
|
||||
LOG.error("Login with username: " + username + " password: " + password);
|
||||
LOG.debug("Login with username & password " + username);
|
||||
Principal principal = new NamePrincipal(username);
|
||||
PasswordGuessEvidence evidence = new PasswordGuessEvidence(password.toCharArray());
|
||||
|
||||
SecurityDomain sd = SecurityDomain.getCurrent();
|
||||
SecurityIdentity identity = sd.authenticate(principal, evidence);
|
||||
LOG.error("Login identity: " + identity);
|
||||
LOG.debug("Login identity: " + identity);
|
||||
return Optional.ofNullable(identity);
|
||||
} catch (RealmUnavailableException | SecurityException e) {
|
||||
LOG.warn("Failed to authenticate user " + e.getMessage(), e);
|
||||
|
||||
@@ -22,6 +22,7 @@ import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.Context;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.core.Response.Status;
|
||||
import marketing.heyday.hartmann.fotodocumentation.core.service.LoginService;
|
||||
import marketing.heyday.hartmann.fotodocumentation.core.utils.LoginUtils;
|
||||
import marketing.heyday.hartmann.fotodocumentation.rest.vo.TokenPairValue;
|
||||
@@ -58,7 +59,7 @@ public class LoginResource {
|
||||
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();
|
||||
}
|
||||
String username = identity.get().getPrincipal().getName();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user