Skip to content

Commit e96a4e7

Browse files
committed
Add SecureAS400.isAdditionalAuthenticationFactorAccepted()
Signed-off-by: Jesse Gorzinski <[email protected]>
1 parent 0ac891c commit e96a4e7

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Diff for: src/main/java/com/ibm/as400/access/AS400.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ public boolean arePropertiesFrozen()
12351235
@throws AS400SecurityException If an error occurs exchanging client/server information
12361236
**/
12371237
public static boolean isAdditionalAuthenticationFactorAccepted(String systemName) throws IOException, AS400SecurityException {
1238-
byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName);
1238+
byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName, false);
12391239
return indicator > 0;
12401240
}
12411241

Diff for: src/main/java/com/ibm/as400/access/AS400ImplRemote.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1110,10 +1110,11 @@ public void generateProfileToken(ProfileTokenCredential profileToken,
11101110
}
11111111
}
11121112

1113-
public static byte getAdditionalAuthenticationIndicator(String systemName) throws AS400SecurityException, IOException {
1113+
public static byte getAdditionalAuthenticationIndicator(String systemName, boolean _useSSL) throws AS400SecurityException, IOException {
11141114
AS400ImplRemote implRemote = new AS400ImplRemote();
11151115
implRemote.systemName_ = systemName;
11161116
implRemote.socketProperties_ = new SocketProperties();
1117+
implRemote.useSSLConnection_ = _useSSL ? new SSLOptions() : null;
11171118
implRemote.signonConnect();
11181119
byte indicator = implRemote.additionalAuthenticationIndicator_;
11191120
implRemote.signonDisconnect();

Diff for: src/main/java/com/ibm/as400/access/SecureAS400.java

+12
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,18 @@ public static void addPasswordCacheEntry(String systemName, String userId, char[
272272
addPasswordCacheEntry(new SecureAS400(systemName, userId, password, proxyServer));
273273
}
274274

275+
/**
276+
Checks whether an additional authentication factor is accepted for the given system
277+
@param systemName The IP address or hostname of the target system
278+
@return whether the server accepts the additional authentication factor
279+
@exception IOException If an error occurs while communicating with the system.
280+
@throws AS400SecurityException If an error occurs exchanging client/server information
281+
**/
282+
public static boolean isAdditionalAuthenticationFactorAccepted(String systemName) throws IOException, AS400SecurityException {
283+
byte indicator = AS400ImplRemote.getAdditionalAuthenticationIndicator(systemName, true);
284+
return indicator > 0;
285+
}
286+
275287
/**
276288
Returns the key ring class name used for SSL communications with the system. The class <i>com.ibm.as400.access.KeyRing</i> is the default and will be returned if not overridden.
277289
@return The key ring class name.

0 commit comments

Comments
 (0)