使用 ADAL 重定向时的 Ui-Router 404 [英] Ui-Router 404 when redirecting with ADAL

查看:21
本文介绍了使用 ADAL 重定向时的 Ui-Router 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将 Azure 目录身份验证库 (ADAL.JS) 连接到 UI-Router.我已经将它连接起来,并且它重定向正确,但它总是在重定向之前抛出一个 404.重定向有效,然后被发送回我的应用程序,显示 404.

I'm currently trying to hook in the Azure Directory Authentication Library (ADAL.JS) into UI-Router. I've got it wired in, and it redirects correctly, but it always chucks a 404 before the redirect. The redirect works, and then gets sent back to my application, which is showing the 404.

我已经像这样修改了状态:

I've modified the state like so:

        {
            state: 'admin',
            config: {
                url: '/admin',
                templateUrl: 'app/admin/admin.html',
                controller: 'AdminController',
                controllerAs: 'vm',
                title: 'Admin',
                settings: {
                    nav: 2,
                    content: '<i class="fa fa-lock"></i> Admin'
                },
                requireADLogin: true
            }

我已经让它与普通的 Angular RouteProvider 一起工作,并且没有抛出 404.

I've got it working with the normal Angular RouteProvider, and no 404 is being thrown.

我试图将其插入的应用程序是由 John Papas Yo Hot Towel 生成器生成的.

The application I'm attempting to plumb it into was generated by John Papas Yo Hot Towel generator.

推荐答案

这看起来像是 adal.js 中的一个错误.ui-router 正在使用状态更改.与路由更改处理程序相比,我发现在设置状态更改的起始页面时有一个不同之处.应该是:

This looks like a bug in adal.js. ui-router is using state changes. I see one difference in setting the start page for state changes comparing to the route change handler. It should be :

_adal._saveItem(_adal.CONSTANTS.STORAGE.START_PAGE, $location.$$path);

代替

_adal._saveItem(_adal.CONSTANTS.STORAGE.START_PAGE, nextRoute.url);

这篇关于使用 ADAL 重定向时的 Ui-Router 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆