当前位置: 首页 > 知识库问答 >
问题:

asp内部单点登录。net mvc web应用程序

潘兴朝
2023-03-14

我在我们的内部网络上有两个域:-

  1. 域名
  2. 域名B

两个域都可以相互通信,但它们彼此不信任。

所以目前我已经部署了我的asp。net MVC web应用程序,但我需要在DomainB Active directory上的用户才能登录到asp。net mvc使用其domainB AD凭据。我对asp中的windows身份验证和表单身份验证都持开放态度。净mvc。

但是客户端的唯一要求是,他们需要访问asp的用户。net mvc intranet应用程序,无需登录页面即可登录到系统;他们可以:-

  1. 通过浏览器弹出窗口输入用户名和密码
  2. 或自动登录

有人能建议我可以遵循什么方法来实现这一目标吗?谢谢

编辑我已经阅读了下面的文章http://msdn.microsoft.com/en-us/library/ff650307.aspx,关于如何我可以从多个域验证asp.netmvc用户,所以在我的asp.netmvc我做了以下工作:-

我在我的网站上添加了以下内容。配置:-

<system.web>
    <membership>
      <providers>
        <add name="TestDomain1ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="TestDomain1ConnectionString" connectionUsername="ad-domainA.intra\it360ad.user" connectionPassword="$$$$$" />

      </providers>
    </membership>
<add name="TestDomain1ConnectionString" connectionString="LDAP://ad-domainA.intra/CN=Users,DC=ad-domainA,DC=intra" />

我添加了以下帐户。控制器:-

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{


    MembershipProvider domainProvider;

    domainProvider = Membership.Providers["TestDomain1ADMembershipProvider"];


    // Validate the user with the membership system.
    if (domainProvider.ValidateUser(model.UserName, model.Password))
    {
        // If there is a RequestUrl query string attribute, the user has
        // been redirected to the login page by forms authentication after
        // requesting another page while not authenticated.
        if (Request.QueryString["ReturnUrl"] != null)
        {
            // RedirectFromLoginPage sets the authorization cookie and then
            // redirects to the page the user originally requested.
            // Set second parameter to false so cookie is not persistent
            // across sessions.
            FormsAuthentication.RedirectFromLoginPage(
                model.UserName, false);
        }
        else
        {
            // If there is no RequestUrl query string attribute, just set
            // the authentication cookie. Provide navigation on the login page
            // to pages that require authentication, or user can use browser
            // to navigate to protected pages.
            // Set second parameter to false so cookie is not persistent
            // across sessions.
            FormsAuthentication.SetAuthCookie(model.UserName, false);
        }
    }
    else
    {
      //  Response.Write("Invalid UserID and Password");
        ModelState.AddModelError("", "The user name or password provided is incorrect.");
        return View(model);
    }
    ////////////
    //if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
    //{
        return RedirectToLocal(returnUrl);
    //}

    // If we got this far, something failed, redisplay form

}

但当前当用户尝试登录时,他将始终收到以下消息

•The user name or password provided is incorrect. 

所以你能建议我的代码是否正确吗?

共有1个答案

薄兴昌
2023-03-14

您必须在加入DomainB的服务器上部署类似Active Directory Federation Services的SSO解决方案。

然后在应用程序中实现针对SSO解决方案的身份验证(例如,WS-Federation被动请求程序)和针对DomainA的标准Windows身份验证。

 类似资料:
  • 我的任务是为我们的客户实施单点登录,作为我们下一个版本的一部分。流程如下: 用户使用学校提供给他/她的学生ID/密码登录学校的主要门户系统。 用户点击我公司产品的链接。 用户会自动进入仪表板页面,就好像他们刚刚通过我们网站上的登录表单登录一样。 因此,有两种机制可以将用户验证到我们的站点: 访问我们产品的主页,并使用我们存储在本地系统中的电子邮件/密码登录。 使用单点登录,学生已经使用学生id和密

  • 是否有标准或经过验证的模型以sso方式对同一设备上的各种应用程序进行身份验证? 假设设备上有两个应用程序,它们需要相同的登录/密码凭据才能对同一系统进行身份验证。 我们希望能够: -启动APP1 -登录APP1 -启动APP2。在app2中,用户已经通过身份验证。 我们认为是一个“pop”模型,其中第一个进行登录的应用程序共享身份验证的信息(例如,令牌)。第二个应用程序,获取(弹出)令牌来执行SS

  • 我使用JMeter加载测试ASP. net应用程序。我能够成功记录登录功能 HTTPRequestDefaults HTTPCookieManager 线程组 记录控制器 登录请求后,我提取了

  • 注意 所有OAuth2 SSO和资源服务器功能在版本1.3中移动到Spring Boot。您可以在Spring Boot用户指南中找到文档 。 该项目提供从CloudFoundry服务凭据到Spring Boot功能的自动绑定。如果您有一个称为“sso”的CloudFoundry服务,例如,使用包含“client_id”,“client_secret”和“auth_domain”的凭据,它将自动绑

  • 地址URL https://api.es.xiaojukeji.com/river/Login/getLoginEncryptStr 返回数据格式 JSON 请求方式 GET 是否需要登录 是 关于登录授权,参见 如何登录授权 访问授权限制 暂无 请求参数 名称 类型 必选 描述 client_id string yes 申请应用时分配的AppKey access_token string yes

  • 接口说明: 接口类型:主动调用接口。 接口作用:可通过调用该接口来获取一个临时的URL,通过访问该URL即可直接进入某账号的智齿客服后台,从而实现单点登录的业务。 请求方式: POST 请求地址: https(http)://www.sobot.com/api/oss/5/direct_url 注:使用https请求返回的登录链接是https协议的,使用http请求,返回的登录链接就是http协