From 6e4bc358f5739666ef579ad49d948fb70508dda6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 12 Oct 2023 21:02:20 +0200 Subject: [PATCH] Remove http-basic-auth-cred, replaced by http-basic-auth-multiple --- README.md | 41 ++++++++++++++------------- nodes/http-auth-cred.html | 34 ----------------------- nodes/http-auth-cred.js | 13 --------- nodes/http-auth.html | 58 ++++++++++++++++----------------------- package.json | 1 - 5 files changed, 46 insertions(+), 101 deletions(-) delete mode 100644 nodes/http-auth-cred.html delete mode 100644 nodes/http-auth-cred.js diff --git a/README.md b/README.md index e9c05c5..af98a7f 100644 --- a/README.md +++ b/README.md @@ -22,36 +22,39 @@ curl 'https://test:test@nodered.example.net/basic-auth-demo' ## Config -There are three type of configuration: +There are three types of configuration: 1. *Simple*: each node has it’s own credentials. (one credential) -2. *Shared*: credentials shared with multiple nodes. (one credential) -3. *File*: the user credentials are stored in a file. (multiple credentials) +2. *Multiple credentials*: credentials shared with multiple nodes. (multiple credentials) +3. *File with multiple credentials*: the user credentials are stored in a file. (multiple credentials) -With all three config types you must specify the following: +## Definitions -- *Realm*: what authorization realm will be used with this node. +* *Username* + * The username + * Example: `alice` -With *Simple* and *Shared* config types you must specify the following: +* *Realm* + * Authorization realm for which the credentials will be valid + * Example: `node-red` -- *Username*: the username -- *Password*: the password may be in plain-text or hashed (only bcrypt is supported). - Example of hashed password `test`: +* *Password* + * The password may be in plain-text or hashed (only bcrypt is supported) + * Example in plain-text: `test` + * Example in bcrypt: `$2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6` -```plain -$2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6 -``` +* *File* + * Location of the file containing the credentials relative to the presently working directory + * Example: `/data/.credentials` + * The format for each line is `user:realm:password` -With *File* config type you must specify the following: + -- File: location of the file containing the credentials relative to the presently working directory. - The format for each line is `user:realm:password`. - The passwords may be in plain-text or hashed (only bcrypt is supported). - Example of file: +Example of file: ```plain -user1:application1:test -user2:application1:$2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6 +user1:node-red:test +user2:node-red:$2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6 ``` ## Hints diff --git a/nodes/http-auth-cred.html b/nodes/http-auth-cred.html deleted file mode 100644 index 328d53b..0000000 --- a/nodes/http-auth-cred.html +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/nodes/http-auth-cred.js b/nodes/http-auth-cred.js deleted file mode 100644 index 96269e2..0000000 --- a/nodes/http-auth-cred.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = function (RED) { - 'use strict'; - - function HttpAuthCredNode(config) { - RED.nodes.createNode(this, config); - - this.realm = config.realm; - this.username = config.username; - this.password = config.password; - } - - RED.nodes.registerType('http-basic-auth-cred', HttpAuthCredNode); -}; diff --git a/nodes/http-auth.html b/nodes/http-auth.html index abb112b..e3eae5e 100644 --- a/nodes/http-auth.html +++ b/nodes/http-auth.html @@ -7,7 +7,6 @@ defaults: { name: { value: '' }, file: { value: '', type: 'http-basic-auth-file', required: false }, - cred: { value: '', type: 'http-basic-auth-cred', required: false }, multiple: { value: '', type: 'http-basic-auth-multiple', required: false }, realm: { value: '' }, username: { value: '' }, @@ -47,23 +46,15 @@
- Option 2: Shared + Option 2: Multiple credentials
- - -
-
- -
- Option 3: Multiple -
- +
- Option 4: File + Option 3: File with multiple credentials
@@ -84,32 +75,31 @@

Config

-

There are three type of configuration:

+

There are three types of configuration:

  1. Simple: each node has it’s own credentials. (one credential)
  2. -
  3. Shared: credentials shared with multiple nodes. (one credential)
  4. -
  5. File: the user credentials are stored in a file. (multiple credentials)
  6. +
  7. Multiple credentials: credentials shared with multiple nodes. (multiple credentials)
  8. +
  9. File with multiple credentials: the user credentials are stored in a file. (multiple credentials)
-

With all three config types you must specify the following:

-
    -
  • Realm: what authorization realm will be used with this node
  • -
+

Definitions

+
+
Username
+
The username
+
Example: alice + +
Realm
+
Authorization realm for which the credentials will be valid
+
Example: node-red
-

With Simple and Shared config types you must specify the following:

-
    -
  • Username: the username
  • -
  • - Password: the password may be in plain-text or hashed (only bcrypt is supported). -
  • -
+
Password
+
The password may be in plain-text or hashed (only bcrypt is supported)
+
Example in plain-text: test
+
Example in bcrypt: $2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6
-

With File config type you must specify the following:

-
    -
  • - File: location of the file containing the credentials relative to the presently working directory.
    - The format for each line is user:realm:password.
    - The passwords may be in plain-text or hashed (only bcrypt is supported). -
  • -
+
File
+
Location of the file containing the credentials relative to the presently working directory
+
Example: /data/.credentials
+
The format for each line is user:realm:password
+
diff --git a/package.json b/package.json index 9a1d081..cb7357d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "version": ">=2.0.0", "nodes": { "http-basic-auth": "nodes/http-auth.js", - "http-basic-auth-cred": "nodes/http-auth-cred.js", "http-basic-auth-file": "nodes/http-auth-file.js", "http-basic-auth-multiple": "nodes/http-auth-multiple.js" }