我有一个与 Angular JS 一起使用的单页 MVC 应用程序。Angular 从我的 asp mvc 应用程序调用 api,包括登录。我想向我的应用程序添加单点登录
在转移到本地登录页面之前,我的角度检查“GetUserRoles”功能..
我做错了什么,所以 UserAccountApiController 中的 HttpContext.Current.GetOwinContext().Authentication.Challenge() 行无法打开 adfs sso 页面???
用户帐户Api控制器
[HttpPost]
public bool IsLogedInRoled(NR role)
{
if (User.Identity.IsAuthenticated)
{
if (!string.IsNullOrEmpty(role.role))
{
var isLogedInRoled = GetUserRoles().Select(x => x.ToLower()).Contains(role.role);
return isLogedInRoled;
}
return true;
}
HttpContext.Current.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "~/" },
WsFederationAuthenticationDefaults.AuthenticationType);
return false;
}
Run Code Online (Sandbox Code Playgroud)
启动.cs
public class CustomeStartup : UmbracoDefaultOwinStartup
{
private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
private static string adfsWreply = …Run Code Online (Sandbox Code Playgroud)