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 f75f121 commit 2a176a4
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
Expand Down Expand Up @@ -39,7 +38,7 @@ public X509Certificate[] getAcceptedIssuers() {
}

@Override
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException {
public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException {
return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private static String readUrlToken(String urlString, String token) {
}
}

private static String getAuthToken() throws Exception {
private static String getAuthToken() {
Properties props = getPaiProperties();
return props.getProperty(PORTAL_APIKEY);
}
Expand Down
4 changes: 3 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 @@ -19,6 +19,8 @@

public class Utils2FA {

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

public static String obtenerSecretKey(String user) {
try {
String secretKey = Utils2FA.generateSecretKey();
Expand Down Expand Up @@ -51,7 +53,7 @@ public static String getTOTPCode(String secretKey) {

public static String getGoogleAuthenticatorBarCode(String secretKey, String account, String issuer) {
try {
return "otpauth://totp/" + URLEncoder.encode(issuer + ":" + account, "UTF-8").replace("+", "%20") + "?secret=" + URLEncoder.encode(secretKey, "UTF-8").replace("+", "%20") + "&issuer=" + URLEncoder.encode(issuer, "UTF-8").replace("+", "%20");
return "otpauth://totp/" + URLEncoder.encode(issuer + ":" + account, UTF_8).replace("+", "%20") + "?secret=" + URLEncoder.encode(secretKey, UTF_8).replace("+", "%20") + "&issuer=" + URLEncoder.encode(issuer, UTF_8).replace("+", "%20");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/lacnic/portal/auth/client/UtilsLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public static LoginData login(String username, String password) {
byte[] bytes = md.digest();
String hash = new String(Base64.getEncoder().encode(bytes));
password = "{SHA256}" + hash;
LoginData infoLDAP = PortalWSClient.getLoginData(username, password);
return infoLDAP;
return PortalWSClient.getLoginData(username, password);
} catch (Exception e) {
logger.error("An error occurred: {}", e.getMessage(), e);
return new LoginData("Error: verifique usuario y/o contraseña");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class LoginDataTest {
class LoginDataTest {

private LoginData loginData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.apache.http.params.HttpParams;
import org.junit.jupiter.api.Test;

public class PortalHttpClientTest {
class PortalHttpClientTest {

@Test
void testGetNewHttpClient_returnsConfiguredHttpClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class TokenDataTest {
class TokenDataTest {

private TokenData tokenData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import de.taimos.totp.TOTP;

public class Utils2FATest {
class Utils2FATest {

@BeforeEach
void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

public class UtilsFilesTest {
class UtilsFilesTest {

private static final String TEMP_DIR_KEY = "jboss.server.temp.dir";
private Path tempDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;

public class UtilsLoginTest {
class UtilsLoginTest {

private HttpServletRequest mockRequest;

Expand Down

0 comments on commit 2a176a4

Please sign in to comment.