Skip to content

Commit

Permalink
Remove http-basic-auth-cred, replaced by http-basic-auth-multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex committed Oct 12, 2023
1 parent 1b8640c commit 6e4bc35
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 101 deletions.
41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,39 @@ curl 'https://test:[email protected]/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:
</dl>

- 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
Expand Down
34 changes: 0 additions & 34 deletions nodes/http-auth-cred.html

This file was deleted.

13 changes: 0 additions & 13 deletions nodes/http-auth-cred.js

This file was deleted.

58 changes: 24 additions & 34 deletions nodes/http-auth.html
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' },
Expand Down Expand Up @@ -47,23 +46,15 @@
</fieldset>

<fieldset>
<legend>Option 2: Shared</legend>
<legend>Option 2: Multiple credentials</legend>
<div class="form-row">
<label for="node-input-cred"><i class="fa fa-list"></i> Credentials</label>
<input type="text" id="node-input-cred" />
</div>
</fieldset>

<fieldset>
<legend>Option 3: Multiple</legend>
<div class="form-row">
<label for="node-input-cred"><i class="fa fa-list"></i> Credentials</label>
<label for="node-input-multiple"><i class="fa fa-list"></i> Credentials</label>
<input type="text" id="node-input-multiple" />
</div>
</fieldset>

<fieldset>
<legend>Option 4: File</legend>
<legend>Option 3: File with multiple credentials</legend>
<div class="form-row">
<label for="node-input-file"><i class="fa fa-list"></i> File</label>
<input type="text" id="node-input-file" />
Expand All @@ -84,32 +75,31 @@
<p>

<h2>Config</h2>
<p>There are three type of configuration:</p>
<p>There are three types of configuration:</p>
<ol>
<li><i>Simple</i>: each node has it’s own credentials. (one credential)</li>
<li><i>Shared</i>: credentials shared with multiple nodes. (one credential)</li>
<li><i>File</i>: the user credentials are stored in a file. (multiple credentials)</li>
<li><i>Multiple credentials</i>: credentials shared with multiple nodes. (multiple credentials)</li>
<li><i>File with multiple credentials</i>: the user credentials are stored in a file. (multiple credentials)</li>
</ol>

<p>With all three config types you must specify the following:</p>
<ul>
<li><i>Realm</i>: what authorization realm will be used with this node</li>
</ul>
<h2>Definitions</h2>
<dl>
<dt>Username</dt>
<dd>The username</dd>
<dd>Example: <kbd>alice</kbd>

<dt>Realm</dt>
<dd>Authorization realm for which the credentials will be valid</dd>
<dd>Example: <kbd>node-red</kbd></dd>

<p>With <i>Simple</i> and <i>Shared</i> config types you must specify the following:</p>
<ul>
<li><i>Username</i>: the username</li>
<li>
<i>Password</i>: the password may be in plain-text or hashed (only bcrypt is supported).
</li>
</ul>
<dt>Password</dt>
<dd>The password may be in plain-text or hashed (only bcrypt is supported)</dd>
<dd>Example in plain-text: <kbd>test</kbd></dd>
<dd>Example in bcrypt: <kbd>$2y$10$5TSZDldoJ7MxDZdtK/SG2O3cwORqLDhHabYlKX9OsM.W/Z/oLwKW6</kbd></dd>

<p>With <i>File</i> config type you must specify the following:</p>
<ul>
<li>
<i>File</i>: location of the file containing the credentials relative to the presently working directory.<br />
The format for each line is <code>user:realm:password</code>.<br />
The passwords may be in plain-text or hashed (only bcrypt is supported).
</li>
</ul>
<dt>File</dt>
<dd>Location of the file containing the credentials relative to the presently working directory</dd>
<dd>Example: <kbd>/data/.credentials</kbd></dd>
<dd>The format for each line is <kbd>user:realm:password</kbd></dd>
</dl>
</script>
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down

0 comments on commit 6e4bc35

Please sign in to comment.