/** * 所有系统都跳转到sso 统一退出,退出后sso通知其他主系统进行退出,然后跳转回子系统 * @author Allon<*****@*****.**> * @dateTime 2015-12-09T15:17:51+0800 * @return [type] [description] */ public function actionLogout() { $user = Yii::$app->user->getIdentity(); $clients = Client::getClientLogoutHash(); Yii::$app->user->logout(); return $this->render('notify', ['clients' => $clients, 'redirect' => '/']); }
public function beforeAction($action) { if (parent::beforeAction($action)) { $headers = Yii::$app->request->headers; $this->client = Client::findOne(['app_id' => $headers['app-id']]); return true; } }
/** * 验证头 * @author Allon<*****@*****.**> * @dateTime 2015-12-11T18:02:01+0800 * @param [type] $headers [description] * @return boolean 是否合法 */ public function checkHeader($headers) { $client = Client::findOne(['app_id' => $headers['app-id']]); if (!$client) { return false; } if ($client->validateHashKey($headers['once'], $headers['signkey'])) { return true; } return false; }