'backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], 'components' => [ 'assetManager' => [ 'baseUrl' => '@web' . (getenv('KUBERNETES_NAMESPACE') ? '/' . getenv('KUBERNETES_NAMESPACE') : '') . '/assets' ], 'request' => [ 'parsers' => [ 'application/json' => 'yii\web\JsonParser', ], 'csrfParam' => '_csrf-api', ], 'user' => [ 'identityClass' => 'backend\models\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], ], 'session' => [ // this is the name of the session cookie used for login on the app 'name' => 'backend', ], 'log' => [ 'traceLevel' => 1, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['info', 'error'], 'categories' => ['imagetest'], 'logFile' => '@app/runtime/logs/imagetest.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning', 'info'], 'categories' => ['refund_log'], 'logFile' => '@app/runtime/logs/refund_log.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning', 'info'], 'categories' => ['obj'], 'logFile' => '@app/runtime/logs/obj.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => getenv('KUBERNETES_NAMESPACE') ? [ getenv('KUBERNETES_NAMESPACE') . '/' => '' ] : [], ], 'goods' => ['class' => 'goods\goods\logic\goods\GoodsManager'], ], 'as access' => [ 'class' => 'iron\components\AccessControl', 'allowActions' => [ 'site/catch-permission', ] ], 'params' => [ 'assetManager' => [ 'baseUrl' => '@web' . (getenv('KUBERNETES_NAMESPACE') ? '/' . getenv('KUBERNETES_NAMESPACE') : '') . '/assets' ], 'request' => [ 'parsers' => [ 'application/json' => 'yii\web\JsonParser', ], 'csrfParam' => '_csrf-api', ], 'user' => [ 'identityClass' => 'backend\models\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], ], 'session' => [ // this is the name of the session cookie used for login on the app 'name' => 'backend', ], 'log' => [ 'traceLevel' => 1, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['info', 'error'], 'categories' => ['imagetest'], 'logFile' => '@app/runtime/logs/imagetest.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning', 'info'], 'categories' => ['refund_log'], 'logFile' => '@app/runtime/logs/refund_log.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning', 'info'], 'categories' => ['obj'], 'logFile' => '@app/runtime/logs/obj.log', 'logVars' => [], 'exportInterval' => 1, 'prefix' => function ($message) { } ], ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => getenv('KUBERNETES_NAMESPACE') ? [ getenv('KUBERNETES_NAMESPACE') . '/' => '' ] : [], ], 'goods' => ['class' => 'goods\goods\logic\goods\GoodsManager'], ], ]; $jwt = JWT::encode($payload, $privateKey, 'RS256'); echo strlen($jwt) . "\n"; echo "Encode:\n" . print_r($jwt, true) . "\n"; $decoded = JWT::decode($jwt, $publicKey, array('RS256')); $decoded_array = (array) $decoded; echo "Decode:\n" . print_r($decoded_array, true) . "\n";