Skip to main content

Get Users Authenticators

To perform authentication with the API, you need to get one user's available authenticators. You can get the authenticators by using the examples below.

caution

This sample is for demonstration purposes only. It is not intended for production use. In production, you should use a secure method to store the application id.

package com.entrust.idaas.userAuthenticate;

import com.entrustdatacard.intellitrust.auth.ApiClient;
import com.entrustdatacard.intellitrust.auth.api.AuthenticationApi;
import com.entrustdatacard.intellitrust.auth.model.*;

public class UserAuthenticate {
private static final String APPLICATION_ID = "YOUR_APPLICATION_ID";
private static final String HOST_NAME = "YOUR_HOST_NAME";

public static void main(String args[]) throws Exception {
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(HOST_NAME);
AuthenticationApi authApi = new AuthenticationApi(apiClient);

String userId = "exampleUser";

UserAuthenticateQueryParameters userQueryParms = new UserAuthenticateQueryParameters()
.applicationId(APPLICATION_ID)
.userId(userId);

UserAuthenticateQueryResponse response = authApi.userAuthenticatorQueryUsingPOST(userQueryParms);

List<UserAuthenticateQueryResponse.AuthenticationTypesEnum> authenticators = response.getAuthenticationTypes();
String availableAuthenticators = authenticators.stream().map(UserAuthenticateQueryResponse.AuthenticationTypesEnum::name).collect(Collectors.joining(", "));
System.out.println("Authenticators for user " + userId + ": " + availableAuthenticators);

String availableOTPDeliveryMethods = response.getOtpDeliveryInfo().getAvailableOTPDelivery().stream().map(OTPDetails.AvailableOTPDeliveryEnum::name).collect(Collectors.joining(", "));
System.out.println("Available OTP delivery method for user " + userId + ": " + availableOTPDeliveryMethods);
}
}