basercms icon indicating copy to clipboard operation
basercms copied to clipboard

【システム】JWT認証ファイルをコマンドで生成できるようにする

Open seto1 opened this issue 1 year ago • 3 comments

baserCMS version : 5

  • 構築済みの環境を再現する際に使用できると便利なため
  • InstallationsService->createJwtをコマンドで呼び出すようにしたらいい?
    • https://github.com/baserproject/basercms/blob/5.1.x/plugins/bc-installer/src/Service/InstallationsService.php#L514

seto1 avatar Aug 13 '24 05:08 seto1

InstallationsService->createJwtをコマンドで呼び出すようにしたらいい?

BcInstaller は、インストールが完了すると無効化されるので、ちょっと考えないといけないですね。

ryuring avatar Aug 13 '24 21:08 ryuring

@ryuring

bin/cake create jwt

ありがとうございます。確かに先に bin/cake setup install を実行しないと使えないですね。

InstallationsService->createJwtを https://github.com/baserproject/basercms/blob/5.1.x/plugins/bc-installer/src/Service/InstallationsService.php#L517 BcApiUtilに移動して、baser-coreのコマンドにするのはどうでしょう。 https://github.com/baserproject/basercms/blob/5.1.x/plugins/baser-core/src/Utility/BcApiUtil.php

一応以下のコマンドで作成できるはできるので、そこまで強い要望ではないです。

openssl genrsa -out config/jwt.key 1024
openssl rsa -in config/jwt.key -outform PEM -pubout -out config/jwt.pem

seto1 avatar Aug 19 '24 02:08 seto1

BcApiUtilに移動して、baser-coreのコマンドにするのはどうでしょう。

こちらが良さそうですね。 @seto1

ryuring avatar Aug 19 '24 02:08 ryuring