-
Notifications
You must be signed in to change notification settings - Fork 0
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
Authentication & Authorization #3
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CryingDitto 님 정말 수고 많으셨습니다!! 👏 👏
너무 잘 작성해주셔서 리뷰할 내용도 많이 없었네요 ㅎㅎ
제가 작성한 리뷰 중에 모호한 부분이 있으시면, 추후에 연락 주시면 감사할 것 같습니다!! 👍
path('major/', MajorList.as_view()), | ||
path('major/<int:major_pk>/', MajorDetail.as_view()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 MajorList와 MajorDetail을 반환하는 path는 어떤 경우에 활용하는 엔드포인트일지 궁금합니다!
# 에러나길래 유저 생성 제대로 된 거 맞는지 확인용으로 사용했음 | ||
# 이 방법 말고 방법이 있는지? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin 페이지에서 확인하시거나, DB 관리 툴을 설치하시면 되지 않을까 싶습니다!
DBeaver, TablePlus....?
def get_user(self, user_pk): | ||
user = get_object_or_404(Profile, pk = user_pk) | ||
return user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
바로 get_object_or_404
를 사용하지 않고, get_user
로 한 번 더 감싸서 사용하시는 이유가 있는지 궁금합니다!
정말 그냥 궁금해서 여쭤보는 것이라ㅎㅎ Ditto 님 의견을 알려주시면 감사할 것 같습니다 🙇
fields = ['title', 'author', 'category', 'content', 'like_counts', 'like_users'] # 일부 설정 | ||
# fields = '__all__' # 전부 설정 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한두 개 정도의 필드를 제외하고 모든 필드를 사용하신다면, exclude
속성도 괜찮을 것 같아요!
class Meta:
model = Post
exclude = ('field1', )
return Response(serializer.errors, status = status.HTTP_400_BAD_REQUEST) | ||
else: | ||
context = {"msg":'Wrong request. This post is not yours.'} | ||
return Response(context, status = status.HTTP_403_FORBIDDEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
401과 403 구분까지...! 멋지네요 👏
return Response(context, status = status.HTTP_403_FORBIDDEN) | ||
|
||
class CommentList(APIView): | ||
def get_comment(self, post_pk): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_comment
함수는 뭔가 이름이 한 개의 comment만을 가져오는 느낌인 것 같아요!
이름을 조금 수정해 보면 어떨까요..?
# 이렇게 넣어주는 방법 밖에는 없는지...? ㅠㅠ | ||
# author를 serializer에서 제외하면서도 request.user를 like model에 직접 넣어주는 방법은 없는지..? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
음... User와 Post를 ManyToManyField
로 관계 설정을 한다면, Like를 누르는 로직 자체를 수정해 볼 수 있을 것 같아요!
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
7543755 | Django Secret Key | 86c836e | Session4/websocket/websocket/settings.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
Account - Token create, verify, blacklist added
Post - Authentication, Authorization added
Comment - Authentication, Authorization added
settings.py에 라이브 서버 포트 번호 등록해줬고 django-cors-header 설치했는데도 첫날에는 작동했던 Live server가 자꾸 cors 에러 때문에 작동을 안함.
일단 postman에서 잘 돌아가는 거 확인한 데까지만 업로드.