You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2024. It is now read-only.
So, a typical use would be to specify the key on the main level and then only
50
-
turn on the locations that you want to secure (not the login page). Unauthorized
51
-
requests are given 401 "Unauthorized" responses, you can redirect them with the
52
-
nginx's `error_page` directive.
53
-
54
-
```
55
-
___location @login_redirect {
56
-
allow all;
57
-
return 302 https://yourdomain.com/loginpage;
58
-
}
59
-
60
-
___location /secure-___location/ {
61
-
auth_jwt_enabled on;
62
-
error_page 401 = @login_redirect;
63
-
}
64
-
```
65
-
66
50
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.
67
51
68
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.
@@ -80,7 +64,15 @@ oQIDAQAB
80
64
-----END PUBLIC KEY-----";
81
65
```
82
66
83
-
This module supports two ways of presenting the token.
67
+
A typical use would be to specify the key and loginurl on the main level
68
+
and then only turn on the locations that you want to secure (not the login page).
69
+
Unauthorized requests are given 302 "Moved Temporarily" responses with a ___location of the specified loginurl.
70
+
71
+
```
72
+
auth_jwt_redirect off;
73
+
```
74
+
If you prefer to return 401 Unauthorized, you may turn `auth_jwt_redirect` off.
0 commit comments