Esempio n. 1
0
        private VirgilClient PredefinedClient(VirgilCrypto crypto)
        {
            var clientParams = new VirgilClientParams(ConfigurationManager.AppSettings["virgil:AppAccessToken"]);

            clientParams.SetCardsServiceAddress(ConfigurationManager.AppSettings["virgil:CardsServicesAddress"]);
            clientParams.SetIdentityServiceAddress(ConfigurationManager.AppSettings["virgil:IdentityServiceAddress"]);
            clientParams.SetRAServiceAddress(ConfigurationManager.AppSettings["virgil:RAServicesAddress"]);
            clientParams.SetReadCardsServiceAddress(ConfigurationManager.AppSettings["virgil:CardsReadServicesAddress"]);

            var validator = new CardValidator(crypto);

            // To use staging Verifier instead of default verifier
            var cardVerifier = new CardVerifierInfo
            {
                CardId        = ConfigurationManager.AppSettings["virgil:ServiceCardId"],
                PublicKeyData = VirgilBuffer.From(ConfigurationManager.AppSettings["virgil:ServicePublicKeyDerBase64"],
                                                  StringEncoding.Base64)
            };

            validator.AddVerifier(cardVerifier.CardId, cardVerifier.PublicKeyData.GetBytes());

            var client = new VirgilClient(clientParams);

            client.SetCardValidator(validator);

            return(client);
        }
        public static VirgilClient GetVirgilClient()
        {
            var parameters = new VirgilClientParams(AppAccessToken);

            parameters.SetCardsServiceAddress(ConfigurationManager.AppSettings["virgil:CardsServicesAddress"]);
            parameters.SetReadCardsServiceAddress(ConfigurationManager.AppSettings["virgil:CardsReadServicesAddress"]);
            parameters.SetIdentityServiceAddress(ConfigurationManager.AppSettings["virgil:IdentityServiceAddress"]);

            var client = new VirgilClient(parameters);

            return(client);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a Virgil high-level API with specified access token.
        /// </summary>
        /// <param name="accessToken">
        /// The access token provides an authenticated secure access to the Virgil Security services and
        /// is passed with each API call. The access token also allows the API to associate your app’s
        /// requests with your Virgil Security developer’s account.
        /// </param>
        public static void Initialize(string accessToken)
        {
            if (string.IsNullOrWhiteSpace(accessToken))
            {
                throw new ArgumentException(Localization.ExceptionArgumentIsNullOrWhitespace, nameof(accessToken));
            }

            var crypto = Container.Resolve <Crypto>();

            var client = new VirgilClient(accessToken);

            client.SetCardValidator(new CardValidator(crypto));

            Container.RegisterInstance <VirgilClient, VirgilClient>(client);
        }
Esempio n. 4
0
        internal override async Task <string> ConfirmAndGrabValidationTokenAsync(IdentityVerificationAttempt attempt, VirgilClient client)
        {
            var token = await client.ConfirmIdentityAsync(attempt.ActionId, this.confirmationCode,
                                                          (int)attempt.TimeToLive.TotalSeconds, attempt.CountToLive).ConfigureAwait(false);

            return(token);
        }
Esempio n. 5
0
 /// <summary>
 /// Confirms the identity verificatio and grabs a validation token.
 /// </summary>
 /// <param name="attempt">The attempt.</param>
 /// <param name="client">The Virgil API client.</param>
 /// <returns>
 /// A string that represents identity validation token.
 /// </returns>
 internal abstract Task <string> ConfirmAndGrabValidationTokenAsync(IdentityVerificationAttempt attempt, VirgilClient client);