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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
d5b56fbe
Commit
d5b56fbe
authored
Feb 11, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openid_connect_client_login: py3
parent
6e3de37a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
bt5/erp5_openid_connect_client_login/SkinTemplateItem/portal_skins/erp5_openid_connect_client/ERP5Site_receiveOpenIdCallback.py
...5_openid_connect_client/ERP5Site_receiveOpenIdCallback.py
+8
-3
No files found.
bt5/erp5_openid_connect_client_login/SkinTemplateItem/portal_skins/erp5_openid_connect_client/ERP5Site_receiveOpenIdCallback.py
View file @
d5b56fbe
import
six
import
time
request
=
container
.
REQUEST
...
...
@@ -48,8 +49,10 @@ elif code is not None:
"""
if
"error"
in
response_dict
:
return
handleError
(
response_dict
.
get
(
'error'
),
response_dict
.
get
(
'error_description'
),
state
)
access_token
=
response_dict
[
'access_token'
].
encode
(
'utf-8'
)
hash_str
=
context
.
Base_getHMAC
(
access_token
,
access_token
)
access_token
=
response_dict
[
'access_token'
]
if
six
.
PY2
:
access_token
=
access_token
.
encode
(
'utf-8'
)
hash_str
=
context
.
Base_getHMAC
(
access_token
.
encode
(
'utf-8'
),
access_token
.
encode
(
'utf-8'
))
context
.
setAuthCookie
(
response
,
'__ac_openidconnect_hash'
,
hash_str
)
# store timestamp in second since the epoch in UTC is enough
response_dict
[
"response_timestamp"
]
=
time
.
time
()
...
...
@@ -57,7 +60,9 @@ elif code is not None:
response_dict
,
"openid_connect_server_auth_token_cache_factory"
)
user_dict
=
context
.
ERP5Site_getOpenIdUserEntry
(
token
=
access_token
)
user_reference
=
user_dict
[
"sub"
].
encode
(
'utf-8'
)
user_reference
=
user_dict
[
"sub"
]
if
six
.
PY2
:
user_reference
=
user_reference
.
encode
(
'utf-8'
)
context
.
Base_setBearerToken
(
access_token
,
{
"reference"
:
user_reference
},
"openid_connect_server_auth_token_cache_factory"
)
...
...
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