Esempio n. 1
0
        public static ActionResult AuthorizeValidationError(this Controller controller,
                                                            AuthorizeRequestValidationException exception)
        {
            var roException = exception as AuthorizeRequestResourceOwnerException;

            if (roException != null)
            {
                Tracing.Error(roException.Message);

                var result = new ViewResult
                {
                    ViewName = "ValidationError"
                };

                result.ViewBag.Message = roException.Message;

                return(result);
            }

            var clientException = exception as AuthorizeRequestClientException;

            if (clientException != null)
            {
                Tracing.Error(clientException.Message);
                return(new ClientErrorResult(clientException.RedirectUri, clientException.Error,
                                             clientException.ResponseType, clientException.State));
            }

            throw new ArgumentException("Invalid exception type");
        }
Esempio n. 2
0
        public static ActionResult AuthorizeValidationError(this Controller controller,
            AuthorizeRequestValidationException exception)
        {
            var roException = exception as AuthorizeRequestResourceOwnerException;
            if (roException != null)
            {
                Tracing.Error(roException.Message);

                var result = new ViewResult
                {
                    ViewName = "ValidationError"
                };

                result.ViewBag.Message = roException.Message;

                return result;
            }

            var clientException = exception as AuthorizeRequestClientException;
            if (clientException != null)
            {
                Tracing.Error(clientException.Message);
                return new ClientErrorResult(clientException.RedirectUri, clientException.Error,
                    clientException.ResponseType, clientException.State);
            }

            throw new ArgumentException("Invalid exception type");
        }