// This is an automatically generated code sample. 
// To make this code sample work in your Oracle Cloud tenancy, 
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and 
// boolean, number, and enum parameters with values not fitting your use case).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.IdentitydomainsService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Identitydomains
{
    public class CreateMyAuthenticationFactorValidatorExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var myAuthenticationFactorValidator = new Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator
			{
				Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
				Ocid = "EXAMPLE-ocid-Value",
				Schemas = new List<string>
				{
					"EXAMPLE--Value"
				},
				Meta = new Oci.IdentitydomainsService.Models.Meta
				{
					ResourceType = "EXAMPLE-resourceType-Value",
					Created = "EXAMPLE-created-Value",
					LastModified = "EXAMPLE-lastModified-Value",
					Location = "EXAMPLE-location-Value",
					Version = "EXAMPLE-version-Value"
				},
				IdcsCreatedBy = new Oci.IdentitydomainsService.Models.IdcsCreatedBy
				{
					Value = "EXAMPLE-value-Value",
					Ref = "EXAMPLE-$ref-Value",
					Type = Oci.IdentitydomainsService.Models.IdcsCreatedBy.TypeEnum.User,
					Display = "EXAMPLE-display-Value",
					Ocid = "EXAMPLE-ocid-Value"
				},
				IdcsLastModifiedBy = new Oci.IdentitydomainsService.Models.IdcsLastModifiedBy
				{
					Value = "EXAMPLE-value-Value",
					Ref = "EXAMPLE-$ref-Value",
					Type = Oci.IdentitydomainsService.Models.IdcsLastModifiedBy.TypeEnum.App,
					Display = "EXAMPLE-display-Value",
					Ocid = "EXAMPLE-ocid-Value"
				},
				IdcsPreventedOperations = new List<Oci.IdentitydomainsService.Models.IdcsPreventedOperations>
				{
					Oci.IdentitydomainsService.Models.IdcsPreventedOperations.Update
				},
				Tags = new List<Oci.IdentitydomainsService.Models.Tags>
				{
					new Oci.IdentitydomainsService.Models.Tags
					{
						Key = "EXAMPLE-key-Value",
						Value = "EXAMPLE-value-Value"
					}
				},
				DeleteInProgress = true,
				IdcsLastUpgradedInRelease = "EXAMPLE-idcsLastUpgradedInRelease-Value",
				DomainOcid = "EXAMPLE-domainOcid-Value",
				CompartmentOcid = "EXAMPLE-compartmentOcid-Value",
				TenancyOcid = "EXAMPLE-tenancyOcid-Value",
				AuthFactor = Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator.AuthFactorEnum.TrustToken,
				Scenario = Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator.ScenarioEnum.Authentication,
				RequestId = "ocid1.test.oc1..<unique_ID>EXAMPLE-requestId-Value",
				OtpCode = "EXAMPLE-otpCode-Value",
				DeviceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-deviceId-Value",
				Status = Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator.StatusEnum.Success,
				UserId = "ocid1.test.oc1..<unique_ID>EXAMPLE-userId-Value",
				UserName = "EXAMPLE-userName-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				Message = "EXAMPLE-message-Value",
				Type = Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator.TypeEnum.Saml,
				UpdateUserPreference = false,
				PreferenceType = Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidator.PreferenceTypeEnum.Mfa,
				SecurityQuestions = new List<Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidatorSecurityQuestions>
				{
					new Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidatorSecurityQuestions
					{
						Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
						Answer = "EXAMPLE-answer-Value"
					}
				},
				Name = "EXAMPLE-name-Value",
				Platform = "EXAMPLE-platform-Value",
				Location = "EXAMPLE-location-Value",
				TrustedTokenId = "ocid1.test.oc1..<unique_ID>EXAMPLE-trustedTokenId-Value",
				KmsiTokenId = "ocid1.test.oc1..<unique_ID>EXAMPLE-kmsiTokenId-Value",
				PolicyEnabledSecondFactors = new List<string>
				{
					"EXAMPLE--Value"
				},
				CreateTrustedAgent = true,
				CreateKmsiToken = false,
				IsAccRecEnabled = true,
				PolicyTrustedFrequencyMins = 91,
				ThirdPartyFactor = new Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidatorThirdPartyFactor
				{
					ThirdPartyVendorName = "EXAMPLE-thirdPartyVendorName-Value",
					ThirdPartyFactorType = "EXAMPLE-thirdPartyFactorType-Value",
					ThirdPartyFactorId = "ocid1.test.oc1..<unique_ID>EXAMPLE-thirdPartyFactorId-Value"
				},
				AdditionalAttributes = new List<Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidatorAdditionalAttributes>
				{
					new Oci.IdentitydomainsService.Models.MyAuthenticationFactorValidatorAdditionalAttributes
					{
						Name = "EXAMPLE-name-Value",
						Value = "EXAMPLE-value-Value"
					}
				}
			};
			var createMyAuthenticationFactorValidatorRequest = new Oci.IdentitydomainsService.Requests.CreateMyAuthenticationFactorValidatorRequest
			{
				Authorization = "EXAMPLE-authorization-Value",
				ResourceTypeSchemaVersion = "EXAMPLE-resourceTypeSchemaVersion-Value",
				MyAuthenticationFactorValidator = myAuthenticationFactorValidator,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
			};

            // Create a default authentication provider that uses the DEFAULT
            // profile in the configuration file.
            // Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new IdentityDomainsClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateMyAuthenticationFactorValidator(createMyAuthenticationFactorValidatorRequest);
					// Retrieve value from the response.
					var id = response.MyAuthenticationFactorValidator.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateMyAuthenticationFactorValidator Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?