The following code is only returnning the first 200 users when I attempt to either loop or stream through the UserList that is returned from Client.listUsers(). Am I doing something wrong? I though pagination would be handled via the Okta Java SDK.
@Override
public Client getClient(String oktaDomain, String apiToken) {
String oktaUrl = "https://" + oktaDomain;
return Clients.builder()
.setRetryMaxElapsed(REQUEST_TIMEOUT)
.setRetryMaxAttempts(MAX_RETRIES)
.setOrgUrl(oktaUrl)
.setClientCredentials(new TokenClientCredentials(apiToken))
.setScopes(new HashSet<>(Collections.singletonList("okta.users.read")))
.build();
}
@Override
public UserList getUserData(String domain, String apiToken) throws CustomAllowRetryException {
Client client = getClient(domain, apiToken);
UserList userList;
try {
logger.info("Gathering user list from Okta.", v("domain", domain));
userList = client.listUsers();
} catch (RuntimeException runtimeException) {
logger.error("Unable to retrieve Users from Okta account for domain.", v("domain", domain), v("message", runtimeException.getMessage()));
throw new WombatAllowRetryException("Unable to retrieve Users from Okta account for domain");
} catch (Exception exception) {
logger.error("Unable to retrieve Users from Okta account for domain.", v("domain", domain), v("message", exception.getMessage()));
throw new CustomAllowRetryException("Unable to retrieve Users from Okta account for domain");
}
return userList;
}