Powered By GitBook
Username/Password
You can authenticate one or more clients using username and passwords; this enables you to have greater control over the management and issuance of credential secrets.
For a single user:
1
authorization: {
2
user: a,
3
password: b
4
}
Copied!
You can also specify a single username/password by:
1
> nats-server --user a --pass b
Copied!
For multiple users:
1
authorization: {
2
users: [
3
{user: a, password: b},
4
{user: b, password: a}
5
]
6
}
Copied!

Bcrypted Passwords

Username/password also supports bcrypted passwords using the nats tool. Simply replace the clear text password with the bcrypted entries:
1
> nats server passwd
2
? Enter password [? for help] **********************
3
? Reenter password [? for help] **********************
4
5
$2a$11$V1qrpBt8/SLfEBr4NJq4T.2mg8chx8.MTblUiTBOLV3MKDeAy.f7u
Copied!
And on the configuration file:
1
authorization: {
2
users: [
3
{user: a, password: "$2a$11$V1qrpBt8/SLfEBr4NJq4T.2mg8chx8.MTblUiTBOLV3MKDeAy.f7u"},
4
...
5
]
6
}
Copied!

Reloading a Configuration

As you add/remove passwords from the server configuration file, you'll want your changes to take effect. To reload without restarting the server and disconnecting clients, do:
1
> nats-server --signal reload
Copied!
Last modified 8mo ago
Export as PDF
Copy link