public void CreateAuthorizationGrant(IAuthorizationContext context)
        {
            try
            {
                InspectRequest(context);


                IEnumerable <ContextProcessor <IAuthorizationContext> > processors = ServiceLocator.Current.GetAllInstances <ContextProcessor <IAuthorizationContext> >();

                bool handled = false;
                foreach (ContextProcessor <IAuthorizationContext> processor in processors)
                {
                    if (!processor.IsSatisfiedBy(context))
                    {
                        continue;
                    }
                    processor.Process(context);
                    handled = true;
                    break;
                }

                if (!handled)
                {
                    throw Errors.UnsupportedResponseType(context, context.ResponseType);
                }

                if (!context.IsApproved)
                {
                    throw Errors.AccessDenied(context);
                }
            }
            catch (OAuthErrorResponseException <IAuthorizationContext> ex)
            {
                context.Error = new ErrorResponse
                {
                    Error            = ex.Error,
                    ErrorDescription = ex.Message,
                    ErrorUri         = ex.ErrorUri
                };
            }
        }