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

Refactor post and cateogry authentication #1678

Merged
merged 13 commits into from
Mar 1, 2022

Conversation

guqing
Copy link
Member

@guqing guqing commented Feb 25, 2022

What this PR does?

  • 重构文章和分类的加密认证逻辑
  • 不在CategoryServcice做过滤和认证逻辑,有需要也应该使用Facade
  • 增加AuthenticationManager做认证
  • 增加Category和Post的Authentication做认证状态管理

业务规则:

  • 对于没有加密但父分类为加密状态的分类也为加密状态,访问密码为第一个父分类密码
  • 文章关联了加密分类则文章也为加密状态默认密码为空
  • 文章同时关联了多个加密分类,通过输入密码访问了文章详情后可以看到所有加密分类的名称但点击访问加密分类依然需要输入密码
  • 通过content api根据分类获取分类文章列表时,如果该分类不是私密分类则所属该分类的私密文章不会出现在列表,如果该分类是加密分类且认证过则会查询出私密文章,如果分类是私密分类且该请求携带分类密码请求(查询时认证),认证通过也会查询私密分类,否则私密文章不会出现在列表

Why we need it?

Fix #1673

@guqing guqing self-assigned this Feb 25, 2022
@guqing guqing added this to the 1.5.x milestone Feb 25, 2022
@guqing guqing linked an issue Feb 25, 2022 that may be closed by this pull request
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

测试发现,子分类的父分类如果有密码的情况下,子分类虽然会被拦截需要输入密码,但可以随意输入密码进入。

@guqing
Copy link
Member Author

guqing commented Feb 25, 2022

测试发现,子分类的父分类如果有密码的情况下,子分类虽然会被拦截需要输入密码,但可以随意输入密码进入。

done

@JohnNiang
Copy link
Member

测试发现,子分类的父分类如果有密码的情况下,子分类虽然会被拦截需要输入密码,但可以随意输入密码进入。

@guqing 建议添加一个测试用例保证以上问题不会再出现。

@guqing
Copy link
Member Author

guqing commented Feb 25, 2022

测试发现,子分类的父分类如果有密码的情况下,子分类虽然会被拦截需要输入密码,但可以随意输入密码进入。

@guqing 建议添加一个测试用例保证以上问题不会再出现。

好的

@guqing
Copy link
Member Author

guqing commented Feb 26, 2022

测试发现,子分类的父分类如果有密码的情况下,子分类虽然会被拦截需要输入密码,但可以随意输入密码进入。

@guqing 建议添加一个测试用例保证以上问题不会再出现。

已添加 commits#c6c2a6ac

@guqing guqing requested a review from ruibaby February 26, 2022 08:06
@guqing guqing changed the title Refactor post and cateogry authentication WIP: Refactor post and cateogry authentication Feb 27, 2022
@guqing guqing changed the title WIP: Refactor post and cateogry authentication Refactor post and cateogry authentication Feb 28, 2022
@ruibaby
Copy link
Member

ruibaby commented Mar 1, 2022

/cc @halo-dev/sig-halo

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ruibaby ruibaby merged commit 4f1a3c5 into halo-dev:master Mar 1, 2022
@guqing guqing deleted the feature/category branch March 1, 2022 06:06
winar-jin pushed a commit to winar-jin/halo that referenced this pull request Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

更新分类(Category)的实现有问题
3 participants