Skip to content

Commit

Permalink
Add SecureAS400.isAdditionalAuthenticationFactorAccepted()
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Gorzinski <17914061+ThePrez@users.noreply.github.com>
  • Loading branch information
ThePrez committed Sep 13, 2023
1 parent f7254eb commit 8fb947a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/ibm/as400/access/AS400.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/ibm/as400/access/AS400ImplRemote.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/ibm/as400/access/SecureAS400.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <i>com.ibm.as400.access.KeyRing</i> is the default and will be returned if not overridden.
@return The key ring class name.
Expand Down

0 comments on commit 8fb947a

Please sign in to comment.