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 ํ• ๋‹น ๐Ÿ‘ ๐Ÿ’ฏ ๐Ÿฅ‡