Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
slapos.core
Commits
11dab143
Commit
11dab143
authored
Jun 23, 2017
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
authentication machine work when certificate serial is set instead of REMOTE_USER
parent
37aae0a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
master/product/SlapOS/SlapOSMachineAuthenticationPlugin.py
master/product/SlapOS/SlapOSMachineAuthenticationPlugin.py
+22
-7
No files found.
master/product/SlapOS/SlapOSMachineAuthenticationPlugin.py
View file @
11dab143
...
...
@@ -108,6 +108,7 @@ class SlapOSMachineAuthenticationPlugin(BasePlugin):
meta_type
=
"SlapOS Machine Authentication Plugin"
security
=
ClassSecurityInfo
()
certificate_portal_type
=
"Certificate Access ID"
def
__init__
(
self
,
id
,
title
=
None
):
#Register value
...
...
@@ -126,18 +127,32 @@ class SlapOSMachineAuthenticationPlugin(BasePlugin):
# use get_header instead for Zope-2.8
getHeader
=
request
.
get_header
user_id
=
getHeader
(
'REMOTE_USER'
)
if
user_id
is
not
None
:
serial
=
getHeader
(
'SSL_CLIENT_SERIAL'
)
if
serial
is
not
None
:
# search for user linked to this serial
certificate_login_list
=
self
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
self
.
certificate_portal_type
,
reference
=
serial
)
creds
[
'machine_login'
]
=
None
if
len
(
certificate_login_list
)
!=
0
:
if
len
(
certificate_login_list
)
>
1
:
raise
ConsistencyError
(
'There is more than one of %s whose
\
serial is %s'
%
(
self
.
certificate_portal_type
,
serial
))
creds
[
'machine_login'
]
=
certificate_login_list
[
0
]
\
.
getParent
().
getReference
()
elif
user_id
is
not
None
:
creds
[
'machine_login'
]
=
user_id
creds
[
'remote_host'
]
=
request
.
get
(
'REMOTE_HOST'
,
''
)
try
:
creds
[
'remote_address'
]
=
request
.
getClientAddr
()
except
AttributeError
:
creds
[
'remote_address'
]
=
request
.
get
(
'REMOTE_ADDR'
,
''
)
return
creds
else
:
# fallback to default way
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
creds
[
'remote_host'
]
=
request
.
get
(
'REMOTE_HOST'
,
''
)
try
:
creds
[
'remote_address'
]
=
request
.
getClientAddr
()
except
AttributeError
:
creds
[
'remote_address'
]
=
request
.
get
(
'REMOTE_ADDR'
,
''
)
return
creds
################################
# IAuthenticationPlugin #
################################
...
...
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