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
163ba109
Commit
163ba109
authored
Apr 19, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! fixup! oauth2_authorisation: py3
parent
5ea407ba
Pipeline
#34141
failed with stage
in 0 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
8 deletions
+12
-8
bt5/erp5_oauth2_authorisation/TestTemplateItem/portal_components/test.erp5.testOAuth2Server.py
...plateItem/portal_components/test.erp5.testOAuth2Server.py
+1
-1
bt5/erp5_oauth2_resource/DocumentTemplateItem/portal_components/document.erp5.OAuth2AuthorisationClientConnector.py
...nents/document.erp5.OAuth2AuthorisationClientConnector.py
+6
-3
product/ERP5/ERP5Site.py
product/ERP5/ERP5Site.py
+3
-2
product/ERP5Security/ERP5OAuth2ResourceServerPlugin.py
product/ERP5Security/ERP5OAuth2ResourceServerPlugin.py
+2
-2
No files found.
bt5/erp5_oauth2_authorisation/TestTemplateItem/portal_components/test.erp5.testOAuth2Server.py
View file @
163ba109
...
@@ -497,7 +497,7 @@ class TestOAuth2(ERP5TypeTestCase):
...
@@ -497,7 +497,7 @@ class TestOAuth2(ERP5TypeTestCase):
b''
,
b''
,
# XXX: Tolerate the redirect URL being returned in the body.
# XXX: Tolerate the redirect URL being returned in the body.
# This is a bug, body should really be empty.
# This is a bug, body should really be empty.
header_dict
.
get
(
'location'
,
b''
),
str2bytes
(
header_dict
.
get
(
'location'
,
''
)
),
),
),
)
)
parsed_location
=
urlsplit
(
header_dict
.
get
(
'location'
,
''
))
parsed_location
=
urlsplit
(
header_dict
.
get
(
'location'
,
''
))
...
...
bt5/erp5_oauth2_resource/DocumentTemplateItem/portal_components/document.erp5.OAuth2AuthorisationClientConnector.py
View file @
163ba109
...
@@ -227,13 +227,16 @@ class _OAuth2AuthorisationServerProxy(object):
...
@@ -227,13 +227,16 @@ class _OAuth2AuthorisationServerProxy(object):
)
)
else
:
else
:
Connection
=
HTTPConnection
Connection
=
HTTPConnection
if
six
.
PY2
:
# Changed in version 3.4: The strict parameter was removed.
# HTTP 0.9-style “Simple Responses” are no longer supported.
Connection
=
functools
.
partial
(
Connection
,
strict
=
True
)
timeout
=
getTimeLeft
()
timeout
=
getTimeLeft
()
if
timeout
is
None
or
timeout
>
self
.
_timeout
:
if
timeout
is
None
or
timeout
>
self
.
_timeout
:
timeout
=
self
.
_timeout
timeout
=
self
.
_timeout
http_connection
=
Connection
(
http_connection
=
Connection
(
host
=
parsed_url
.
hostname
,
host
=
parsed_url
.
hostname
,
port
=
parsed_url
.
port
,
port
=
parsed_url
.
port
,
strict
=
True
,
timeout
=
timeout
,
timeout
=
timeout
,
source_address
=
self
.
_bind_address
,
source_address
=
self
.
_bind_address
,
)
)
...
@@ -274,7 +277,7 @@ class _OAuth2AuthorisationServerProxy(object):
...
@@ -274,7 +277,7 @@ class _OAuth2AuthorisationServerProxy(object):
def
_queryOAuth2
(
self
,
method
,
REQUEST
,
RESPONSE
):
def
_queryOAuth2
(
self
,
method
,
REQUEST
,
RESPONSE
):
header_dict
,
body
,
status
=
self
.
_query
(
header_dict
,
body
,
status
=
self
.
_query
(
method
,
method
,
body
=
urlencode
(
REQUEST
.
form
.
items
()
),
body
=
urlencode
(
REQUEST
.
form
),
header_dict
=
{
header_dict
=
{
'CONTENT_TYPE'
:
REQUEST
.
environ
[
'CONTENT_TYPE'
],
'CONTENT_TYPE'
:
REQUEST
.
environ
[
'CONTENT_TYPE'
],
},
},
...
@@ -864,7 +867,7 @@ class OAuth2AuthorisationClientConnector(
...
@@ -864,7 +867,7 @@ class OAuth2AuthorisationClientConnector(
try
:
try
:
state_dict
=
json
.
loads
(
state_dict
=
json
.
loads
(
self
.
__getMultiFernet
().
decrypt
(
self
.
__getMultiFernet
().
decrypt
(
st
ate
,
st
r2bytes
(
state
)
,
ttl
=
self
.
_SESSION_STATE_VALIDITY
,
ttl
=
self
.
_SESSION_STATE_VALIDITY
,
),
),
)
)
...
...
product/ERP5/ERP5Site.py
View file @
163ba109
...
@@ -46,6 +46,7 @@ from Products.ERP5Type.TransactionalVariable import \
...
@@ -46,6 +46,7 @@ from Products.ERP5Type.TransactionalVariable import \
getTransactionalVariable
,
TransactionalResource
getTransactionalVariable
,
TransactionalResource
from
Products.ERP5Type.dynamic.portal_type_class
import
synchronizeDynamicModules
from
Products.ERP5Type.dynamic.portal_type_class
import
synchronizeDynamicModules
from
Products.ERP5Type.mixin.response_header_generator
import
ResponseHeaderGenerator
from
Products.ERP5Type.mixin.response_header_generator
import
ResponseHeaderGenerator
from
Products.ERP5Type.Utils
import
str2bytes
,
bytes2str
from
zLOG
import
LOG
,
INFO
,
WARNING
,
ERROR
from
zLOG
import
LOG
,
INFO
,
WARNING
,
ERROR
from
zExceptions
import
BadRequest
from
zExceptions
import
BadRequest
...
@@ -248,10 +249,10 @@ class AutorisationExtractorBeforeTraverseHook(object):
...
@@ -248,10 +249,10 @@ class AutorisationExtractorBeforeTraverseHook(object):
ERP5_AUTHORISATION_EXTRACTOR_PASSWORD_NAME
in
form_dict
ERP5_AUTHORISATION_EXTRACTOR_PASSWORD_NAME
in
form_dict
):
):
username
=
form_dict
[
ERP5_AUTHORISATION_EXTRACTOR_USERNAME_NAME
]
username
=
form_dict
[
ERP5_AUTHORISATION_EXTRACTOR_USERNAME_NAME
]
request
.
_auth
=
'Basic '
+
b
ase64
.
b64encode
(
'%s:%s'
%
(
request
.
_auth
=
'Basic '
+
b
ytes2str
(
base64
.
b64encode
(
str2bytes
(
'%s:%s'
%
(
username
,
username
,
form_dict
[
ERP5_AUTHORISATION_EXTRACTOR_PASSWORD_NAME
],
form_dict
[
ERP5_AUTHORISATION_EXTRACTOR_PASSWORD_NAME
],
))
))
))
request
.
response
.
_auth
=
1
request
.
response
.
_auth
=
1
_setUserNameForAccessLog
(
username
,
request
)
_setUserNameForAccessLog
(
username
,
request
)
...
...
product/ERP5Security/ERP5OAuth2ResourceServerPlugin.py
View file @
163ba109
...
@@ -48,7 +48,7 @@ from Products.PluggableAuthService.interfaces.plugins import (
...
@@ -48,7 +48,7 @@ from Products.PluggableAuthService.interfaces.plugins import (
)
)
from
Products.ERP5Security
import
_setUserNameForAccessLog
from
Products.ERP5Security
import
_setUserNameForAccessLog
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
,
unicode2str
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
,
str2unicode
,
unicode2str
# Public constants. Must not change once deployed.
# Public constants. Must not change once deployed.
...
@@ -426,7 +426,7 @@ class ERP5OAuth2ResourceServerPlugin(BasePlugin):
...
@@ -426,7 +426,7 @@ class ERP5OAuth2ResourceServerPlugin(BasePlugin):
The schema of this dictionary is purely an internal implementation detail
The schema of this dictionary is purely an internal implementation detail
of this plugin.
of this plugin.
"""
"""
client_address
=
request
.
getClientAddr
().
decode
(
'utf-8'
)
client_address
=
str2unicode
(
request
.
getClientAddr
()
)
token
=
self
.
__checkTokenSignature
(
access_token
)
token
=
self
.
__checkTokenSignature
(
access_token
)
if
token
is
None
and
can_update_key
:
if
token
is
None
and
can_update_key
:
self
.
__updateAccessTokenSignatureKeyList
(
request
=
request
)
self
.
__updateAccessTokenSignatureKeyList
(
request
=
request
)
...
...
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