Sitecore的使用LDAP - 编程认证 [英] Sitecore with LDAP - authenticate programmatically

查看:296
本文介绍了Sitecore的使用LDAP - 编程认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建内部Sitecore的一个应用程序,我只希望通过直接的URL提供给用户。我要对发生的LDAP认证。我试图直接进入应用程序,让它重定向到自动登录页面并重定向我的应用程序,但它并没有这样做。相反,它带我到Sitecore的登录页面。

I am creating an app inside Sitecore and I only want it available to the users via a direct URL. I want the authentication to occur against LDAP. I tried going directly to the app and let it redirect to the auto login page and redirect me to the app but it didn't do it. Instead it took me to the Sitecore login page.

我不知道是否有可能对我来说,写一些code自动身份验证的LDAP用户和重定向到应用程序页面。我希望用户永远不会看到比一个应用程序的其他Sitecore的屏幕的登录页面或Sitecore的桌面或任何

I'm wondering if it is possible for me to write some code to auto authenticate a LDAP user and redirect to the app page. I want the user to never see the login page or Sitecore desktop or any of the Sitecore screens other than that one app.

感谢

推荐答案

我们完成了AD模块在Global.asax一些定制code结合类似的东西。下面是几行可能会有所帮助。你可能会需要一堆逻辑来检查,如果用户已经登录,以及是否他们正在访问的路径要自动登录的。

We accomplished something similar by combining the AD module with some custom code in the Global.asax. Below are a few lines that might be helpful. You'll likely need a bunch of logic to check if the user is already logged in, and whether they are accessing a path you want to auto-login for.

注意的:确保Windows身份验证在IIS中启用

NOTE: Make sure windows authentication is enabled in IIS.

protected void Session_Start(object sender, EventArgs e){
        // The user from Windows Authentication in IIS
        var user = Context.Request.ServerVariables["LOGON_USER"];
        //Log the user in
        bool success = Sitecore.Security.Authentication.AuthenticationManager.Provider.Login(user, false);

}

您会注意到,我提供的样品直接进入供应商。您也可以拨打登录在的AuthenticationManager类,这也将做一些其他的工作,高速缓存。就我而言,我试图绕过。

You'll note that the sample I provided goes directly to the provider. You can also call Login at the AuthenticationManager class, and this will also do some other work with cache. In my case, I was trying to bypass that.

这篇关于Sitecore的使用LDAP - 编程认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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