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.
- Java
- CSharp
- Python
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);
}
}
using com.entrustdatacard.intellitrust.auth.api;
using com.entrustdatacard.intellitrust.auth.Client;
using com.entrustdatacard.intellitrust.auth.model;
namespace Sample
{
internal class AuthApiSample
{
private static readonly string HOST_NAME = "YOUR_HOST_NAME";
private static readonly string APPLICATION_ID = "YOUR_APPLICATION_ID";
public static void Main()
{
Configuration configuration = new Configuration();
configuration.BasePath = HOST_NAME;
var authApi = new AuthenticationApi(configuration);
string userId = "exampleUser";
var userQueryParms = new UserAuthenticateQueryParameters(applicationId: APPLICATION_ID, userId: userId);
var response = authApi.UserAuthenticatorQueryUsingPOST(userQueryParms);
var authenticators = response.AuthenticationTypes;
var availableAuthenticators = string.Join(", ", authenticators);
Console.WriteLine("Authenticators for user " + userId + ": " + availableAuthenticators);
}
}
}
from IntelliTrust_Python_Authentication import ApiClient, Configuration
import IntelliTrust_Python_Authentication.api as apis
import IntelliTrust_Python_Authentication.models as models
conf = Configuration(host="YOUR_HOST_NAME")
with ApiClient(configuration=conf) as api_client:
api_instance = apis.AuthenticationApi(api_client)
application_id = "YOUR_APPLICATION_ID"
user_id = "exampleUser"
user_authenticate_query_parameters = models.UserAuthenticateQueryParameters(application_id=application_id, user_id=user_id)
response = api_instance.user_authenticator_query_using_post(user_authenticate_query_parameters)
print("Authenticators for user " + user_id + ": " + ", ".join(response["authentication_types"]))
print("Available OTP delivery methods for user " + user_id + ": " + ", ".join(response["otp_delivery_info"]["availableOTPDelivery"]))