Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
809f56f2
Commit
809f56f2
authored
Apr 18, 2016
by
Pavel Kácha
Browse files
Options
Downloads
Patches
Plain Diff
NoAuthenticator now creates ad-hoc client ids based on client name (thanks to Radko Krkos)
parent
9bc901ef
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
warden3/warden_server/warden_server.py
+17
-4
17 additions, 4 deletions
warden3/warden_server/warden_server.py
with
17 additions
and
4 deletions
warden3/warden_server/warden_server.py
+
17
−
4
View file @
809f56f2
...
...
@@ -279,8 +279,21 @@ class NoAuthenticator(ObjectReq):
ObjectReq
.
__init__
(
self
,
req
)
def
shash
(
self
,
s
):
"""
Simple FNV1 hash for creating ids on the fly
"""
res
=
2166136261
for
c
in
s
:
res
=
0xFFFFFFFF
&
res
*
16777619
^
ord
(
c
)
return
res
def
authenticate
(
self
,
env
,
args
):
return
"
anybody
"
# or None
name
=
args
.
get
(
"
client
"
,
[
None
])[
0
]
if
name
is
None
:
logging
.
error
(
"
NoAuthenticator: clients must authenticate by name, not secret
"
)
return
None
return
Client
(
self
.
shash
(
name
),
None
,
None
,
None
,
name
,
None
,
1
,
None
,
1
,
1
,
1
,
0
)
def
authorize
(
self
,
env
,
client
,
path
,
method
):
...
...
@@ -336,8 +349,8 @@ class X509Authenticator(NoAuthenticator):
name
,
secret
,
str
(
cert_names
)))
return
None
# Clients with 'secret' set mus
e
t get auth
oriz
ed by it.
# No secret turns auth off for this particular client.
# Clients with 'secret' set must get auth
enticat
ed by it.
# No secret turns
secret
auth off for this particular client.
if
client
.
secret
is
not
None
and
secret
is
None
:
logging
.
info
(
"
authenticate: missing secret argument
"
)
return
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment