简体   繁体   English

如何在不知道SSO场景中的DotNetNuke密码的情况下将某人登录到DotNetNuke?

[英]How can I log someone into DotNetNuke without knowing their DotNetNuke password in an SSO scenario?

We are setting up a single sign on system to handle authentication and authorization among our different systems (almost all of which are not DNN systems). 我们正在建立单一登录系统,以处理我们不同系统(几乎所有系统都不是DNN系统)之间的身份验证和授权。

The idea is that the user will be given a link by the central authentication system that redirects them to the DotNetNuke system with an authentication token. 我们的想法是,中央身份验证系统会为用户提供一个链接,使用身份验证令牌将其重定向到DotNetNuke系统。 I then need to take that authentication token, verify that it's legit, and if so log that user into DNN. 然后,我需要获取该身份验证令牌,验证它是否合法,如果是,则将该用户登录到DNN。 The problem with this workflow is that I have no idea of the user's password. 这个工作流程的问题是我不知道用户的密码。

Previously, when I have created custom login interfaces I logged the user in by calling: 以前,当我创建自定义登录界面时,我通过调用以下方式登录用户:

var portalSettings = PortalSettings.Current;
UserController.UserLogin(portalSettings.PortalId, username, password, string.Empty, portalSettings.PortalName, ip, ref loginStatus, true);

This obviously won't work if I do not know what their password is in the DNN/Asp.net forms authentication system. 如果我不知道DNN / Asp.net表单身份验证系统中的密码是什么,这显然是行不通的。

Since this is not a new system but is a system currently being used in production without SSO, I cannot just set everyone's password to "pass1234" and require them login via SSO method only. 由于这不是一个新系统,而是一个目前在没有SSO的生产中使用的系统,我不能只将每个人的密码设置为“pass1234”并要求他们仅通过SSO方法登录。

How can I tell DotNetNuke to log in as a user without knowing their exact password? 如何在不知道确切密码的情况下告诉DotNetNuke以用户身份登录?

There is an additional overload to the UserController that takes a "UserInfo" object. UserController还有一个带有“UserInfo”对象的额外重载。

Use UserController.GetUserByName to get the actual user from the system, then you can pass that object into the Userlogin method and you are good to go! 使用UserController.GetUserByName从系统中获取实际用户,然后您可以将该对象传递给Userlogin方法,您就可以开始了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM