Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

管理画面へ2段階認証機能を追加 #5017

Merged
merged 18 commits into from
Jul 7, 2021

Conversation

sw-satoshi-nakano
Copy link
Contributor

概要(Overview・Refs Issue)

#4850

方針(Policy)

EC-CUBEの他の機能と同様なファイル構造で開発した。

実装に関する補足(Appendix)

追加した画面

ログイン後(またはログイン中)に2段階認証をしていない時にこの画面を表示します。
ログイン

2段階認証を設定しない状態でログインした場合(またはログイン中)は、この画面を表示します。
ログイン時の2段階認証設定

メンバー一覧

メンバー登録
(右上の「2段階認証 設定」ボタンは有効にした場合のみ表示するようにしています)

2段階認証設定変更

その他

  • comporserで2段階認証用のパッケージを追加しています。
  • 環境変数を追加しています。

テスト(Test)

  • 2段階認証を有効にしたユーザーのみ2段階認証のチェックが入ることを確認した
  • 正しいトークン、不正なトークンを入力し、それぞれ正しく挙動することを確認した

相談(Discussion)

2段階認証済みであるかの確認をクッキーを使って行っていますが、クッキーに保存する値は、ログインパスワードを生成する時のロジックを使って暗号化しています。気を付けた方が良いことあれば、ご指摘いただきたいです。
コード:Eccube\Service\TwoFactorAuthService::createAuthedCookie

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更
  • フックポイントの呼び出しタイミングの変更
  • フックポイントのパラメータの削除・データ型の変更
  • twigファイルに渡しているパラメータの削除・データ型の変更
  • Serviceクラスの公開関数の、引数の削除・データ型の変更
  • 入出力ファイル(CSVなど)のフォーマット変更

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

@codecov-io
Copy link

Codecov Report

Merging #5017 (1acfc91) into 4.1-feature (60f8669) will decrease coverage by 36.56%.
The diff coverage is 22.54%.

Impacted file tree graph

@@                Coverage Diff                 @@
##             4.1-feature    #5017       +/-   ##
==================================================
- Coverage          76.38%   39.82%   -36.57%     
- Complexity          6190     6255       +65     
==================================================
  Files                445      449        +4     
  Lines              20963    21137      +174     
==================================================
- Hits               16013     8417     -7596     
- Misses              4950    12720     +7770     
Flag Coverage Δ Complexity Δ
tests 39.82% <22.54%> (-36.57%) 6255.00 <65.00> (+65.00) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...r/Admin/Setting/System/TwoFactorAuthController.php 0.00% <0.00%> (ø) 20.00 <20.00> (?)
src/Eccube/Form/Type/Admin/TwoFactorAuthType.php 0.00% <0.00%> (ø) 2.00 <2.00> (?)
src/Eccube/Service/TwoFactorAuthService.php 31.48% <31.48%> (ø) 26.00 <26.00> (?)
src/Eccube/Entity/Member.php 79.26% <50.00%> (-12.40%) 33.00 <4.00> (+4.00) ⬇️
src/Eccube/EventListener/TwoFactorAuthListener.php 59.25% <59.25%> (ø) 13.00 <13.00> (?)
src/Eccube/Form/Type/Admin/MemberType.php 76.00% <100.00%> (-19.84%) 11.00 <0.00> (ø)
src/Eccube/Entity/NameTrait.php 0.00% <0.00%> (-100.00%) 2.00% <0.00%> (ø%)
src/Eccube/Form/Type/Admin/MailType.php 0.00% <0.00%> (-100.00%) 2.00% <0.00%> (ø%)
src/Eccube/Form/Type/Admin/NewsType.php 0.00% <0.00%> (-100.00%) 4.00% <0.00%> (ø%)
src/Eccube/Form/Type/Master/CsvType.php 0.00% <0.00%> (-100.00%) 3.00% <0.00%> (ø%)
... and 211 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60f8669...1acfc91. Read the comment docs.

@okazy okazy added the enhancement 機能追加 label Apr 20, 2021
@okazy okazy added this to the 4.1 milestone Apr 20, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 4, 2021

Codecov Report

Merging #5017 (8bec652) into 4.1 (8c3ae69) will decrease coverage by 0.45%.
The diff coverage is 21.71%.

Impacted file tree graph

@@             Coverage Diff              @@
##                4.1    #5017      +/-   ##
============================================
- Coverage     75.96%   75.50%   -0.46%     
- Complexity     5946     6013      +67     
============================================
  Files           449      453       +4     
  Lines         20922    21098     +176     
============================================
+ Hits          15893    15930      +37     
- Misses         5029     5168     +139     
Flag Coverage Δ
tests 75.50% <21.71%> (-0.46%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...r/Admin/Setting/System/TwoFactorAuthController.php 0.00% <0.00%> (ø)
src/Eccube/Form/Type/Admin/TwoFactorAuthType.php 0.00% <0.00%> (ø)
src/Eccube/Entity/Member.php 84.94% <20.00%> (-7.83%) ⬇️
src/Eccube/Service/TwoFactorAuthService.php 31.48% <31.48%> (ø)
src/Eccube/EventListener/TwoFactorAuthListener.php 69.23% <69.23%> (ø)
src/Eccube/Form/Type/Admin/MemberType.php 95.91% <100.00%> (+0.17%) ⬆️
...be/Service/PurchaseFlow/Processor/TaxProcessor.php 79.62% <0.00%> (-3.71%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c3ae69...8bec652. Read the comment docs.

@chihiro-adachi chihiro-adachi changed the base branch from 4.1-feature to 4.1 July 6, 2021 00:00
@okazy okazy merged commit 6038ce0 into EC-CUBE:4.1 Jul 7, 2021
@okazy
Copy link
Contributor

okazy commented Jul 7, 2021

@sw-satoshi-nakano ありがとうございます!取り込ませていただきました。

@sw-satoshi-nakano
Copy link
Contributor Author

@okazy @chihiro-adachi
もろもろ修正いただきありがとうございます!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants