public override async Task<HttpResponseMessage> ExecuteAsync(System.Threading.CancellationToken cancellationToken)
        {
            _request.SetSuppressXfo();

            Logger.Info("Posting to " + _response.RedirectUri);

            // see if we have a DefaultViewService for the IViewService 
            // to allow for customization of the authorize response page
            var ctx = _request.GetOwinContext();
            var defaultViewSvc = ctx.ResolveDependency<IViewService>() as DefaultViewService;
            if (defaultViewSvc != null)
            {
                Logger.Debug("Using DefaultViewService to render authorization response HTML");

                var vm = new AuthorizeResponseViewModel
                {
                    SiteName = _response.Request.Options.SiteName,
                    SiteUrl = _request.GetIdentityServerBaseUrl(),
                    ResponseFormUri = _response.RedirectUri,
                    ResponseFormFields = _response.ToNameValueCollection().ToFormPost()
                };

                var result = new HtmlStreamActionResult(() => defaultViewSvc.AuthorizeResponse(vm));
                return await result.ExecuteAsync(cancellationToken);
            }

            Logger.Debug("Using AssetManager to render authorization response HTML");
            return await base.ExecuteAsync(cancellationToken);
        }
Ejemplo n.º 2
0
        public override async Task <HttpResponseMessage> ExecuteAsync(System.Threading.CancellationToken cancellationToken)
        {
            _request.SetSuppressXfo();

            Logger.Info("Posting to " + _response.RedirectUri);

            // see if we have a DefaultViewService for the IViewService
            // to allow for customization of the authorize response page
            var ctx            = _request.GetOwinContext();
            var defaultViewSvc = ctx.ResolveDependency <IViewService>() as DefaultViewService;

            if (defaultViewSvc != null)
            {
                Logger.Debug("Using DefaultViewService to render authorization response HTML");

                var vm = new AuthorizeResponseViewModel
                {
                    SiteName           = _response.Request.Options.SiteName,
                    SiteUrl            = _request.GetIdentityServerBaseUrl(),
                    ResponseFormUri    = _response.RedirectUri,
                    ResponseFormFields = _response.ToNameValueCollection().ToFormPost()
                };

                var result = new HtmlStreamActionResult(() => defaultViewSvc.AuthorizeResponse(vm));
                return(await result.ExecuteAsync(cancellationToken));
            }

            Logger.Debug("Using AssetManager to render authorization response HTML");
            return(await base.ExecuteAsync(cancellationToken));
        }