Beispiel #1
0
        async Task <TokenRequestValidationResult> RunValidationAsync(Func <NameValueCollection, Task <TokenRequestValidationResult> > validationFunc, NameValueCollection parameters)
        {
            // run standard validation
            var result = await validationFunc(parameters);

            if (result.IsError)
            {
                return(result);
            }

            // run custom validation
            var customResult = await _customRequestValidator.ValidateTokenRequestAsync(_validatedRequest);

            if (customResult.IsError)
            {
                var message = "Custom token request validator error";

                if (customResult.Error.IsPresent())
                {
                    message += ": " + customResult.Error;
                }
                else
                {
                    customResult.Error = Constants.TokenErrors.InvalidRequest;
                }

                LogError(message);
                return(customResult);
            }

            LogSuccess();
            return(customResult);
        }
        async Task <TokenRequestValidationResult> RunValidationAsync(Func <NameValueCollection, Task <TokenRequestValidationResult> > validationFunc, NameValueCollection parameters)
        {
            // run standard validation
            var result = await validationFunc(parameters);

            if (result.IsError)
            {
                return(result);
            }

            // run custom validation
            _logger.LogTrace("Calling into custom request validator: {type}", _customRequestValidator.GetType().FullName);
            var customResult = await _customRequestValidator.ValidateTokenRequestAsync(_validatedRequest);

            if (customResult.IsError)
            {
                var message = "Custom token request validator error";

                if (customResult.Error.IsPresent())
                {
                    message += ": " + customResult.Error;
                }

                LogError(message);
                return(customResult);
            }

            LogSuccess();
            return(customResult);
        }
Beispiel #3
0
        private async Task <ValidationResult> RunValidationAsync(
            Func <NameValueCollection, Task <ValidationResult> > validationFunc, NameValueCollection parameters)
        {
            // run standard validation
            ValidationResult result = await validationFunc(parameters);

            if (result.IsError)
            {
                return(result);
            }

            // run custom validation
            ValidationResult customResult = await _customRequestValidator.ValidateTokenRequestAsync(_validatedRequest);

            if (customResult.IsError)
            {
                string message = "Custom token request validator error";

                if (customResult.Error.IsPresent())
                {
                    message += ": " + customResult.Error;
                }

                LogError(message);
                return(customResult);
            }

            LogSuccess();
            return(customResult);
        }
        async Task <ValidationResult> RunValidationAsync(Func <NameValueCollection, Task <ValidationResult> > validationFunc, NameValueCollection parameters)
        {
            // run standard validation
            var result = await validationFunc(parameters);

            if (result.IsError)
            {
                return(result);
            }

            // run custom validation
            return(await _customRequestValidator.ValidateTokenRequestAsync(_validatedRequest, _users));
        }