Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Shield : Class 'Config\Session' not found
#1

(This post was last modified: 07-03-2022, 01:08 PM by Bertrand.)

Hello !

I'm tring to install the official Shield Package https://github.com/codeigniter4/shield.

I have this error : Class 'Config\Session' not found

It is throw by "VENDORPATH/codeigniter4/shield/src/Authentication/Authentication.php at line 56"

I'm not very familiar with CodeIgniter, and I don't find where is my error.

I have played all the installation decribed there : https://github.com/codeigniter4/shield/b...tial-setup

Do you have a idea where I can search in my code ?



app/Config/Auth.php :

PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Shield\Config\Auth as ShieldAuth;

class 
Auth extends ShieldAuth
{
    /**
    * ////////////////////////////////////////////////////////////////////
    * AUTHENTICATION
    * ////////////////////////////////////////////////////////////////////
    */
    public array $views = [
        'login'                      => '\CodeIgniter\Shield\Views\login',
        'register'                    => '\CodeIgniter\Shield\Views\register',
        'forgotPassword'              => '\CodeIgniter\Shield\Views\forgot_password',
        'resetPassword'              => '\CodeIgniter\Shield\Views\reset_password',
        'layout'                      => '\CodeIgniter\Shield\Views\layout',
        'action_email_2fa'            => '\CodeIgniter\Shield\Views\email_2fa_show',
        'action_email_2fa_verify'    => '\CodeIgniter\Shield\Views\email_2fa_verify',
        'action_email_2fa_email'      => '\CodeIgniter\Shield\Views\email_2fa_email',
        'action_email_activate_email' => '\CodeIgniter\Shield\Views\email_activate_email',
        'action_email_activate_show'  => '\CodeIgniter\Shield\Views\email_activate_show',
        'magic-link-login'            => '\CodeIgniter\Shield\Views\magic_link_form',
        'magic-link-message'          => '\CodeIgniter\Shield\Views\magic_link_message',
        'magic-link-email'            => '\CodeIgniter\Shield\Views\magic_link_email',
    ];

    /**
    * --------------------------------------------------------------------
    * Redirect urLs
    * --------------------------------------------------------------------
    * The default URL that a user will be redirected to after
    * various auth actions. If you need more flexibility you can
    * override the `getUrl()` method to apply any logic you may need.
    */
    public array $redirects = [
        'register' => '/',
        'login'    => '/',
        'logout'  => 'login',
    ];

    /**
    * --------------------------------------------------------------------
    * Authentication Actions
    * --------------------------------------------------------------------
    * Specifies the class that represents an action to take after
    * the user logs in or registers a new account at the site.
    *
    * Available actions with Shield:
    * - login:    CodeIgniter\Shield\Authentication\Actions\Email2FA
    * - register: CodeIgniter\Shield\Authentication\Actions\EmailActivator
    *
    * @var array<string, class-string<ActionInterface>|null>
    */
    public array $actions = [
        'login'    => null,
        'register' => null,
    ];

    /**
    * --------------------------------------------------------------------
    * Authenticators
    * --------------------------------------------------------------------
    * The available authentication systems, listed
    * with alias and class name. These can be referenced
    * by alias in the auth helper:
    *      auth('tokens')->attempt($credentials);
    *
    * @var array<string, class-string<AuthenticatorInterface>>
    */
    public array $authenticators = [
        'tokens'  => AccessTokens::class,
        'session' => Session::class,
    ];

    /**
    * --------------------------------------------------------------------
    * Name of Authenticator Header
    * --------------------------------------------------------------------
    * The name of Header that the Authorization token should be found.
    * According to the specs, this should be `Authorization`, but rare
    * circumstances might need a different header.
    */
    public array $authenticatorHeader = [
        'tokens' => 'Authorization',
    ];

    /**
    * --------------------------------------------------------------------
    * Unused Token Lifetime
    * --------------------------------------------------------------------
    * Determines the amount of time, in seconds, that an unused
    * access token can be used.
    */
    public int $unusedTokenLifetime YEAR;

    /**
    * --------------------------------------------------------------------
    * Default Authenticator
    * --------------------------------------------------------------------
    * The Authenticator to use when none is specified.
    * Uses the $key from the $authenticators array above.
    */
    public string $defaultAuthenticator 'session';

    /**
    * --------------------------------------------------------------------
    * Authentication Chain
    * --------------------------------------------------------------------
    * The Authenticators to test logged in status against
    * when using the 'chain' filter. Each Authenticator listed will be checked.
    * If no match is found, then the next in the chain will be checked.
    *
    * @var string[]
    * @phpstan-var list<string>
    */
    public array $authenticationChain = [
        'session',
        'tokens',
    ];

    /**
    * --------------------------------------------------------------------
    * Allow Registration
    * --------------------------------------------------------------------
    * Determines whether users can register for the site.
    */
    public bool $allowRegistration true;

    /**
    * --------------------------------------------------------------------
    * Record Last Active Date
    * --------------------------------------------------------------------
    * If true, will always update the `last_active` datetime for the
    * logged in user on every page request.
    */
    public bool $recordActiveDate true;

    /**
    * --------------------------------------------------------------------
    * Allow Magic Link Logins
    * --------------------------------------------------------------------
    * If true, will allow the use of "magic links" sent via the email
    * as a way to log a user in without the need for a password.
    * By default, this is used in place of a password reset flow, but
    * could be modified as the only method of login once an account
    * has been set up.
    */
    public bool $allowMagicLinkLogins true;

    /**
    * --------------------------------------------------------------------
    * Magic Link Lifetime
    * --------------------------------------------------------------------
    * Specifies the amount of time, in seconds, that a magic link is valid.
    */
    public int $magicLinkLifetime HOUR;

    /**
    * --------------------------------------------------------------------
    * Session Authenticator Configuration
    * --------------------------------------------------------------------
    * These settings only apply if you are using the Session Authenticator
    * for authentication.
    *
    * - field                  The name of the key the current user info is stored in session
    * - allowRemembering      Does the system allow use of "remember-me"
    * - rememberCookieName    The name of the cookie to use for "remember-me"
    * - rememberLength        The length of time, in seconds, to remember a user.
    *
    * @var array<string, bool|int|string>
    */
    public array $sessionConfig = [
        'field'              => 'user',
        'allowRemembering'  => true,
        'rememberCookieName' => 'remember',
        'rememberLength'    => 30 DAY,
    ];

    /**
    * --------------------------------------------------------------------
    * Minimum Password Length
    * --------------------------------------------------------------------
    * The minimum length that a password must be to be accepted.
    * Recommended minimum value by NIST = 8 characters.
    */
    public int $minimumPasswordLength 8;

    /**
    * --------------------------------------------------------------------
    * Password Check Helpers
    * --------------------------------------------------------------------
    * The PasswordValidator class runs the password through all of these
    * classes, each getting the opportunity to pass/fail the password.
    * You can add custom classes as long as they adhere to the
    * CodeIgniter\Shield\Authentication\Passwords\ValidatorInterface.
    *
    * @var class-string<ValidatorInterface>[]
    */
    public array $passwordValidators = [
        'CodeIgniter\Shield\Authentication\Passwords\CompositionValidator',
        'CodeIgniter\Shield\Authentication\Passwords\NothingPersonalValidator',
        'CodeIgniter\Shield\Authentication\Passwords\DictionaryValidator',
        //'CodeIgniter\Shield\Authentication\Passwords\PwnedValidator',
    ];

    /**
    * --------------------------------------------------------------------
    * Valid login fields
    * --------------------------------------------------------------------
    * Fields that are available to be used as credentials for login.
    */
    public array $validFields = [
        'email',
        'username',
    ];

    /**
    * --------------------------------------------------------------------
    * Additional Fields for "Nothing Personal"
    * --------------------------------------------------------------------
    * The NothingPersonalValidator prevents personal information from
    * being used in passwords. The email and username fields are always
    * considered by the validator. Do not enter those field names here.
    *
    * An extended User Entity might include other personal info such as
    * first and/or last names. $personalFields is where you can add
    * fields to be considered as "personal" by the NothingPersonalValidator.
    * For example:
    *    $personalFields = ['firstname', 'lastname'];
    */
    public array $personalFields = [];

    /**
    * --------------------------------------------------------------------
    * Password / Username Similarity
    * --------------------------------------------------------------------
    * Among other things, the NothingPersonalValidator checks the
    * amount of sameness between the password and username.
    * Passwords that are too much like the username are invalid.
    *
    * The value set for $maxSimilarity represents the maximum percentage
    * of similarity at which the password will be accepted. In other words, any
    * calculated similarity equal to, or greater than $maxSimilarity
    * is rejected.
    *
    * The accepted range is 0-100, with 0 (zero) meaning don't check similarity.
    * Using values at either extreme of the *working range* (1-100) is
    * not advised. The low end is too restrictive and the high end is too permissive.
    * The suggested value for $maxSimilarity is 50.
    *
    * You may be thinking that a value of 100 should have the effect of accepting
    * everything like a value of 0 does. That's logical and probably true,
    * but is unproven and untested. Besides, 0 skips the work involved
    * making the calculation unlike when using 100.
    *
    * The (admittedly limited) testing that's been done suggests a useful working range
    * of 50 to 60. You can set it lower than 50, but site users will probably start
    * to complain about the large number of proposed passwords getting rejected.
    * At around 60 or more it starts to see pairs like 'captain joe' and 'joe*captain' as
    * perfectly acceptable which clearly they are not.
    *
    * To disable similarity checking set the value to 0.
    *    public $maxSimilarity = 0;
    */
    public int $maxSimilarity 50;

    /**
    * --------------------------------------------------------------------
    * Encryption Algorithm to use
    * --------------------------------------------------------------------
    * Valid values are
    * - PASSWORD_DEFAULT (default)
    * - PASSWORD_BCRYPT
    * - PASSWORD_ARGON2I  - As of PHP 7.2 only if compiled with support for it
    * - PASSWORD_ARGON2ID - As of PHP 7.3 only if compiled with support for it
    *
    * If you choose to use any ARGON algorithm, then you might want to
    * uncomment the "ARGON2i/D Algorithm" options to suit your needs
    */
    public string $hashAlgorithm PASSWORD_DEFAULT;

    /**
    * --------------------------------------------------------------------
    * ARGON2i/D Algorithm options
    * --------------------------------------------------------------------
    * The ARGON2I method of encryption allows you to define the "memory_cost",
    * the "time_cost" and the number of "threads", whenever a password hash is
    * created.
    * This defaults to a value of 10 which is an acceptable number.
    * However, depending on the security needs of your application
    * and the power of your hardware, you might want to increase the
    * cost. This makes the hashing process takes longer.
    */
    public int $hashMemoryCost 2048;  // PASSWORD_ARGON2_DEFAULT_MEMORY_COST;

    public int $hashTimeCost 4;      // PASSWORD_ARGON2_DEFAULT_TIME_COST;
    public int $hashThreads  4;        // PASSWORD_ARGON2_DEFAULT_THREADS;

    /**
    * --------------------------------------------------------------------
    * Password Hashing Cost
    * --------------------------------------------------------------------
    * The BCRYPT method of encryption allows you to define the "cost"
    * or number of iterations made, whenever a password hash is created.
    * This defaults to a value of 10 which is an acceptable number.
    * However, depending on the security needs of your application
    * and the power of your hardware, you might want to increase the
    * cost. This makes the hashing process takes longer.
    *
    * Valid range is between 4 - 31.
    */
    public int $hashCost 10;

    /**
    * ////////////////////////////////////////////////////////////////////
    * OTHER SETTINGS
    * ////////////////////////////////////////////////////////////////////
    */
    /**
    * --------------------------------------------------------------------
    * User Provider
    * --------------------------------------------------------------------
    * The name of the class that handles user persistence.
    * By default, this is the included UserModel, which
    * works with any of the database engines supported by CodeIgniter.
    * You can change it as long as they adhere to the
    * CodeIgniter\Shield\Models\UserModel.
    *
    * @var class-string<UserModel>
    */
    public string $userProvider 'CodeIgniter\Shield\Models\UserModel';

    /**
    * Returns the URL that a user should be redirected
    * to after a successful login.
    */
    public function loginRedirect(): string
    
{
        $url setting('Auth.redirects')['login'];

        return $this->getUrl($url);
    }

    /**
    * Returns the URL that a user should be redirected
    * to after they are logged out.
    */
    public function logoutRedirect(): string
    
{
        $url setting('Auth.redirects')['logout'];

        return $this->getUrl($url);
    }

    /**
    * Returns the URL the user should be redirected to
    * after a successful registration.
    */
    public function registerRedirect(): string
    
{
        $url setting('Auth.redirects')['register'];

        return $this->getUrl($url);
    }

    protected function getUrl(string $url): string
    
{
        return strpos($url'http') === 0
            
$url
            
rtrim(site_url($url), '/ ');
    }


app/Config/App.php :


PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;
use 
CodeIgniter\Session\Handlers\FileHandler;

class 
App extends BaseConfig
{
    /**
    * --------------------------------------------------------------------------
    * Base Site URL
    * --------------------------------------------------------------------------
    *
    * URL to your CodeIgniter root. Typically this will be your base URL,
    * WITH a trailing slash:
    *
    *    http://example.com/
    *
    * If this is not set then CodeIgniter will try guess the protocol, domain
    * and path to your installation. However, you should always configure this
    * explicitly and never rely on auto-guessing, especially in production
    * environments.
    *
    * @var string
    */
    public $baseURL 'https://XXXXXXXXXXXXX/';

    /**
    * --------------------------------------------------------------------------
    * Index File
    * --------------------------------------------------------------------------
    *
    * Typically this will be your index.php file, unless you've renamed it to
    * something else. If you are using mod_rewrite to remove the page set this
    * variable so that it is blank.
    *
    * @var string
    */
    public $indexPage 'index.php';

    /**
    * --------------------------------------------------------------------------
    * URI PROTOCOL
    * --------------------------------------------------------------------------
    *
    * This item determines which getServer global should be used to retrieve the
    * URI string.  The default setting of 'REQUEST_URI' works for most servers.
    * If your links do not seem to work, try one of the other delicious flavors:
    *
    * 'REQUEST_URI'    Uses $_SERVER['REQUEST_URI']
    * 'QUERY_STRING'  Uses $_SERVER['QUERY_STRING']
    * 'PATH_INFO'      Uses $_SERVER['PATH_INFO']
    *
    * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
    *
    * @var string
    */
    public $uriProtocol 'REQUEST_URI';

    /**
    * --------------------------------------------------------------------------
    * Default Locale
    * --------------------------------------------------------------------------
    *
    * The Locale roughly represents the language and location that your visitor
    * is viewing the site from. It affects the language strings and other
    * strings (like currency markers, numbers, etc), that your program
    * should run under for this request.
    *
    * @var string
    */
    public $defaultLocale 'en';

    /**
    * --------------------------------------------------------------------------
    * Negotiate Locale
    * --------------------------------------------------------------------------
    *
    * If true, the current Request object will automatically determine the
    * language to use based on the value of the Accept-Language header.
    *
    * If false, no automatic detection will be performed.
    *
    * @var bool
    */
    public $negotiateLocale false;

    /**
    * --------------------------------------------------------------------------
    * Supported Locales
    * --------------------------------------------------------------------------
    *
    * If $negotiateLocale is true, this array lists the locales supported
    * by the application in descending order of priority. If no match is
    * found, the first locale will be used.
    *
    * @var string[]
    */
    public $supportedLocales = ['en'];

    /**
    * --------------------------------------------------------------------------
    * Application Timezone
    * --------------------------------------------------------------------------
    *
    * The default timezone that will be used in your application to display
    * dates with the date helper, and can be retrieved through app_timezone()
    *
    * @var string
    */
    public $appTimezone 'Europe/Paris';

    /**
    * --------------------------------------------------------------------------
    * Default Character Set
    * --------------------------------------------------------------------------
    *
    * This determines which character set is used by default in various methods
    * that require a character set to be provided.
    *
    * @see http://php.net/htmlspecialchars for a list of supported charsets.
    *
    * @var string
    */
    public $charset 'UTF-8';

    /**
    * --------------------------------------------------------------------------
    * URI PROTOCOL
    * --------------------------------------------------------------------------
    *
    * If true, this will force every request made to this application to be
    * made via a secure connection (HTTPS). If the incoming request is not
    * secure, the user will be redirected to a secure version of the page
    * and the HTTP Strict Transport Security header will be set.
    *
    * @var bool
    */
    public $forceGlobalSecureRequests false;

    /**
    * --------------------------------------------------------------------------
    * Session Driver
    * --------------------------------------------------------------------------
    *
    * The session storage driver to use:
    * - `CodeIgniter\Session\Handlers\FileHandler`
    * - `CodeIgniter\Session\Handlers\DatabaseHandler`
    * - `CodeIgniter\Session\Handlers\MemcachedHandler`
    * - `CodeIgniter\Session\Handlers\RedisHandler`
    *
    * @var string
    */
    public $sessionDriver 'CodeIgniter\Session\Handlers\FileHandler';

    /**
    * --------------------------------------------------------------------------
    * Session Cookie Name
    * --------------------------------------------------------------------------
    *
    * The session cookie name, must contain only [0-9a-z_-] characters
    *
    * @var string
    */
    public $sessionCookieName 'ci_session';

    /**
    * --------------------------------------------------------------------------
    * Session Expiration
    * --------------------------------------------------------------------------
    *
    * The number of SECONDS you want the session to last.
    * Setting to 0 (zero) means expire when the browser is closed.
    *
    * @var int
    */
    public $sessionExpiration 7200;

    /**
    * --------------------------------------------------------------------------
    * Session Save Path
    * --------------------------------------------------------------------------
    *
    * The location to save sessions to and is driver dependent.
    *
    * For the 'files' driver, it's a path to a writable directory.
    * WARNING: Only absolute paths are supported!
    *
    * For the 'database' driver, it's a table name.
    * Please read up the manual for the format with other session drivers.
    *
    * IMPORTANT: You are REQUIRED to set a valid save path!
    *
    * @var string
    */
    public $sessionSavePath WRITEPATH 'session';

    /**
    * --------------------------------------------------------------------------
    * Session Match IP
    * --------------------------------------------------------------------------
    *
    * Whether to match the user's IP address when reading the session data.
    *
    * WARNING: If you're using the database driver, don't forget to update
    *          your session table's PRIMARY KEY when changing this setting.
    *
    * @var bool
    */
    public $sessionMatchIP false;

    /**
    * --------------------------------------------------------------------------
    * Session Time to Update
    * --------------------------------------------------------------------------
    *
    * How many seconds between CI regenerating the session ID.
    *
    * @var int
    */
    public $sessionTimeToUpdate 300;

    /**
    * --------------------------------------------------------------------------
    * Session Regenerate Destroy
    * --------------------------------------------------------------------------
    *
    * Whether to destroy session data associated with the old session ID
    * when auto-regenerating the session ID. When set to FALSE, the data
    * will be later deleted by the garbage collector.
    *
    * @var bool
    */
    public $sessionRegenerateDestroy false;

    /**
    * --------------------------------------------------------------------------
    * Cookie Prefix
    * --------------------------------------------------------------------------
    *
    * Set a cookie name prefix if you need to avoid collisions.
    *
    * @var string
    *
    * @deprecated use Config\Cookie::$prefix property instead.
    */
    public $cookiePrefix '';

    /**
    * --------------------------------------------------------------------------
    * Cookie Domain
    * --------------------------------------------------------------------------
    *
    * Set to `.your-domain.com` for site-wide cookies.
    *
    * @var string
    *
    * @deprecated use Config\Cookie::$domain property instead.
    */
    public $cookieDomain '';

    /**
    * --------------------------------------------------------------------------
    * Cookie Path
    * --------------------------------------------------------------------------
    *
    * Typically will be a forward slash.
    *
    * @var string
    *
    * @deprecated use Config\Cookie::$path property instead.
    */
    public $cookiePath '/';

    /**
    * --------------------------------------------------------------------------
    * Cookie Secure
    * --------------------------------------------------------------------------
    *
    * Cookie will only be set if a secure HTTPS connection exists.
    *
    * @var bool
    *
    * @deprecated use Config\Cookie::$secure property instead.
    */
    public $cookieSecure false;

    /**
    * --------------------------------------------------------------------------
    * Cookie HttpOnly
    * --------------------------------------------------------------------------
    *
    * Cookie will only be accessible via HTTP(S) (no JavaScript).
    *
    * @var bool
    *
    * @deprecated use Config\Cookie::$httponly property instead.
    */
    public $cookieHTTPOnly true;

    /**
    * --------------------------------------------------------------------------
    * Cookie SameSite
    * --------------------------------------------------------------------------
    *
    * Configure cookie SameSite setting. Allowed values are:
    * - None
    * - Lax
    * - Strict
    * - ''
    *
    * Alternatively, you can use the constant names:
    * - `Cookie::SAMESITE_NONE`
    * - `Cookie::SAMESITE_LAX`
    * - `Cookie::SAMESITE_STRICT`
    *
    * Defaults to `Lax` for compatibility with modern browsers. Setting `''`
    * (empty string) means default SameSite attribute set by browsers (`Lax`)
    * will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
    *
    * @var string|null
    *
    * @deprecated use Config\Cookie::$samesite property instead.
    */
    public $cookieSameSite 'Lax';

    /**
    * --------------------------------------------------------------------------
    * Reverse Proxy IPs
    * --------------------------------------------------------------------------
    *
    * If your server is behind a reverse proxy, you must whitelist the proxy
    * IP addresses from which CodeIgniter should trust headers such as
    * HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
    * the visitor's IP address.
    *
    * You can use both an array or a comma-separated list of proxy addresses,
    * as well as specifying whole subnets. Here are a few examples:
    *
    * Comma-separated: '10.0.1.200,192.168.5.0/24'
    * Array: ['10.0.1.200', '192.168.5.0/24']
    *
    * @var string|string[]
    */
    public $proxyIPs '';

    /**
    * --------------------------------------------------------------------------
    * CSRF Token Name
    * --------------------------------------------------------------------------
    *
    * The token name.
    *
    * @deprecated Use `Config\Security` $tokenName property instead of using this property.
    *
    * @var string
    */
    public $CSRFTokenName 'csrf_test_name';

    /**
    * --------------------------------------------------------------------------
    * CSRF Header Name
    * --------------------------------------------------------------------------
    *
    * The header name.
    *
    * @deprecated Use `Config\Security` $headerName property instead of using this property.
    *
    * @var string
    */
    public $CSRFHeaderName 'X-CSRF-TOKEN';

    /**
    * --------------------------------------------------------------------------
    * CSRF Cookie Name
    * --------------------------------------------------------------------------
    *
    * The cookie name.
    *
    * @deprecated Use `Config\Security` $cookieName property instead of using this property.
    *
    * @var string
    */
    public $CSRFCookieName 'csrf_cookie_name';

    /**
    * --------------------------------------------------------------------------
    * CSRF Expire
    * --------------------------------------------------------------------------
    *
    * The number in seconds the token should expire.
    *
    * @deprecated Use `Config\Security` $expire property instead of using this property.
    *
    * @var int
    */
    public $CSRFExpire 7200;

    /**
    * --------------------------------------------------------------------------
    * CSRF Regenerate
    * --------------------------------------------------------------------------
    *
    * Regenerate token on every submission?
    *
    * @deprecated Use `Config\Security` $regenerate property instead of using this property.
    *
    * @var bool
    */
    public $CSRFRegenerate true;

    /**
    * --------------------------------------------------------------------------
    * CSRF Redirect
    * --------------------------------------------------------------------------
    *
    * Redirect to previous page with error on failure?
    *
    * @deprecated Use `Config\Security` $redirect property instead of using this property.
    *
    * @var bool
    */
    public $CSRFRedirect true;

    /**
    * --------------------------------------------------------------------------
    * CSRF SameSite
    * --------------------------------------------------------------------------
    *
    * Setting for CSRF SameSite cookie token. Allowed values are:
    * - None
    * - Lax
    * - Strict
    * - ''
    *
    * Defaults to `Lax` as recommended in this link:
    *
    * @see https://portswigger.net/web-security/csrf/samesite-cookies
    * @deprecated `Config\Cookie` $samesite property is used.
    *
    * @var string
    */
    public $CSRFSameSite 'Lax';

    /**
    * --------------------------------------------------------------------------
    * Content Security Policy
    * --------------------------------------------------------------------------
    *
    * Enables the Response's Content Secure Policy to restrict the sources that
    * can be used for images, scripts, CSS files, audio, video, etc. If enabled,
    * the Response object will populate default values for the policy from the
    * `ContentSecurityPolicy.php` file. Controllers can always add to those
    * restrictions at run time.
    *
    * For a better understanding of CSP, see these documents:
    *
    * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
    * @see http://www.w3.org/TR/CSP/
    *
    * @var bool
    */
    public $CSPEnabled false;

Reply
#2

app/Config/Filters.php

PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;
use 
CodeIgniter\Filters\CSRF;
use 
CodeIgniter\Filters\DebugToolbar;
use 
CodeIgniter\Filters\Honeypot;
use 
CodeIgniter\Filters\InvalidChars;
use 
CodeIgniter\Filters\SecureHeaders;

class 
Filters extends BaseConfig
{
    /**
    * Configures aliases for Filter classes to
    * make reading things nicer and simpler.
    *
    * @var array
    */
    public $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'      => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'session'      => \CodeIgniter\Shield\Filters\SessionAuth::class,
        'tokens'        => \CodeIgniter\Shield\Filters\TokenAuth::class,
        'chain'        => \CodeIgniter\Shield\Filters\ChainAuth::class,
        'auth-rates'    => \CodeIgniter\Shield\Filters\AuthRates::class,
    ];

    /**
    * List of filter aliases that are always
    * applied before and after every request.
    *
    * @var array
    */
    public $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
            // 'invalidchars',
        ],
        'after' => [
            'toolbar',
            // 'honeypot',
            // 'secureheaders',
        ],
    ];

    /**
    * List of filter aliases that works on a
    * particular HTTP method (GET, POST, etc.).
    *
    * Example:
    * 'post' => ['foo', 'bar']
    *
    * If you use this, you should disable auto-routing because auto-routing
    * permits any HTTP method to access a controller. Accessing the controller
    * with a method you don’t expect could bypass the filter.
    *
    * @var array
    */
    public $methods = [];

    /**
    * List of filter aliases that should run on any
    * before or after URI patterns.
    *
    * Example:
    * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
    *
    * @var array
    */
    public $filters = [
        'auth-rates' => [
            'before' => [
                'login*''register''auth/*'
            ]
        ]
    ];

Reply
#3

Hello, is it possible to provide more details about the installation version of CI, how to install CI?
Reply
#4

(This post was last modified: 07-01-2022, 07:55 PM by kenjis.)

Your app/Config/Auth.php  is  broken.
.You need to reinstall correct app/Config/Auth.php.

Did you run
Code:
php spark shield:setup
?
Reply
#5

I have replayed the install... and it is solved !
Sorry for the inconvenience and thanks for your help.
Reply
#6

Can you add [SOLVED] to the title of your message please ?
--- I am not a developer ---
Reply




Theme © iAndrew 2016 - Forum software by © MyBB