ソースを参照

add jwt for authentification

pull/342/head
Guillaume Vincent 8年前
コミット
36ea4ec319
4個のファイルの変更16行の追加8行の削除
  1. +1
    -1
      .gitignore
  2. +2
    -1
      api/urls.py
  3. +12
    -6
      lesspass/settings.py
  4. +1
    -0
      requirements.txt

+ 1
- 1
.gitignore ファイルの表示

@@ -69,7 +69,7 @@ target/
[Ss]cripts
pyvenv.cfg
pip-selfcheck.json
/config/config.ini
config
*.sqlite3
/frontend/node_modules
.idea/

+ 2
- 1
api/urls.py ファイルの表示

@@ -1,12 +1,13 @@
import rest_framework_jwt.views
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter

from api import views

router = DefaultRouter()
router.register(r'auth', views.AuthViewSet, base_name="auth")
router.register(r'entries', views.EntryViewSet, base_name='entries')

urlpatterns = [
url(r'^', include(router.urls)),
url(r'^auth/', rest_framework_jwt.views.obtain_jwt_token),
]

+ 12
- 6
lesspass/settings.py ファイルの表示

@@ -38,8 +38,6 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',

'django.contrib.sites',
]

MIDDLEWARE_CLASSES = [
@@ -84,7 +82,6 @@ DATABASES = {
}
}


AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
@@ -113,11 +110,20 @@ USE_TZ = False
STATIC_URL = '/static/'

REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20,
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.OrderingFilter',
'rest_framework.filters.SearchFilter',),
'DEFAULT_FILTER_BACKENDS': (
'rest_framework.filters.OrderingFilter',
'rest_framework.filters.SearchFilter',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework.renderers.BrowsableAPIRenderer',


+ 1
- 0
requirements.txt ファイルの表示

@@ -1,5 +1,6 @@
Django==1.9.1
djangorestframework==3.3.2
djangorestframework-jwt==1.7.2
smartconfigparser==0.1.1
psycopg2==2.6.1
gunicorn==19.4.5


読み込み中…
キャンセル
保存