code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,103 @@
+import json
+import bcrypt
+import jwt
+
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User, Follow
+from my_settings import SECRET_KEY
+
+class SignupView(View):
+ def post(self, request):
+ try:
+ data = json.loads(request.body... | Python | 여기서 이렇게 else 로 잡아주시기 보다는 checkpw() 의 값이 Falsy 하다면 401 을 리턴해주시고,
넘어와서 지금 위에 보시는 If 문의 로직을 처리해주신다면 불필요한 else 문이 없어지겠죠? |
@@ -0,0 +1,103 @@
+import json
+import bcrypt
+import jwt
+
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User, Follow
+from my_settings import SECRET_KEY
+
+class SignupView(View):
+ def post(self, request):
+ try:
+ data = json.loads(request.body... | Python | 토큰에서 유저정보를 찾아와서 필터하는 기능까지! 👍 👍 👍
다민님 처음에는 이해하는데 어려워하시는 것 같아 걱정을 조금 했었는데, 지금보면 문제 해결능력이 정말 좋으신 것 같아요! 너무 잘하셨습니다ㅎㅎ |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+
+ email = models.EmailField(max_length=50, unique=True)
+ name = models.CharField(max_length=50, unique=True)
+ phone = models.CharField(max_length=50, unique=True)
+ password= models.CharField(max_length=500)
+
+ class... | Python | - email 은 가독성을 위해, 그리고 추후 장고 Form 이 제공하는 validator 를 사용할 수도 있을 것을 감안해서 EmailField 로 선언해주세요!
- 그리고 email 은 고유값이죠? 이럴때 추가해줄 수 있는 옵션이 있습니다! 찾아서 추가해주세요~ |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+
+ email = models.EmailField(max_length=50, unique=True)
+ name = models.CharField(max_length=50, unique=True)
+ phone = models.CharField(max_length=50, unique=True)
+ password= models.CharField(max_length=500)
+
+ class... | Python | 보통 데이터베이스 컬럼명은 줄여쓰지않고 최대한 명확하게 풀어서 선언해줍니다. 여기는 password 로 풀어주세요~
그리고 이제 비밀번호 암호화 과정을 진행하는만큼 최대 글자수를 조금 더 넉넉하게 잡아주시는게 좋습니다! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | - exists 메소드 너무 잘 활용하셨네요!! 👍
- 여기서 exists 의 결과를 따로 변수에 저장해줄것 없이 아래 if 문에 바로 적용해주신다면 불필요한 변수 선언을 없앨 수 있겠죠?! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | or, not, in 활용 너무 좋습니다 호열님!!! 그런데 email 을 list 로 형변환해주신 이유가 있을까요? |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | 위에 리뷰 내용 반영해주시면 이 부분에 수정사항이 생기겠죠!? |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | `or` 과 `is` 중에 어떤게 우선순위일까요? 조건문에서 operator precedence 에 따라 조건이 완전히 바뀔 수 있기 때문에 잘 파악하고 사용하시는게 좋습니다! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | 이 부분들에서는 파이썬의 exception 이 발생할 수 있습니다. Exception handling 에 대해서 repl.it 에서 보신적이 있으신데요! 실제로 view 에서 정말정말 중요한 역할을 하는 만큼 꼭 추가되어야 하는 로직입니다.
이 코드들에서 어떤 exception 이 발생할 수 있을지 확인해보시고 핸들링 로직 추가해주세요! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | 이제 bcrypt 를 활용하여 비밀번호 암호화 로직 추가해서 저장해주세요! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | CREATED 를 의미하는 201 사용 너무 잘하셨습니다! 😉 |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+
+ email = models.EmailField(max_length=50, unique=True)
+ name = models.CharField(max_length=50, unique=True)
+ phone = models.CharField(max_length=50, unique=True)
+ password= models.CharField(max_length=500)
+
+ class... | Python | 휴대폰 번호도 고유값이니 위처럼 고유값을 뜻하는 옵션을 추가해주셔야 합니다! |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | string / list 에 대한 이해가 부족했습니다.
- [x] Strings can be indexed (subscripted), with the first character having index 0. There is no separate character type; a character is simply a string of size one:
- [x] if '.' not in email or '@' not in email: |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | 불필요한 주석 제외하고 올려주세요. |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | else 불필요 |
@@ -0,0 +1,76 @@
+import json,bcrypt,jwt
+from json.decoder import JSONDecodeError
+
+from django.db.models import Q
+from django.views import View
+from django.http import JsonResponse
+
+from .models import User
+from my_settings import SECRET_KEY, ALGORITHM
+
+
+class SignUpView(View):
+ ... | Python | 성공 케이스에서 쓸 로직이기 때문에 아래로 위치시켜주세요. |
@@ -0,0 +1,145 @@
+"""
+Django settings for westagram project.
+
+Generated by 'django-admin startproject' using Django 3.1.7.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/3.1/r... | Python | 완벽합니다 국현님! 💯 |
@@ -0,0 +1,145 @@
+"""
+Django settings for westagram project.
+
+Generated by 'django-admin startproject' using Django 3.1.7.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/3.1/r... | Python | 넵넵 확인 감사드립니다 승현님 ㅎㅎ 😊😊
미션2 진행하겠습니다~~~!!👨💻 |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+ email = models.EmailField(max_length=50, unique=True)
+ phone = models.CharField(max_length=11, null=True, unique=True)
+ full_name = models.CharField(max_length=40, null=True)
+ user_name = models.CharFiel... | Python | 불필요한 주석 없애주세요! |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+ email = models.EmailField(max_length=50, unique=True)
+ phone = models.CharField(max_length=11, null=True, unique=True)
+ full_name = models.CharField(max_length=40, null=True)
+ user_name = models.CharFiel... | Python | 작성하신 여러가지 필드들 중 중복을 허용하면 안되는 필드들이 보이는데 그럴때 사용할 수 있는 옵션이 있습니다!
찾아서 추가해주세요 😉 |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 깔끔합니다!! 💯 💯 💯 |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 필수필드, `NULL` 허용필드에 따른 접근 방식 다르게 적용 잘하셨습니다!! 👍👍👍
가독성을 위해 조금 위치를 변경할 수 있겠네요! 아래와 같이요ㅎㅎ
```suggestion
email = data['email']
password = data['password']
phone = data.get('phone', None)
full_name = data.get('full_name', None)
use... |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 입력받은 폰번호에 `-` 가 포함되어 들어올 시 데이터베이스에 넣고싶은 형식에 맞춰주시는 로직 좋습니다!
앞으로 프론트엔드분들과 협업을 하면서 경험하시겠지만, 이런 부분은 꼭 프론트/백 간의 상의가 필요합니다.
이 점 인지해주시고 다음 주 프/백 통신 들어가시면 도움이 되실거에요! ㅎㅎ |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 정규표현식으로 email 과 password validate 해주시는 로직인데 조금 자잘하게 나누어서 비교하시려다보니 조금 복잡해보이네요!
차라리 이메일 형식에 맞는 정규표현식을 통째로 가져와 저장해두고 `re.match()` 를 활용하여 한번에 확인할 수 있습니다. `password` 도 마찬가지구요!
그렇게 변경해주시면 조금 더 깔끔한 조건문을 만들 수 있습니다 😉 |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 이미 존재하는 정보인지 확인하는 로직을 작성해주셨는데 작성해주신 로직을 흐름대로 글로 정리해보겠습니다.
1. 입력받은 `email` 값으로 유저 테이블에 filter 쿼리를 날려 반환받은 QuerySet 리스트에 객체가 존재하지 않는다면 `phone_number` 과 `user_name` 으로 filter 쿼리를 날려 추가 확인을 한다.
2. 존재한다면 `400` 을 리턴해준다.
하지만 현재 `SignUp` View 에서는 `email` 을 필수값으로 받아야하기 때문에 사실상 `email` 존재 유무만 확인해도 등록된 유저인지 아닌지는 알 수가 있습니다. ... |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 깔끔합니다~ 💯 |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 구분을 위해 위아래로 한줄씩 추가해주시면 가독성이 더 좋아지겠네요! 😎 |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 이런식으로 exception 을 처리하시게 되면 어떤 exception 이 무엇때문에 `raise` 되었는지 확인하기가 어렵습니다. 그래서 exception 핸들러 추가해주실때는 위에서 `KeyError` 처리해주신것과 같이 명확하게 지정하여 처리해주셔야합니다.
하지만 지금 단계에서 어떤 exception 이 발생할 수 있는지 모르는게 당연하기 때문에 이럴때는 그냥 여러가지 방법으로 호출해보면서 경험하여 추가해주시다보면 나중에는 메소드 하나를 추가할때 관련한 exception 을 처리해주는 로직을 바로 함께 작성할 수 있게 되실거에요! 😁 |
@@ -0,0 +1,12 @@
+from django.db import models
+
+class User(models.Model):
+ email = models.EmailField(max_length=50, unique=True)
+ phone = models.CharField(max_length=11, null=True, unique=True)
+ full_name = models.CharField(max_length=40, null=True)
+ user_name = models.CharFiel... | Python | 네넵!! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 아하 네넵!! 궁금한 점 해결 되었습니다 ㅎㅎ!! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 승현님, 말씀하신대로, 이메일 주소와 비밀번호 정규식 검사에 필요한 값을 REGEX_EMAIL, REGEX_PASSWORD에다가 저장하여 활용하였습니다..! 보다 코드가 간결해져서 아주 좋네요 ㅎㅎㅎ |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 승현님, 아까 해주신 말씀 듣고 User 클래스에 특정 컬럼은 고유한 값을 가지도록 unique 옵션을 설정하였습니다..! 그리고 말씀해주신 q 클래스도 공부하고 다음 소스에도 적용해보도록 하겠습니다!! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | Truthy, Falsy values 에 대해 알아보시고 해당 조건문들을 어떻게 더 깔끔하게 정리할 수 있을지 고민해보시고 적용해주세요! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 이제 bcrypt 로 비밀번호를 암호화하여 저장하는 로직을 추가해주세요! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 여기서도 발생할 수 있는 exception 이 존재합니다!
exception handling 로직에 추가해주세요!! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | `=` 기준 간격 정렬해주세요 국현님! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | - `|` 사이 간격도 통일해주세요~
- 이 부분 로직이 이해가 잘 안되는데 전부 user_id 를 대입하여 확인하고 싶은게 맞으신가요?! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 넵넵!! 수정해보겠습니다~~ |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 넵 승현님!
저는 사용자가 로그인할 때 이메일, 휴대폰, 유저네임 이 세개중에 하나로 로그인할꺼라고 생각을 해서 사용자가 입력한 값을 아예 user_id로 값을 받으려 했습니다..! 그래서 이 user_id값을 가지고 하나라도 이메일, 휴대폰, 유저네임과 같은게 있으면 유효한 아이디값이라고 생각하였습니다..! |
@@ -0,0 +1,87 @@
+import re, json, bcrypt
+
+from django.views import View
+from django.http import JsonResponse, request
+from django.db.models.query_utils import Q
+from json.decoder import JSONDecodeError
+
+from user.utils import LoginCheck
+from user.models import ... | Python | 승현님 혹시 json 관련 exception 이 JSONDecodeError 인것일까요..? |
@@ -1,26 +1,39 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthe... | Java | 잘 추가해주셨네요 👍 |
@@ -2,7 +2,10 @@
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authorization.Secured;
+import nextstep.security.context.SecurityConte... | Java | 이미 Filter에서 처리하고 있는데 불필요한 로직이 아닐까요? |
@@ -0,0 +1,20 @@
+package nextstep.security.util;
+
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.http.HttpMethod;
+
+public class MvcRequestMatcher implements RequestMatcher {
+
+ private final HttpMethod method;
+ private final String pattern;
+
+ public MvcRequestMatcher(HttpM... | Java | ```suggestion
return this.method.equals(HttpMethod.valueOf(request.getMethod())) && pattern.equals(request.getRequestURI());
```
null-safe 관점에서는 파라미터로 들어오는 `request.getRequestURI()`는 null일 수 있기 때문에 별도로 null 체크를 하지 않는 이상 위와 같이 표현하는 것이 npe가 발생하지 않는 안전한 코드를 만들 수 있습니다. |
@@ -0,0 +1,14 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.web.AuthorizationResult;
+
+@FunctionalInterface
+public interface AuthorizationManager<T> {
+ @Deprecated
+ AuthorizationDecision check(Authentication auth... | Java | 현재 spring security를 확인해보시면 `check`는 deprecated되었는데요. `AuthorizationDecision`이라는 클래스는 구현해주신 것처럼 구현체로 되어있고, 보통의 프레임워크들은 규모가 커질수록 만들어둔 구현체들을 추상화하는 형태로 개선해나갑니다.
`check`가 deprecated됨에 따라 해당 기능이 막힌 것은 아니고 이를 추상화한 `AuthorizationResult`를 반환하는 메소드 사용을 권장하고 있으니 참고해주시면 좋을 것 같아요 :)
https://github.com/franticticktick/spring-s... |
@@ -0,0 +1,14 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.web.AuthorizationResult;
+
+@FunctionalInterface
+public interface AuthorizationManager<T> {
+ @Deprecated
+ AuthorizationDecision check(Authentication auth... | Java | 준형님이 생각하시기에 선택사항으로 주어진 `verfiy`는 `check`와 비교하여 어떤 상황에서 사용하면 좋을 것 같으신가요? |
@@ -0,0 +1,22 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authorization.web.AuthorizationResult;
+
+public class AuthorizationDecision implements AuthorizationResult {
+ public static final AuthorizationDecision ALLOW = new AuthorizationDecision(true);
+ public static final Authorizat... | Java | true 혹은 false만 가지는 `AuthorizationDecision`이 자주 사용되는데 사용될때마다 인스턴스화하기보다는 불변임을 활용하여 미리 만들어준 상수를 사용하도록 유도할 수 있을 것 같네요. |
@@ -0,0 +1,38 @@
+package nextstep.security.authorization.web;
+
+import java.util.Collection;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization... | Java | 실제 spring security에서는 성능의 문제로 인해 stream 사용을 제한하고 있습니다.
https://github.com/spring-projects/spring-security/issues/7154 |
@@ -0,0 +1,28 @@
+package nextstep.security.authorization.web;
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.List;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.AuthorizationManager;
... | Java | getter로 호출하여 일치 여부를 확인하는 것보다는 `mapping`에서 처리하도록 수정하면 책임이 명확하게 넘어갈 수 있겠네요 :) |
@@ -0,0 +1,43 @@
+package nextstep.security.authorization.method;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextst... | Java | `AuthorityAuthorizationManager`의 로직과 함께보면
```java
boolean hasAuthority = authentication.getAuthorities().stream()
.anyMatch(authorities::contains);
return new AuthorizationDecision(hasAuthority);
```
부분이 동일한 것을 확인해볼 수 있어요. 각 `AuthorizatinManager`는 단일에서 각각 본인의 것을 모두 구성하는 것이 아닌 서로 유기적으로 결합되어 사용하기도 하는데요.
... |
@@ -0,0 +1,18 @@
+package nextstep.security.fixture;
+
+import java.util.Base64;
+import java.util.Set;
+import nextstep.app.domain.Member;
+
+public class MemberTestFixture {
+ public static final Member TEST_ADMIN_MEMBER = new Member("a@a.com", "password", "a", "", Set.of("ADMIN"));
+ public static final Member... | Java | (반영하지 않으셔도 됩니다.) 개인적으로는 enum에서 지원되는 메소드들을 활용하는 경우도 많아 특정 도메인의 fixture는 enum 으로 생성하는 편입니다 😄 |
@@ -2,7 +2,10 @@
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authorization.Secured;
+import nextstep.security.context.SecurityConte... | Java | 앗 해당 app패키지에 컨트롤러는
강의실에서 실습이후 체리픽 해온것이라 열어볼 생각을 못했네요.
수정해두겠습니다! |
@@ -0,0 +1,20 @@
+package nextstep.security.util;
+
+import jakarta.servlet.http.HttpServletRequest;
+import org.springframework.http.HttpMethod;
+
+public class MvcRequestMatcher implements RequestMatcher {
+
+ private final HttpMethod method;
+ private final String pattern;
+
+ public MvcRequestMatcher(HttpM... | Java | 간과하고 있었네요. 수정해두겠습니다! 👍 |
@@ -0,0 +1,14 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.web.AuthorizationResult;
+
+@FunctionalInterface
+public interface AuthorizationManager<T> {
+ @Deprecated
+ AuthorizationDecision check(Authentication auth... | Java | 오.. 불과 4달전에 업데이트된 기능이군요!
피드백 주신 대로 반영해보면서 어떤 식으로
오픈소스가 개선되어 나가는지 체험 해 볼 수 있었네요 감사합니다. |
@@ -0,0 +1,22 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authorization.web.AuthorizationResult;
+
+public class AuthorizationDecision implements AuthorizationResult {
+ public static final AuthorizationDecision ALLOW = new AuthorizationDecision(true);
+ public static final Authorizat... | Java | 현 상황에서 메모리 효율성을 더 높일 수 있겠네요! |
@@ -0,0 +1,38 @@
+package nextstep.security.authorization.web;
+
+import java.util.Collection;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization... | Java | 가독성 때문에 stream을 선호하는 편인데, spring security같은 라이브러리는 성능이 중요하다보니 그렇게 된거군요..
구현체 코드 보면서 가독성이 생각만큼은 아닌것 같았는데, 그 위화감이 여기서 기인한 것 같습니다. |
@@ -0,0 +1,28 @@
+package nextstep.security.authorization.web;
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.List;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.AuthorizationManager;
... | Java | 음.. 제 생각으로는 `mapping`인 `RequestMatcherEntry`는 `RequestMatcher`랑 `AuthorizationManager`를
단순히 묶어주는 역할을 수행한다고 생각해서,
해당 객체에 `matches()`의 로직까지 있으면 오히려 책임이 과해지고,
원래 RequestMatcher의 역할이 흐려질것 같아 getter로 호출해서 일치 여부를 확인했습니다.
제가 제대로 이해한거라면 진영님 생각이 궁금합니다! |
@@ -0,0 +1,18 @@
+package nextstep.security.fixture;
+
+import java.util.Base64;
+import java.util.Set;
+import nextstep.app.domain.Member;
+
+public class MemberTestFixture {
+ public static final Member TEST_ADMIN_MEMBER = new Member("a@a.com", "password", "a", "", Set.of("ADMIN"));
+ public static final Member... | Java | 3단계 수행하면서 변경해 보겠습니다! 😄 |
@@ -0,0 +1,43 @@
+package nextstep.security.authorization.method;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextst... | Java | [83a4efd](https://github.com/next-step/spring-security-authorization/pull/15/commits/83a4efd95662b7e9d2590f72ee5a56173a16477d)
으로 반영해보았습니다!
각자의 Manager가 단일 책임이 아닌 결합해서 사용하기도 하는군요!
저도 작업하면서 같은 로직이 들어간다고 생각이 들었는데,
이런식으로도 역할과 책임 분배를 가져갈 수 있겠네요!
현재 말씀해주신 `AuthoritiesAuthorizationManager` 처럼 다양한 권한 체계는 없기 떄문에
기존 `Se... |
@@ -0,0 +1,14 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.web.AuthorizationResult;
+
+@FunctionalInterface
+public interface AuthorizationManager<T> {
+ @Deprecated
+ AuthorizationDecision check(Authentication auth... | Java | 음.. 결국엔 **인가실패시 예외를 발생시킨다.** 가 핵심이라고 생각해요.
check로는 null이 올 수도 있고, 권한이 없다 할 지어도 에러코드 등에서 개발자 마음대로 핸들링 할 수 있는 반면에,
verify는 인가에 실패한 경우 동일한 에러가 발생된다. 라는 점에서 추적에 용이할 것 같고, 인적오류를 최소화 할 수 있을 것 같다고 생각이 드네요!
따라서 관리자 전용 API등 권한이 없으면 추가적인 로직 없이 바로 예외를 던질때 사용하면 좋을 것 같습니다~ |
@@ -0,0 +1,14 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.web.AuthorizationResult;
+
+@FunctionalInterface
+public interface AuthorizationManager<T> {
+ @Deprecated
+ AuthorizationDecision check(Authentication auth... | Java | 네 사실 `verify`를 단일로 쓰면 저희가 흔히 알고 있듯 예외를 발생시킬 수 있는 곳에서 예외를 발생시키는 것이 맞기는 합니다.
다만 `AuthorizationManager`의 원래 책임은 인가가 된 유저인지를 확인하는 것이고 이건 인가가 실패되었다는 것이 에러 상황이 아닌 정상적인 비즈니스의 흐름이라고 볼 수 있어요. 인가가 실패한 것에 대한 결과가 예외가 나는 것은 `AuthorizationFilter`가 인가 실패의 결과가 예외이다라는 것을 실행하는 것일뿐인 것이구요.
실제 `AuthorizationManager`들의 구현체를 보시면 이런 이유... |
@@ -0,0 +1,28 @@
+package nextstep.security.authorization.web;
+
+import jakarta.servlet.http.HttpServletRequest;
+import java.util.List;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.AuthorizationManager;
... | Java | ```suggestion
if (mapping.matches(request)) {
```
제가 의도 드렸던 내용은 getter를 꺼내와서 다시 호출하는 것이 아닌 해당 객체 내에서 처리할 수 있게 메시지를 던지는 형태를 말씀드린 것이었어요. getter를 호출해서 메소드 체이닝이 되는 것은 객체의 역할이 있다기보단 단순히 래핑클래스가 되어버려 책임과 역할이 불분명해질 수 있습니다.
```java
public boolean matches(HttpServletRequest request) {
return reque... |
@@ -0,0 +1,13 @@
+package nextstep.security.authorization.web;
+
+import jakarta.servlet.http.HttpServletRequest;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.AuthorizationManager;
+
+public class DenyAllA... | Java | ```suggestion
public AuthorizationResult check(Authentication authentication, HttpServletRequest object) {
```
반환 타입들도 잘 추상화해주신 클래스로 만들어주면 좋겠네요 :) |
@@ -0,0 +1,22 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authorization.web.AuthorizationResult;
+
+public class AuthorizationDecision implements AuthorizationResult {
+ public static final AuthorizationDecision ALLOW = new AuthorizationDecision(true);
+ public static final Authorizat... | Java | ```suggestion
public static AuthorizationDecision from(boolean granted) {
```
관습적으로 정적 팩토리 메소드는 파라미터가 하나일때 from, 여러개일때 of를 활용합니다. |
@@ -0,0 +1,37 @@
+[
+ {
+ "id": 1,
+ "img": "images/yoonhee/imgg.jpg",
+ "text": "한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한"
+ },
+ {
+ "id": 2,
+ "img": "images/yoonhee/imgg.jpg",
+ "text": "한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어한국어... | Unknown | 애국자 윤희님의 뜻 잘 알겠습니다. |
@@ -1,9 +1,23 @@
import React from 'react';
+import './Login.scss';
+import LoginForm from './LoginForm';
-class Login extends React.Component {
+class LoginYoonHee extends React.Component {
render() {
- return null;
+ return (
+ <article className="login-art">
+ <div className="log-in__main">
+... | JavaScript | props의 개념에 대해 잘 이해하셨네요!
하지만 이렇게 할 필요 없이, `<LoginForm>` 컴포넌트에서 withRouter import해서 감싸주시는 방식으로 하시는 게 좋을 것 같네요! |
@@ -0,0 +1,75 @@
+.login-art {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100vh;
+ background-color: var(--color-boxgray);
+
+ .log-in__main {
+ display: flex;
+ flex-direction: column;
+ justify-content: space-evenly;
+ align-items: center;
+ width: 300px;
+ he... | Unknown | - 하나의 요소에 여러가지 속성을 부여하는 경우 중요도, 관련도에 따라서 나름의 convention을 지켜서 작성하는 것이 좋습니다.
- 일반적인 convention 은 아래와 같습니다. 아래와 같이 순서 적용해주세요.
[CSS property 순서]
- Layout Properties (position, float, clear, display)
- Box Model Properties (width, height, margin, padding)
- Visual Properties (color, backgrou... |
@@ -0,0 +1,51 @@
+import React from 'react';
+import { withRouter } from 'react-router-dom';
+
+class LoginForm extends React.Component {
+ constructor() {
+ super();
+ this.state = { id: '', ps: '' };
+ }
+
+ goToMain = e => {
+ this.props.history.push('/main-yoonhee');
+ };
+
+ handleInput = e => {
+ ... | JavaScript | 계산된 속성명 잘 활용해주셨네요! :) |
@@ -0,0 +1,10 @@
+import React from 'react';
+
+class Comment extends React.Component {
+ render() {
+ const { innerText } = this.props;
+ return <li>{innerText}</li>;
+ }
+}
+
+export default Comment; | JavaScript | map 메서드를 사용하시는 부분에서 key prop 부여해주시면 됩니다! |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | isKeyEnter라는 함수명은 key가 enter인지 아닌지를 판별하는 boolean 변수명으로 적합한 것 같네요.
함수의 동작에 대한 내용을 직관적으로 알 수 있는 동사형으로 작성해주세요!
ex) addCommentByEnter |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 리뷰하지 않은 부분도 수정해주세요! |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | - `newfeedComment`라고 새로 선언하고 할당할 필요 없이, concat 메서드에 feedComment라는 state를 직접 넣어주셔도 될 것 같네요.
- concat 잘 사용해주셨는데, concat 대신에 spread operator를 사용해서 동일하게 구현해보실 수 있습니다.
연습한다고 생각하시고 찾아서 구현해보세요!
```suggestion
const { feedComment, commentList } = this.state;
this.setState({
commentList: commentList.con... |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 이 컴포넌트의 tag들에서 id와 className을 같이 부여하신 이유가 있을까요?? |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 위에 리뷰드린 내용이네요! index를 props로 넘겨주는 게 아니라, 이 부분에서 key={index}로 부여해주시면 될 것 같습니다! |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 그리고 cur이라는 변수명은 어떤 데이터를 가지고 있는지 명확하지 않은데, 해당 변수가 담고 있는 데이터에 대한 내용이 좀 더 직관적으로 드러날 수 있도록 수정해주세요!
ex) comment |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | - method 잘 생략해주셨네요! 👍
- 추가적으로, `http://localhost:3000` 부분도 생략할 수 있습니다. 포트 번호가 바뀔 때마다 에러가 발생하고 그때그때 수정해줘야 하는 번거로움이 있기 때문에, 다음과 같이 생략해서 사용해주세요!
```suggestion
fetch('/data/feed.json')
``` |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | 오잉 여기에는 key prop 잘 부여해주셨네요!
살짝 흠을 잡자면,, 매개변수의 데이터는 각 피드에 대한 데이터이기 때문에 feeds -> feed가 더 적절한 것 같습니다. |
@@ -1,9 +1,22 @@
+// eslint-disable-next-line
import React from 'react';
+import Nav from './Nav';
+import Feeds from './Feeds';
+import MainR from './MainR';
+import './Main.scss';
-class Main extends React.Component {
+class MainYoonHee extends React.Component {
render() {
- return null;
+ return (
+ ... | JavaScript | import 순서 수정해주세요! 일반적인 convention을 따라 순서만 잘 지켜주셔도 가독성이 좋아집니다. 아래 순서 참고해주세요.
- React → Library(Package) → Component → 변수 / 이미지 → css 파일(scss 파일) |
@@ -0,0 +1,25 @@
+import React from 'react';
+
+class Recommend extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user2">
+ <div className="user-and-botton">
+ <img
+ className="user__img user__img--brder-re... | JavaScript | `<li>`태그, `<div>`태그 둘 중 하나로만 감싸주셔도 될 것 같습니다! |
@@ -0,0 +1,22 @@
+import React from 'react';
+
+class Story extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user">
+ <img
+ className="user__img user__img--brder-red"
+ alt={nickname}
+ src={img}
+ ... | JavaScript | 여기도 마찬가지-! |
@@ -0,0 +1,281 @@
+/*------공통-----*/
+/*------공통-----*/
+
+.main-body {
+ background-color: var(--color-boxgray);
+}
+
+main {
+ display: flex;
+ margin-left: 100px;
+}
+
+ul > li {
+ margin: 10px 0;
+}
+
+a {
+ text-decoration: none;
+ color: inherit;
+}
+
+.box {
+ background-color: white;
+ border: 1px solid... | Unknown | 공통으로 사용하는 속성은 팀원들과 상의하여 common.scss 파일로 옮겨주세요! |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 리액트로 파일 옮겨오기전 js파일로만 작업할 때 돔으로 접근하는 용도로 쓰고 지우는걸 깜빡했네요 …;;;ㅠㅠ지웠습니다! |
@@ -1,9 +1,23 @@
import React from 'react';
+import './Login.scss';
+import LoginForm from './LoginForm';
-class Login extends React.Component {
+class LoginYoonHee extends React.Component {
render() {
- return null;
+ return (
+ <article className="login-art">
+ <div className="log-in__main">
+... | JavaScript | 수정했습니당! 덕분에 라우터에 대해서 좀 더 알게됐네용 ㅎㅎ |
@@ -0,0 +1,10 @@
+import React from 'react';
+
+class Comment extends React.Component {
+ render() {
+ const { innerText } = this.props;
+ return <li>{innerText}</li>;
+ }
+}
+
+export default Comment; | JavaScript | 수정했습니다-! key값 넣는곳을 정확히 모르고있었는데 이제 정확하게 알거같아요! |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | 수정했습니다-! 포트번호는 생략으루! 팁 감사합니당! |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | feed로 수정완료 했습니당 😊 |
@@ -1,9 +1,22 @@
+// eslint-disable-next-line
import React from 'react';
+import Nav from './Nav';
+import Feeds from './Feeds';
+import MainR from './MainR';
+import './Main.scss';
-class Main extends React.Component {
+class MainYoonHee extends React.Component {
render() {
- return null;
+ return (
+ ... | JavaScript | scss파일 아래로 위치수정 했습니당 ! |
@@ -1,9 +1,22 @@
+// eslint-disable-next-line
import React from 'react';
+import Nav from './Nav';
+import Feeds from './Feeds';
+import MainR from './MainR';
+import './Main.scss';
-class Main extends React.Component {
+class MainYoonHee extends React.Component {
render() {
- return null;
+ return (
+ ... | JavaScript | 그 때 말씀해주셨던 부분이네용 ㅎㅎ.. <div>로 변경했습니당.. 콘솔창에 뜨던 알수없는 빨간색 글씨 오류가 이것떄문이였군용 ㅠㅠ index.html에있는 body부분과 충돌해서요; 기본적인 구조를 생각하면 당연한건데 제가 너무 안일했네요.. |
@@ -0,0 +1,25 @@
+import React from 'react';
+
+class Recommend extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user2">
+ <div className="user-and-botton">
+ <img
+ className="user__img user__img--brder-re... | JavaScript | 수정했숨미당~!😇 |
@@ -0,0 +1,22 @@
+import React from 'react';
+
+class Story extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user">
+ <img
+ className="user__img user__img--brder-red"
+ alt={nickname}
+ src={img}
+ ... | JavaScript | 여기두용~ |
@@ -0,0 +1,281 @@
+/*------공통-----*/
+/*------공통-----*/
+
+.main-body {
+ background-color: var(--color-boxgray);
+}
+
+main {
+ display: flex;
+ margin-left: 100px;
+}
+
+ul > li {
+ margin: 10px 0;
+}
+
+a {
+ text-decoration: none;
+ color: inherit;
+}
+
+.box {
+ background-color: white;
+ border: 1px solid... | Unknown | common.scss 파일에 이미 있어서 해당 부분 삭제했어용 ㅎ...😱 |
@@ -0,0 +1,51 @@
+import React from 'react';
+import { withRouter } from 'react-router-dom';
+
+class LoginForm extends React.Component {
+ constructor() {
+ super();
+ this.state = { id: '', ps: '' };
+ }
+
+ goToMain = e => {
+ this.props.history.push('/main-yoonhee');
+ };
+
+ handleInput = e => {
+ ... | JavaScript | 래영님 강의 덕분입니당 ㅋ.ㅋ |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 데이터 내용의 뜻을 알 수 있게 comment로 변경했습니다! |
@@ -0,0 +1,29 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
+import org.aopalliance.intercept.MethodInvocation;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+public class SecuredA... | Java | method.getAnnotation(Secured.class)를 사용하여 `@Secured` 어노테이션을 조회하고 있네요.
Spring AOP 환경에서는 메서드가 프록시 객체로 감싸질 수 있기 때문에, 프록시된 메서드를 조회할 경우 실제 구현체의 메서드에서 선언된 `@Secured` 어노테이션을 찾지 못할 가능성이 있습니다.
method.getAnnotation 와 AopUtils.getMostSpecificMethod() 어떤 차이가 있을까요? 😄 |
@@ -23,7 +23,7 @@
@AutoConfigureMockMvc
class BasicAuthTest {
private final Member TEST_ADMIN_MEMBER = new Member("a@a.com", "password", "a", "", Set.of("ADMIN"));
- private final Member TEST_USER_MEMBER = new Member("b@b.com", "password", "b", "", Set.of());
+ private final Member TEST_USER_MEMBER = new M... | Java | 테스트 코드 👍 |
@@ -0,0 +1,29 @@
+package nextstep.security.authorization;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authentication.AuthenticationException;
+import org.aopalliance.intercept.MethodInvocation;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+public class SecuredA... | Java | AopUtils.getMostSpecificMethod()를 사용하면 프록시 객체든 아니든 실제 객체의 메서드를 조회하여 @Secured 어노테이션을 못찾는 경우가 발생하지 않겠네요!
감사합니다 :) |
@@ -0,0 +1,83 @@
+@import '../../../../../Styles/common.scss';
+
+.navYeseul {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ right: 0;
+ transform: translateX(-50%);
+ padding: 8px 0;
+ border-bottom: 1px solid $main-border;
+ background-color: #fff;
+ z-index: 9999;
+
+ .inner-nav {
+ display: flex;
+ ju... | Unknown | css 속성 순서에 따르면 z-index가 가장 아래에 와야 할 것 같아요 😀 |
@@ -0,0 +1,83 @@
+@import '../../../../../Styles/common.scss';
+
+.navYeseul {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ right: 0;
+ transform: translateX(-50%);
+ padding: 8px 0;
+ border-bottom: 1px solid $main-border;
+ background-color: #fff;
+ z-index: 9999;
+
+ .inner-nav {
+ display: flex;
+ ju... | Unknown | common css에 있어서 빼셔도 될 것 같아요! |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | 디테일....👍👍 |
@@ -0,0 +1,140 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import User from '../User/User';
+import Comment from '../Comment/Comment';
+import IconButton from '../Button/IconButton';
+import { API } from '../../../../../config';
+import './Feed.scss';
+
+class Feed extends C... | JavaScript | 오홍 예슬님은 filter로 구현하셨네여! :) |
@@ -0,0 +1,140 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import User from '../User/User';
+import Comment from '../Comment/Comment';
+import IconButton from '../Button/IconButton';
+import { API } from '../../../../../config';
+import './Feed.scss';
+
+class Feed extends C... | JavaScript | id값으로 key props 할당 👍 💯 🥇 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.