mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -08:00
✨ Add digestAuth support to HTTP Request-Node
This commit is contained in:
parent
a24918021c
commit
74c2d9a366
|
@ -0,0 +1,28 @@
|
||||||
|
import {
|
||||||
|
ICredentialType,
|
||||||
|
NodePropertyTypes,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
|
||||||
|
export class HttpDigestAuth implements ICredentialType {
|
||||||
|
name = 'httpDigestAuth';
|
||||||
|
displayName = 'Digest Auth';
|
||||||
|
properties = [
|
||||||
|
{
|
||||||
|
displayName: 'User',
|
||||||
|
name: 'user',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
default: '',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Password',
|
||||||
|
name: 'password',
|
||||||
|
type: 'string' as NodePropertyTypes,
|
||||||
|
typeOptions: {
|
||||||
|
password: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
|
@ -44,6 +44,17 @@ export class HttpRequest implements INodeType {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'httpDigestAuth',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
authentication: [
|
||||||
|
'digestAuth',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'httpHeaderAuth',
|
name: 'httpHeaderAuth',
|
||||||
required: true,
|
required: true,
|
||||||
|
@ -66,6 +77,10 @@ export class HttpRequest implements INodeType {
|
||||||
name: 'Basic Auth',
|
name: 'Basic Auth',
|
||||||
value: 'basicAuth'
|
value: 'basicAuth'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Digest Auth',
|
||||||
|
value: 'digestAuth'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Header Auth',
|
name: 'Header Auth',
|
||||||
value: 'headerAuth'
|
value: 'headerAuth'
|
||||||
|
@ -337,6 +352,7 @@ export class HttpRequest implements INodeType {
|
||||||
const parametersAreJson = this.getNodeParameter('jsonParameters', 0) as boolean;
|
const parametersAreJson = this.getNodeParameter('jsonParameters', 0) as boolean;
|
||||||
|
|
||||||
const httpBasicAuth = this.getCredentials('httpBasicAuth');
|
const httpBasicAuth = this.getCredentials('httpBasicAuth');
|
||||||
|
const httpDigestAuth = this.getCredentials('httpDigestAuth');
|
||||||
const httpHeaderAuth = this.getCredentials('httpHeaderAuth');
|
const httpHeaderAuth = this.getCredentials('httpHeaderAuth');
|
||||||
|
|
||||||
let url: string, responseFormat: string;
|
let url: string, responseFormat: string;
|
||||||
|
@ -428,6 +444,13 @@ export class HttpRequest implements INodeType {
|
||||||
if (httpHeaderAuth !== undefined) {
|
if (httpHeaderAuth !== undefined) {
|
||||||
requestOptions.headers![httpHeaderAuth.name as string] = httpHeaderAuth.value;
|
requestOptions.headers![httpHeaderAuth.name as string] = httpHeaderAuth.value;
|
||||||
}
|
}
|
||||||
|
if (httpDigestAuth !== undefined) {
|
||||||
|
requestOptions.auth = {
|
||||||
|
user: httpDigestAuth.user as string,
|
||||||
|
pass: httpDigestAuth.password as string,
|
||||||
|
sendImmediately: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Now that the options are all set make the actual http request
|
// Now that the options are all set make the actual http request
|
||||||
const response = await this.helpers.request(requestOptions);
|
const response = await this.helpers.request(requestOptions);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"dist/credentials/GithubApi.credentials.js",
|
"dist/credentials/GithubApi.credentials.js",
|
||||||
"dist/credentials/GoogleApi.credentials.js",
|
"dist/credentials/GoogleApi.credentials.js",
|
||||||
"dist/credentials/HttpBasicAuth.credentials.js",
|
"dist/credentials/HttpBasicAuth.credentials.js",
|
||||||
|
"dist/credentials/HttpDigestAuth.credentials.js",
|
||||||
"dist/credentials/HttpHeaderAuth.credentials.js",
|
"dist/credentials/HttpHeaderAuth.credentials.js",
|
||||||
"dist/credentials/Imap.credentials.js",
|
"dist/credentials/Imap.credentials.js",
|
||||||
"dist/credentials/LinkFishApi.credentials.js",
|
"dist/credentials/LinkFishApi.credentials.js",
|
||||||
|
|
Loading…
Reference in a new issue