Skip to content

Commit 83f839f

Browse files
authored
Add RS256 key file documentation
1 parent ce0b25d commit 83f839f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ auth_jwt_loginurl "https://yourdomain.com/loginpage";
4545
auth_jwt_enabled on;
4646
auth_jwt_algorithm HS256; # or RS256
4747
auth_jwt_validate_email on; # or off
48+
auth_jwt_use_keyfile off; # or on
49+
auth_jwt_keyfile_path "/app/pub_key";
4850
```
4951

5052
The default algorithm is 'HS256', for symmetric key validation. When using HS256, the value for `auth_jwt_key` should be specified in binhex format. It is recommended to use at least 256 bits of data (32 pairs of hex characters or 64 characters in total) as in the example above. Note that using more than 512 bits will not increase the security. For key guidelines please see NIST Special Publication 800-107 Recommendation for Applications Using Approved Hash Algorithms, Section 5.3.2 The HMAC Key.
5153

52-
The configuration also supports the `auth_jwt_algorithm` 'RS256', for RSA 256-bit public key validation. If using "auth_jwt_algorithm RS256;", then the `auth_jwt_key` field must be set to your public key.
54+
The configuration also supports the `auth_jwt_algorithm` 'RS256', for RSA 256-bit public key validation. If using "auth_jwt_algorithm RS256;", then the `auth_jwt_key` field must be set to your public key **OR** `auth_jwt_use_keyfile` should be set to `on` with the `auth_jwt_keyfile_path` set to the public key path (which defaults to `"/app/pub_key"`).
5355
That is the public key, rather than a PEM certificate. I.e.:
5456

5557
```
@@ -64,6 +66,13 @@ oQIDAQAB
6466
-----END PUBLIC KEY-----";
6567
```
6668

69+
**OR**
70+
71+
```
72+
auth_jwt_use_keyfile on;
73+
auth_jwt_keyfile_path "/etc/nginx/pub_key.pem";
74+
```
75+
6776
A typical use would be to specify the key and loginurl on the main level
6877
and then only turn on the locations that you want to secure (not the login page).
6978
Unauthorized requests are given 302 "Moved Temporarily" responses with a ___location of the specified loginurl.

0 commit comments

Comments
 (0)