-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NTML Auth Option for HTTP #1639
Conversation
@louislam What is your preferred way to add this in? I was initially thinking add a dropdown for auth method (as there is also negotiate which someone might ask for one day). This would add another db field to know what type of auth. But in the code,
it is checking if there is a username and then trying to login. So I probably cannot share the columns? And going forward, the dropdown would populate that column and it could be used to determine what type of auth to use. What do you think? |
I think we should find a suitable library first. Currently http(s) monitor is fully based on axios http client, which means if you want to add a NTML, it have to do it on axios. The library you mentioned in #1634 is not a node module and it looks like for browser only, I don't think it could work with axios. So it is better to test libraries and find the best one before start. |
Ops, I forgot to update that, there is actually a node module https://www.npmjs.com/package/httpntlm I tested out and it works very simply. I'll make a proof of concept. Basic: var httpntlm = require('httpntlm');
httpntlm.get({
url: "https://example.net",
username: 'me',
password: 'pa$$',
workstation: '',
domain: ''
}, function (err, res){
if(err) {
console.log(err);
return
}
console.log(res.headers);
console.log(res.body);
console.log(res.statusCode)
}); |
After struggling w/ parameters from axios and httpntlm not matching, I found axios-ntlm, which is an axios implementation of ntlm... which made it pretty simple. What do you think about the database file? It seems like columns cannot be renamed easily in sqlite, so I left the Anyone who had an Going forward, the auth type would be based on the dropdown. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting and JSDoc comments look good. 👍
@Computroniks thank you! |
# Conflicts: # package-lock.json # package.json # server/database.js # server/model/monitor.js # server/server.js # server/util-server.js
Thanks! |
I should note - workstation is a required field for axios-ntml. If it is left blank there will be an error "Cannot read property 'length' of null". I think this can be fixed by workstation: this.authWorkstation || "Uptime-Kuma", I will pr as it is a pain in the neck to fill in a fairly useless field. |
<label for="method" class="form-label">{{ $t("Method") }}</label> | ||
<select id="method" v-model="monitor.authMethod" class="form-select"> | ||
<option :value="null"> | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add translation
None | ||
</option> | ||
<option value="basic"> | ||
Basic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add translation
@Saibamen my bad, thanks, I'll put it in a separate pr. |
Description
Fixes #1634
This pr is to add an option for http(s) authentication against IIS servers that are using the "Windows Authentication" feature. It turns out there is already a nice npm package that handles this very simply httpntml.
Type of change
This change will add an option in the monitor editor for http, in the auth section, for "NTML Authentication".
Checklist
(including JSDoc for methods)
Screenshots