简体   繁体   English

如何进行自动身份验证以自动登录网站?

[英]How to do Auto authentication for automatically login to website?

I need to get automatically login to website from my windows application. 我需要从Windows应用程序自动登录网站。 I am doing it with HttpWebRequest but what i want is to 我正在用HttpWebRequest来做,但是我想要的是

  1. Click on the button in my application. 单击我的应用程序中的按钮。
  2. Open the Index page (page after getting login) 打开索引页面(登录后的页面)

Reason : I don't want to enter user name and pasword, i just want to click button and any browser(default browser) open with index page (page after login) 原因 :我不想输入用户名和密码,我只想单击按钮,然后使用索引页面(登录后的页面)打开任何浏览器(默认浏览器)

Normal Example : 正常示例:

  1. I open a link " http://mail.yahoo.com " it shows me a page asking my email address and password. 我打开一个链接“ http://mail.yahoo.com ”,它向我显示一个页面,询问我的电子邮件地址和密码。
  2. I enter the email id and password and press Login. 我输入电子邮件ID和密码,然后按登录。
  3. It redirects me to my Mail box page. 它将我重定向到我的“邮箱”页面。

What to Do ? 该怎么办 ?

  1. click on the button 点击按钮
  2. Automatically send my email id or user name and password to the website 自动将我的电子邮件ID或用户名和密码发送到网站
  3. Open my Mail box page. 打开我的邮箱页面。

Hint : 提示:

  1. get cookie from HttpWebRequest. 从HttpWebRequest获取cookie。
  2. set it to the browser. 将其设置为浏览器。
  3. Open browser and pass the credentials to login automatcially 打开浏览器并传递凭据以自动登录

can anyone help me? 谁能帮我?

I also need to solve the same issue, and the problem is hint point 2 in your list. 我还需要解决相同的问题,问题是您列表中的提示点2。 ie. 即。 how to set a cookie in a browser, without limiting yourself to using a specific broswer. 如何在浏览器中设置Cookie,而又不局限于使用特定的浏览器。 The conclusion I am coming to, is that I need to use a standard 'Single Sign-On' logic, where we update the web-server to use short term tokens such as mentioned here... http://msdn.microsoft.com/en-us/library/ms972971.aspx 我得出的结论是,我需要使用标准的“单点登录”逻辑,在该逻辑中,我们更新Web服务器以使用诸如此处所述的短期令牌…… http://msdn.microsoft。 com / zh-CN / library / ms972971.aspx

In this case the steps would be something like: 在这种情况下,步骤将类似于:
1. In app - Logon with HttpWebRequest. 1.在应用程序中-使用HttpWebRequest登录。
2. Get short-term token (the link suggests validity lifetime of just 2 seconds) 2.获取短期令牌(该链接建议有效期仅为2秒)
3. Open browser with url http://MyWebsite>/SignNn?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx 3.使用URL http://MyWebsite>/SignNn?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxx打开浏览器
4. Next I need to confirm if the SignOn process can return cookies correctly. 4.接下来,我需要确认SignOn进程是否可以正确返回cookie。

I dont think you can solve this in a generic way. 我认为您无法以一般方式解决此问题。
What usually happens in such scenarios is that the form within the web page is submited to web server, the web server reads the user name / password values from the form and authenticates the user against the underlying user managment repository. 在这种情况下,通常发生的情况是将网页中的表单提交给Web服务器,Web服务器从表单中读取用户名/密码值,并根据基础用户管理存储库对用户进行身份验证。
You can write such a solution for specific sites, by analzying with a sniffer the posted form in the authentication pages, and then creating such an http message yourself and sending it to the relevant site. 您可以通过嗅探器在身份验证页面中张贴的表单进行分析,然后自己创建此类http消息并将其发送到相关站点,从而为特定站点编写这样的解决方案。

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

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