Blame view

common/components/nodge/eauth/src/openid/ControllerBehavior.php 999 Bytes
14a09168   Alex Savenko   init commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  <?php

  /**

   * ControllerBehavior class file.

   *

   * @author Maxim Zemskov <nodge@yandex.ru>

   * @link http://github.com/Nodge/yii2-eauth/

   * @license http://www.opensource.org/licenses/bsd-license.php

   */

  

  namespace nodge\eauth\openid;

  

  use Yii;

  use yii\base\Action;

  use yii\base\ActionFilter;

  

  /**

   * @package application.extensions.eauth

   */

  class ControllerBehavior extends ActionFilter

  {

  	/**

  	 * This method is invoked right before an action is to be executed (after all possible filters.)

  	 * You may override this method to do last-minute preparation for the action.

  	 *

  	 * @param Action $action the action to be executed.

  	 * @return boolean whether the action should continue to be executed.

  	 */

  	public function beforeAction($action)

  	{

  		$request = Yii::$app->getRequest();

  

  		if (in_array($request->getBodyParam('openid_mode', ''), ['id_res', 'cancel'])) {

  			$request->enableCsrfValidation = false;

  		}

  

  		return parent::beforeAction($action);

  	}

  }