Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
grada84 committed Nov 4, 2024
1 parent d54f4ce commit 2900d3d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public static Properties getPaiProperties() {
try (InputStream input = new FileInputStream(CONF_DIR.concat("/pai.properties"))) {
prop.load(input);
} catch (IOException ex) {
ex.printStackTrace();
logger.error("An error occurred: {}", ex.getMessage(), ex);

}
return prop;
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/lacnic/portal/auth/client/Utils2FA.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import org.apache.commons.codec.binary.Base32;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
Expand All @@ -18,6 +20,7 @@
import de.taimos.totp.TOTP;

public class Utils2FA {
private static final Logger logger = LoggerFactory.getLogger(Utils2FA.class);

private static final String UTF_8 = "UTF-8";

Expand All @@ -30,7 +33,7 @@ public static String obtenerSecretKey(String user) {
Utils2FA.createQRCode(barCodeUrl, calcularRutaImgQR, 300, 300);
return secretKey;
} catch (IOException | WriterException e) {
e.printStackTrace();
logger.error("An error occurred: {}", e.getMessage(), e);
return null;
}

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/net/lacnic/portal/auth/client/UtilsFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import java.io.InputStream;
import java.util.UUID;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class UtilsFiles {
private static final Logger logger = LoggerFactory.getLogger(UtilsFiles.class);

public static byte[] getBytesFromFile(String fileString) throws IOException {
return getBytesFromFile(new File(fileString));
Expand All @@ -23,7 +27,7 @@ public static byte[] calcularBytesImgQR(String secretKey) {
try {
return getBytesFromFile(calcularRutaImgQR(secretKey));
} catch (IOException e) {
e.printStackTrace();
logger.error("An error occurred: {}", e.getMessage(), e);
return null;
}
}
Expand Down Expand Up @@ -65,9 +69,9 @@ public static File obtenerFile(byte[] bytes, String extension) {

return file;
} catch (FileNotFoundException e) {
e.printStackTrace();
logger.error("An error occurred: {}", e.getMessage(), e);
} catch (Exception e) {
e.printStackTrace();
logger.error("An error occurred: {}", e.getMessage(), e);
}
return null;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/lacnic/portal/auth/client/UtilsLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public static LoginData loginTfa(String username, String password, String totp)
LoginData infoLDAP = PortalWSClient.getLoginDataTfa(username, password, totp);
return infoLDAP;
} catch (Exception e) {
e.printStackTrace();
logger.error("An error occurred: {}", e.getMessage(), e);

return new LoginData("Error: verifique usuario y/o contraseña");
}
}
Expand Down

0 comments on commit 2900d3d

Please sign in to comment.