Private/Polyfony/Security.php
protected static function authenticate() :void {
		// if we did not authenticate before
		if(!self::$_account) {
			// search for an enabled account with that session key and a non expired session
			$account = \Models\Accounts::getFirstEnabledWithNonExpiredSession(
				// the session key
				Cook::get(Config::get('security', 'cookie'))
			);
			// if the cookie session key doesn't match any existing account session, we deny access
			$account ?: 
				self::refuse(
					'Your session is no longer valid', 
					403, true);
			// if the stored key and dynamically generated mismatch, we deny access
			$account->hasMatchingDynamicKey() ?: 
				self::refuse(
					'Your signature has changed since your last visit, please log-in again', 
					403, true);
			// if account has expired, we deny access
			!$account->hasItsValidityExpired() ?:
				self::refuse(
					"Your account has expired, it was valid until {$account->get('account_expiration_date')}", 
					403, true);
			// update our credentials
			self::$_account = $account;
			// set access as granted
			self::$_granted = true;
		}	
	}
protected static function authenticate() :void {
		// if we did not authenticate before
		if(!self::$_account) {
			// search for an enabled account with that session key and a non expired session
			$account = \Models\Accounts::getFirstEnabledWithNonExpiredSession(
				// the session key
				Cook::get(Config::get('security', 'cookie'))
			);
			// if the cookie session key doesn't match any existing account session, we deny access
			$account ?: 
				self::refuse(
					'Your session is no longer valid', 
					403, true);
			// if the stored key and dynamically generated mismatch, we deny access
			$account->hasMatchingDynamicKey() ?: 
				self::refuse(
					'Your signature has changed since your last visit, please log-in again', 
					403, true);
			// if account has expired, we deny access
			!$account->hasItsValidityExpired() ?:
				self::refuse(
					"Your account has expired, it was valid until {$account->get('account_expiration_date')}", 
					403, true);
			// update our credentials
			self::$_account = $account;
			// set access as granted
			self::$_granted = true;
		}	
	}
protected static function authenticate ( ) : void { // if we did not authenticate before if ( ! self :: $ _account ) { // search for an enabled account with that session key and a non expired session $ account = \ Models \ Accounts :: getFirstEnabledWithNonExpiredSession ( // the session key Cook :: get ( Config :: get ( 'security' , 'cookie' ) ) ) ; // if the cookie session key doesn't match any existing account session, we deny access $ account ? : self :: refuse ( 'Your session is no longer valid' , 403 , true ) ; // if the stored key and dynamically generated mismatch, we deny access $ account -> hasMatchingDynamicKey ( ) ? : self :: refuse ( 'Your signature has changed since your last visit, please log-in again' , 403 , true ) ; // if account has expired, we deny access ! $ account -> hasItsValidityExpired ( ) ? : self :: refuse ( "Your account has expired, it was valid until {$account->get('account_expiration_date')}" , 403 , true ) ; // update our credentials self :: $ _account = $ account ; // set access as granted self :: $ _granted = true ; } }
internal authentication method that will grant access based on an existing session
internal authentication method that will grant access based on an existing session