Authentication
ํ์ ๊ฐ์
๋น๋ฐ๋ฒํธ ์ ๊ณต ๋ฐ ํ์ธ
UserCreateionForm
์ถ๊ฐ column ์ ์์ ์ฅ logic์์ ์ผ์นํ๋์ง ํ์ธ
๋น๋ฐ๋ฒํธ ์ํธํ ์ ์ฅ
User.objects.create_user(username, email=None, password=None)
user.set_password(password)
๋ก๊ทธ์ธ
์ฌ์ฉ์๊ฐ ๋ก๊ทธ์ธ ํ ์ฌ๋์ด๋ค?
Stateless & Connectless
๋งค ์์ฒญ์ด ๋ ๋ฆฝ ์ฌ๊ฑด
cookie
๊ฐ ์ด๊ฑธ ์ด์ด์ค๋ค!
User Object
core of the authentication system
AbstractBaseUser
AbstractUser
User
Primary attributes of default user
username
password
email
first_name
last_name
Creating Users
Changing Password
1. Using command line
2. Using set_password()
set_password()
Authenticating Users
authenticate(request=None, **credentials)
use it to verify a set of credentials
takes credentials as keyword arguments
username and password for the default cases
returns
User
object if credentials are valid for a backend
์ฅ๋ฐ๊ตฌ๋
์ฌ์ฉ์ ---> ์ฅ๋ฐ๊ตฌ๋ ---> ์ฟ ํก
์ฌ์ฉ์ <--- ์ฟ ํค <--- ์ฟ ํก
์ฅ๋ฐ๊ตฌ๋ ==
cookie
๊ตฌ๋งค๋ด์ญ ==
data
๋ก๊ทธ์ธ == create
๋ก๊ทธ์์ == delete
๋ก๊ทธ์ธ Form
AutehticationForm
์ ModelForm ์ด ์๋๋ผ ๊ทธ๋ฅ Form ์ด๋ค!
๋ก๊ทธ์ธ ํจ์
else
๋ฌธ ์ฒ๋ฆฌ๋ฅผ ๋งค๋๋ฝ๊ฒ ํ๊ธฐ ์ํด ์ฒซ๋ฒ์งธif
๋ก POST๋ฅผ ๋จผ์ ๊ฑฐ๋ฅธ๋คwhy?
๋ง์ฝ GET์ ๋จผ์ ๊ฑฐ๋ฅด๋ฉด, POST์์
.is_valid()
์ ๊ฑธ๋ฆฌ์ง ์๊ณelse
๋ก ๋จ์ด์ง๋ฉด ๋ค์ renderํ๋ ์ฝ๋ ์จ์ค์ผํด์!์ฆ, code์ ๊ฒฝ์ ์ฑ์ ์ํด *POST ๋ฅผ ๋จผ์ ์ด๋ค!
+
POST
๋ก ๋จผ์ ๋ถ๊ธฐํ๋ ์ด์
POST
๋ก ๋จผ์ ๋ถ๊ธฐํ๋ ์ด์ ์ฝ๋์ ๊ฐ๊ฒฐ์ฑ
REST API ๋์
ํ์ฌ ์ฐ๋ฆฌ๋ GET & POST๋ง ๋์ํ๊ณ ์๋๋ฐ ์ดํ์ RESTful ํ๊ฒ ๋ฉ์๋ ๊ตฌ์ฑํ ๊ฒฝ์ฐ GET/POST/PUT/DELETE ์ฌ๋ฌ๊ฐ์ ๋ฉ์๋๊ฐ ์ค๊ฒ ๋๊ณ GET method๊ฐ ๋ง์ง๋ง์์ ํธ๋ค๋ง๋๋ ํํ๊ฐ ๊ฐ์ฅ ๊ฐ๊ฒฐํ ์ฝ๋ ๊ตฌ์ฑ์ด ๊ฐ๋ฅ!
Message Framework
new
-> ๊ธ ์์ฑ ํ์ด์ง (form)
create
-> DB์์ ์ฅ
-> render
-> redirect(์ฑ๊ณต์ฌ๋ถ)
-> redirect('articles:index')
HTTP๋ request์ response์ ๋ฐ๋ณต์ด๋ค!
HTTP
stateless (๋ฌด ์ํ์ฑ)
ํ๋ฒ ์์ฒญ์ ๋ณด๋ด๋ฉด ์ํ(๊ณผ๊ฑฐ)๋ฅผ ์ ์ ์์
๋ชจ๋ ์์ฒญ & ์๋ต์ ์ผํ์ฑ์ด๋ค
HTTP๋ ๋จ์ ์ ์ธ protocol
connectionless (๋ฌด ์ฐ๊ฒฐ์ฑ)
Message Framework
์ด์ ์ ์ํ๋ฅผ ๋ค์
Request
&Response
์ ๋๊ฒจ์ค๋ค๋ ๊ฒ์ด ์๋ฏธ๊ฐ ์๋คFallback Storage
Cookie ๊ฐ ์๋๋ฉด Session
Dynamic view
Article CRUD
title, content, create_at, updated_at
User CRUD (์ง์ < Django)
+
in memory cache -> ram์ ๋์๋๋ cache๋ผ๊ณ ์๊ฐํ๋ฉด ๋จ
memcached
redis
๊ตฌ๊ธ ๊ด๊ณ ์์ด๋......gdpr
macaddress = ๊ธฐ๊ธฐ์ ๋ณด
Last updated
Was this helpful?