Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
80ff9e81
Commit
80ff9e81
authored
Nov 16, 2017
by
sim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore JWT token route
parent
fee713a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
jwt.py
gargantext/backend/jwt.py
+1
-1
settings.py
gargantext/backend/settings.py
+1
-1
urls.py
gargantext/backend/urls.py
+2
-0
No files found.
gargantext/
util
/jwt.py
→
gargantext/
backend
/jwt.py
View file @
80ff9e81
...
@@ -2,7 +2,7 @@ from django.conf import settings
...
@@ -2,7 +2,7 @@ from django.conf import settings
from
rest_framework_jwt.settings
import
api_settings
from
rest_framework_jwt.settings
import
api_settings
from
calendar
import
timegm
from
calendar
import
timegm
from
.dates
import
datetime
from
gargantext.util
.dates
import
datetime
def
jwt_payload_handler
(
user
):
def
jwt_payload_handler
(
user
):
username
=
user
.
username
username
=
user
.
username
...
...
gargantext/backend/settings.py
View file @
80ff9e81
...
@@ -178,7 +178,7 @@ REST_FRAMEWORK = {
...
@@ -178,7 +178,7 @@ REST_FRAMEWORK = {
# See http://getblimp.github.io/django-rest-framework-jwt/
# See http://getblimp.github.io/django-rest-framework-jwt/
JWT_AUTH
=
{
JWT_AUTH
=
{
'JWT_PAYLOAD_HANDLER'
:
'gargantext.
util
.jwt.jwt_payload_handler'
,
'JWT_PAYLOAD_HANDLER'
:
'gargantext.
backend
.jwt.jwt_payload_handler'
,
'JWT_VERIFY_EXPIRATION'
:
True
,
'JWT_VERIFY_EXPIRATION'
:
True
,
'JWT_SECRET_KEY'
:
config
(
'SECRET_KEY'
),
'JWT_SECRET_KEY'
:
config
(
'SECRET_KEY'
),
'JWT_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
36000
),
'JWT_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
36000
),
...
...
gargantext/backend/urls.py
View file @
80ff9e81
...
@@ -17,9 +17,11 @@ from django.conf.urls import url
...
@@ -17,9 +17,11 @@ from django.conf.urls import url
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.views.generic.base
import
RedirectView
as
Redirect
from
django.views.generic.base
import
RedirectView
as
Redirect
from
django.contrib.staticfiles.storage
import
staticfiles_storage
as
static
from
django.contrib.staticfiles.storage
import
staticfiles_storage
as
static
from
rest_framework_jwt.views
import
obtain_jwt_token
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r'^admin/'
,
admin
.
site
.
urls
),
url
(
r'^favicon.ico$'
,
Redirect
.
as_view
(
url
=
static
.
url
(
'favicon.ico'
),
url
(
r'^favicon.ico$'
,
Redirect
.
as_view
(
url
=
static
.
url
(
'favicon.ico'
),
permanent
=
False
),
name
=
"favicon"
),
permanent
=
False
),
name
=
"favicon"
),
url
(
r'^api/auth/token$'
,
obtain_jwt_token
),
]
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment