diff --git a/src/main/java/com/ibm/as400/access/AS400.java b/src/main/java/com/ibm/as400/access/AS400.java index 762d9908d..de6bdd787 100644 --- a/src/main/java/com/ibm/as400/access/AS400.java +++ b/src/main/java/com/ibm/as400/access/AS400.java @@ -1235,7 +1235,7 @@ public boolean arePropertiesFrozen() @throws AS400SecurityException If an error occurs exchanging client/server information **/ public static boolean isAdditionalAuthenticationFactorAccepted(String systemName) throws IOException, AS400SecurityException { - byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName); + byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName, false); return indicator > 0; } diff --git a/src/main/java/com/ibm/as400/access/AS400ImplRemote.java b/src/main/java/com/ibm/as400/access/AS400ImplRemote.java index 23769a428..5ea3fad0f 100644 --- a/src/main/java/com/ibm/as400/access/AS400ImplRemote.java +++ b/src/main/java/com/ibm/as400/access/AS400ImplRemote.java @@ -1110,10 +1110,11 @@ public void generateProfileToken(ProfileTokenCredential profileToken, } } - public static byte getAdditionalAuthenticationIndicator(String systemName) throws AS400SecurityException, IOException { + public static byte getAdditionalAuthenticationIndicator(String systemName, boolean _useSSL) throws AS400SecurityException, IOException { AS400ImplRemote implRemote = new AS400ImplRemote(); implRemote.systemName_ = systemName; implRemote.socketProperties_ = new SocketProperties(); + implRemote.useSSLConnection_ = _useSSL ? new SSLOptions() : null; implRemote.signonConnect(); byte indicator = implRemote.additionalAuthenticationIndicator_; implRemote.signonDisconnect(); diff --git a/src/main/java/com/ibm/as400/access/SecureAS400.java b/src/main/java/com/ibm/as400/access/SecureAS400.java index 26eac8008..02c5d6465 100644 --- a/src/main/java/com/ibm/as400/access/SecureAS400.java +++ b/src/main/java/com/ibm/as400/access/SecureAS400.java @@ -272,6 +272,18 @@ public static void addPasswordCacheEntry(String systemName, String userId, char[ addPasswordCacheEntry(new SecureAS400(systemName, userId, password, proxyServer)); } + /** + Checks whether an additional authentication factor is accepted for the given system + @param systemName The IP address or hostname of the target system + @return whether the server accepts the additional authentication factor + @exception IOException If an error occurs while communicating with the system. + @throws AS400SecurityException If an error occurs exchanging client/server information + **/ + public static boolean isAdditionalAuthenticationFactorAccepted(String systemName) throws IOException, AS400SecurityException { + byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName, true); + return indicator > 0; + } + /** Returns the key ring class name used for SSL communications with the system. The class com.ibm.as400.access.KeyRing is the default and will be returned if not overridden. @return The key ring class name.