How to protect a route if using shield ? |
Hi,
I'm new to CI4. I'm trying to make a simple website with admin backend and just installed shield. How can I protect the /admin route using shield ? It seems shield is also new and much documentation is not available. Can anyone please guide / help ? Thanks in advance.
Hi, to protect /admin refer to the method explained here:
https://codeigniter4.github.io/shield/in...-all-pages Documents are available here: https://codeigniter4.github.io/shield Use https://github.com/codeigniter4/shield/discussions if you need to ask a question.
Hi,
When I do the following: --- $routes->get('admin', ' App\Controllers\Admin\Admin::index', ['filter' => 'admin-auth']); --- I get error: --- CodeIgniter\Filters\Exceptions\FilterException #3 admin-auth filter must have a matching alias defined. --- Any help ? Thanks.
What is admin-auth?!
Shield currently has six filters, session, tokens, chained , auth-rates, permission and group. You can use it as follows: PHP Code: $routes->get('/admin', 'Admin\Admin::index' ,['filter' => 'session']); I edited this post, added two new filters permission and group in the development branch. Also, spelling mistake sessions was corrected. |
Welcome Guest, Not a member yet? Register Sign In |