我正在使用angularJs、aspnet和thinktecture创建一个单页面应用程序。我已经在thinktecture (作为本地主机:44304)中为客户登录创建了一个登录屏幕,在成功登录后,它将重定向到客户门户网站,如https://localhost:44302。
当我运行客户应用程序时,它会重定向到thinktecture登录屏幕,在登录成功后,它会返回到客户门户。
现在的问题是,任何客户都可以使用放置在客户门户上的注册页面注册请求,我们从thinktecture登录屏幕重定向该请求,如图所示

当我点击“这里”链接,然后重定向我再次相同的登录屏幕。
我在startup.cs中为客户添加了如下代码。
System.Threading.Thread.CurrentThread.CurrentCulture =新的CultureInfo("en-us");
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
string thinkTectureUrl = ConfigurationManager.AppSettings["ThinkTectureUrl"].ToString();
string loginSuccessUrl = ConfigurationManager.AppSettings["LoginSuccessUrl"].ToString();
string clientSecret = ConfigurationManager.AppSettings["ClientSecret"].ToString();
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
{
ClientId = "Provista.CustomerPortal.WebApp.External",
Authority = thinkTectureUrl,
RedirectUri = loginSuccessUrl,
ResponseType = "id_token",
Scope = "openid email",
SignInAsAuthenticationType = "Cookies",
ClientSecret = clientSecret.Sha256()
});我在谷歌和stackoverflow上搜索了很多次,但没有找到一个可靠的链接来帮助我解决这个问题。如果任何人有任何想法,请尽快回复。
发布于 2016-03-16 17:35:33
您可以使用全局授权筛选器将未经身份验证的用户重定向到identity server。可能在Global.asax中
filters.Add(new System.Web.Mvc.AuthorizeAttribute()); 对您的“注册用户控制器”的请求也将由此筛选器处理,并重定向到身份服务器。
要覆盖全局筛选器并允许未经身份验证的用户访问您的注册用户控制器,请在您的“注册用户控制器”中使用AllowAnonymous属性。
https://stackoverflow.com/questions/35934049
复制相似问题