Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SecureAS400.isAdditionalAuthenticationFactorAccepted() #130

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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