예제 #1
0
        /// <inheritdoc/>
        public Task <IUser> CreateUserAsync(CreateUserWithImportedHashedPasswordOptions options, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var user = new CreateUserRequest
            {
                Profile     = options.Profile,
                Credentials = new UserCredentials
                {
                    Password = new PasswordCredential
                    {
                        Hash = options.PasswordCredentialHash,
                    },
                },
            };

            return(CreateUserAsync(user, options.Activate, cancellationToken: cancellationToken));
        }
예제 #2
0
        /// <inheritdoc/>
        public Task <IUser> CreateUserAsync(CreateUserWithRecoveryQuestionOptions options, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var user = new CreateUserRequest
            {
                Profile     = options.Profile,
                Credentials = new UserCredentials
                {
                    RecoveryQuestion = new RecoveryQuestionCredential
                    {
                        Question = options.RecoveryQuestion,
                        Answer   = options.RecoveryAnswer,
                    },
                },
            };

            return(CreateUserAsync(user, options.Activate, cancellationToken: cancellationToken));
        }
예제 #3
0
        /// <inheritdoc/>
        public Task <IUser> CreateUserAsync(CreateUserWithProviderOptions options, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var user = new CreateUserRequest
            {
                Profile     = options.Profile,
                Credentials = new UserCredentials
                {
                    Provider = new AuthenticationProvider
                    {
                        Type = options.ProviderType,
                        Name = options.ProviderName,
                    },
                },
            };

            return(CreateUserAsync(user, options.Activate, true, cancellationToken: cancellationToken));
        }