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
The following items have been added. Copy the properties in **src/Config/Auth.php**.
31
+
32
+
- `permission_denied` and `group_denied` are added to `Config\Auth::$redirects`.
33
+
- `permissionDeniedRedirect()` and `groupDeniedRedirect()` are added.
34
+
35
+
### Fix Custom Filter If extends `AbstractAuthFilter`
36
+
37
+
If you have written a custom filter that extends `AbstractAuthFilter`, now you need to add and implement the `redirectToDeniedUrl()` method to your custom filter.
38
+
The following example is related to the above explanation for **group** filter.
39
+
40
+
```php
41
+
/**
42
+
* If the user does not belong to the group, redirect to the configured URL with an error message.
43
+
*/
44
+
protected function redirectToDeniedUrl(): RedirectResponse
If you are using the HMAC authentication you need to update the encryption settings in **app/Config/AuthToken.php**.
56
+
You will need to update and set the encryption key in `$hmacEncryptionKeys`. This should be set using **.env** and/or
57
+
system environment variables. Instructions on how to do that can be found in the
58
+
[Setting Your Encryption Key](https://codeigniter.com/user_guide/libraries/encryption.html#setting-your-encryption-key)
59
+
section of the CodeIgniter 4 documentation and in [HMAC SHA256 Token Authenticator](./docs/references/authentication/hmac.md#hmac-secret-key-encryption).
60
+
61
+
You also may wish to adjust the default Driver `$hmacEncryptionDefaultDriver` and the default Digest
62
+
`$hmacEncryptionDefaultDigest`, these currently default to `'OpenSSL'` and `'SHA512'` respectively.
63
+
64
+
#### Encrypt Existing Keys
65
+
66
+
After updating the key in `$hmacEncryptionKeys` value, you will need to run `php spark shield:hmac encrypt` in order
67
+
to encrypt any existing HMAC tokens. This only needs to be run if you have existing unencrypted HMAC secretKeys in
Copy file name to clipboardExpand all lines: docs/addons/jwt.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,10 @@ To use JWT Authentication, you need additional setup and configuration.
33
33
2. Copy the **AuthJWT.php** from **vendor/codeigniter4/shield/src/Config/** into your project's config folder and update the namespace to `Config`. You will also need to have these classes extend the original classes. See the example below.
0 commit comments