src/ItePHP/Action/AuthenticateEvent.php
private function execute(ExecuteActionEvent $event,$config){
		$request=$event->getRequest();
		$session=$request->getSession();

		try{
			$session->get('authenticate.user_id');
			if($this->maxTime>0){
				
				if($session->get('authenticate.epoch')<time()){ //deprecated session
					$session->clear();
					throw new ValueNotFoundException('authenticate.epoch');
				}
				$session->set('authenticate.epoch',time()+$this->maxTime);
			}

			if($config->getValue('auth-redirect')!==false){
				$response=$this->createResponseRedirect($config->getValue('auth-redirect'),$request);
				$event->setResponse($response);

			}
		}
		catch(ValueNotFoundException $e){
			if($config->getValue('unauth-redirect')!==false){
				$response=$this->createResponseRedirect($config->getValue('unauth-redirect'),$request);
				$event->setResponse($response);					
			}
			else if($config->getValue('auth-redirect')!==false){
				//ignore
			}
			else{
				throw new PermissionDeniedException();
			}
		}


	}
private function execute(ExecuteActionEvent $event,$config){
		$request=$event->getRequest();
		$session=$request->getSession();

		try{
			$session->get('authenticate.user_id');
			if($this->maxTime>0){
				
				if($session->get('authenticate.epoch')<time()){ //deprecated session
					$session->clear();
					throw new ValueNotFoundException('authenticate.epoch');
				}
				$session->set('authenticate.epoch',time()+$this->maxTime);
			}

			if($config->getValue('auth-redirect')!==false){
				$response=$this->createResponseRedirect($config->getValue('auth-redirect'),$request);
				$event->setResponse($response);

			}
		}
		catch(ValueNotFoundException $e){
			if($config->getValue('unauth-redirect')!==false){
				$response=$this->createResponseRedirect($config->getValue('unauth-redirect'),$request);
				$event->setResponse($response);					
			}
			else if($config->getValue('auth-redirect')!==false){
				//ignore
			}
			else{
				throw new PermissionDeniedException();
			}
		}


	}
private function execute ( ExecuteActionEvent $ event , $ config ) { $ request = $ event -> getRequest ( ) ; $ session = $ request -> getSession ( ) ; try { $ session -> get ( 'authenticate.user_id' ) ; if ( $ this -> maxTime > 0 ) { if ( $ session -> get ( 'authenticate.epoch' ) < time ( ) ) { //deprecated session $ session -> clear ( ) ; throw new ValueNotFoundException ( 'authenticate.epoch' ) ; } $ session -> set ( 'authenticate.epoch' , time ( ) + $ this -> maxTime ) ; } if ( $ config -> getValue ( 'auth-redirect' ) !== false ) { $ response = $ this -> createResponseRedirect ( $ config -> getValue ( 'auth-redirect' ) , $ request ) ; $ event -> setResponse ( $ response ) ; } } catch ( ValueNotFoundException $ e ) { if ( $ config -> getValue ( 'unauth-redirect' ) !== false ) { $ response = $ this -> createResponseRedirect ( $ config -> getValue ( 'unauth-redirect' ) , $ request ) ; $ event -> setResponse ( $ response ) ; } else if ( $ config -> getValue ( 'auth-redirect' ) !== false ) { //ignore } else { throw new PermissionDeniedException ( ) ; } } }
Check authenticate.

@param ExecuteActionEvent $event
@param ConfigContainer $config
@throws ValueNotFoundException
@throws PermissionDeniedException
Check authenticate .