[英]Remove authentication required popup on Azure Active directory with .net core
I am using .net core 2.0 application with ADFS for authentication. 我使用带有ADFS的.net core 2.0应用程序进行身份验证。 When I access web app from linux, I get additional authentication required po up on office network. 当我从linux访问Web应用程序时,我在办公室网络上获得了需要的其他身份验证。 Pop up not asked in outside office network or office device. 在外部办公网络或办公设备中弹出询问。
i need to remove the additional popup or enter user credentials with Nightwatch automation test. 我需要删除其他弹出窗口或使用Nightwatch自动化测试输入用户凭据。
Neither Nightwatch nor underlying Selenium doesn't support interaction with this popup unfortunately, but what you can do is to pass username and password with URL: 不幸的是,Nightwatch和基础Selenium都不支持与此弹出窗口的交互,但是您可以做的是通过URL传递用户名和密码:
client
.url('https://username:password@example.com')
Update: 更新:
The solution above won't work if the URL you open the first doesn't require auth (and looks like this is your case). 如果您打开的第一个URL不需要身份验证(看起来就是这种情况),则上述解决方案将无法使用。
What you can do, is to pre-authenticate browser before running actual test by visiting any URL which requires auth, so auth header will be added for every next request in this browser session. 您可以做的是,在运行实际测试之前通过访问任何需要身份验证的URL来对浏览器进行预身份验证,因此将为此浏览器会话中的每个下一个请求添加身份验证标头。 You might as well use before
hook of your test suite: 您不妨before
连接测试套件before
使用:
module.exports = {
before: function(client, done) {
client.url('https://username:password@someurl.com/auth').perform(function() {
done();
});
},
...
};
Another approach would be to create a custom browser profile which is already logged in. 另一种方法是创建已登录的自定义浏览器配置文件。
A useful discussion on how to pass a custom firefox profile: https://github.com/nightwatchjs/nightwatch/issues/1543 关于如何传递自定义firefox配置文件的有用讨论: https : //github.com/nightwatchjs/nightwatch/issues/1543
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.