Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
3ae54663
Commit
3ae54663
authored
Sep 22, 2016
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP ERP5Security: JWT improvments
parent
696d5969
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
product/ERP5Security/ERP5JSONWebTokenPlugin.py
product/ERP5Security/ERP5JSONWebTokenPlugin.py
+5
-8
No files found.
product/ERP5Security/ERP5JSONWebTokenPlugin.py
View file @
3ae54663
...
...
@@ -99,7 +99,7 @@ class ERP5JSONWebTokenPlugin(ERP5UserManager):
LOG
(
'ERP5JSONWebTokenPlugin'
,
INFO
,
'No jwt module, install pyjwt package. '
'Authentication disabled.'
)
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
return
None
creds
=
{}
...
...
@@ -142,6 +142,7 @@ class ERP5JSONWebTokenPlugin(ERP5UserManager):
person_relative_url
=
data
[
"sub"
].
encode
()
user
=
self
.
getPortalObject
().
unrestrictedTraverse
(
person_relative_url
)
# Activate password to have the real tid
user
.
password
.
_p_activate
()
if
data
[
"ptid"
]
==
u64
(
user
.
password
.
_p_serial
)
\
and
(
not
origin
or
data
and
\
...
...
@@ -173,13 +174,9 @@ class ERP5JSONWebTokenPlugin(ERP5UserManager):
'Authentication disabled.'
)
return
authentication_result
if
"person_relative_url"
not
in
credentials
:
user
=
self
.
getUserByLogin
(
authentication_result
[
0
])[
0
]
else
:
user
=
self
.
getPortalObject
().
unrestrictedTraverse
(
credentials
[
"person_relative_url"
]
)
user
=
self
.
getUserByLogin
(
authentication_result
[
0
])[
0
]
# Activate password to have the real tid
user
.
password
.
_p_activate
()
data
=
{
"sub"
:
user
.
getRelativeUrl
(),
...
...
@@ -226,7 +223,7 @@ class ERP5JSONWebTokenPlugin(ERP5UserManager):
# Expire default cookie set by default
# (even with plugin deactivated)
request
.
response
.
expireCookie
(
'__ac'
)
#
request.response.expireCookie('__ac')
return
authentication_result
...
...
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