You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3KB

  1. <?php
  2. namespace Config;
  3. use App\Filters\AdminFilter;
  4. use App\Filters\FormularioInicialFilter;
  5. use App\Filters\InicioFilter;
  6. use CodeIgniter\Config\BaseConfig;
  7. use CodeIgniter\Filters\CSRF;
  8. use CodeIgniter\Filters\DebugToolbar;
  9. use CodeIgniter\Filters\Honeypot;
  10. use CodeIgniter\Filters\InvalidChars;
  11. use CodeIgniter\Filters\SecureHeaders;
  12. class Filters extends BaseConfig
  13. {
  14. /**
  15. * Configures aliases for Filter classes to
  16. * make reading things nicer and simpler.
  17. *
  18. * @var array
  19. */
  20. public $aliases = [
  21. 'csrf' => CSRF::class,
  22. 'toolbar' => DebugToolbar::class,
  23. 'honeypot' => Honeypot::class,
  24. 'invalidchars' => InvalidChars::class,
  25. 'secureheaders' => SecureHeaders::class,
  26. 'login' => \Myth\Auth\Filters\LoginFilter::class,
  27. 'role' => \Myth\Auth\Filters\RoleFilter::class,
  28. 'inicio' => InicioFilter::class,
  29. 'formulario_inicial' => FormularioInicialFilter::class,
  30. 'admin_filter' => AdminFilter::class,
  31. ];
  32. /**
  33. * List of filter aliases that are always
  34. * applied before and after every request.
  35. *
  36. * @var array
  37. */
  38. public $globals = [
  39. 'before' => [
  40. // 'honeypot',
  41. // 'csrf',
  42. // 'invalidchars',
  43. // 'login'
  44. ],
  45. 'after' => [
  46. 'toolbar',
  47. // 'honeypot',
  48. // 'secureheaders',
  49. ],
  50. ];
  51. /**
  52. * List of filter aliases that works on a
  53. * particular HTTP method (GET, POST, etc.).
  54. *
  55. * Example:
  56. * 'post' => ['foo', 'bar']
  57. *
  58. * If you use this, you should disable auto-routing because auto-routing
  59. * permits any HTTP method to access a controller. Accessing the controller
  60. * with a method you don’t expect could bypass the filter.
  61. *
  62. * @var array
  63. */
  64. public $methods = [
  65. 'post' => ['csrf'],
  66. ];
  67. /**
  68. * List of filter aliases that should run on any
  69. * before or after URI patterns.
  70. *
  71. * Example:
  72. * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
  73. *
  74. * @var array
  75. */
  76. public $filters = [
  77. 'login' => ['before' => ['/', 'registro/', 'encuesta/*']],
  78. 'inicio' => ['before' => ['/']],
  79. 'formulario_inicial' => ['before' => ['registro/']],
  80. ];
  81. }