Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
authserv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai
authserv
Commits
5d87d16d
Commit
5d87d16d
authored
10 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
require service on auth_pwonly
parent
6eaea794
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
authserv/app_main.py
+3
-2
3 additions, 2 deletions
authserv/app_main.py
authserv/test/test_app_main.py
+3
-0
3 additions, 0 deletions
authserv/test/test_app_main.py
with
6 additions
and
2 deletions
authserv/app_main.py
+
3
−
2
View file @
5d87d16d
...
@@ -55,15 +55,16 @@ def api_auth():
...
@@ -55,15 +55,16 @@ def api_auth():
@app.route
(
'
/api/1/auth_pwonly
'
,
methods
=
(
'
POST
'
,))
@app.route
(
'
/api/1/auth_pwonly
'
,
methods
=
(
'
POST
'
,))
def
api_auth_pwonly
():
def
api_auth_pwonly
():
service
=
request
.
form
.
get
(
'
service
'
)
username
=
request
.
form
.
get
(
'
username
'
)
username
=
request
.
form
.
get
(
'
username
'
)
password
=
request
.
form
.
get
(
'
password
'
)
password
=
request
.
form
.
get
(
'
password
'
)
if
not
username
:
if
not
service
or
not
username
:
abort
(
400
)
abort
(
400
)
try
:
try
:
auth_status
,
errmsg
,
unused_shard
=
do_auth
(
auth_status
,
errmsg
,
unused_shard
=
do_auth
(
username
,
Non
e
,
None
,
password
,
None
,
None
,
username
,
servic
e
,
None
,
password
,
None
,
None
,
password_only
=
True
)
password_only
=
True
)
except
Exception
,
e
:
except
Exception
,
e
:
app
.
logger
.
exception
(
'
Unexpected exception in auth_pwonly()
'
)
app
.
logger
.
exception
(
'
Unexpected exception in auth_pwonly()
'
)
...
...
This diff is collapsed.
Click to expand it.
authserv/test/test_app_main.py
+
3
−
0
View file @
5d87d16d
...
@@ -223,6 +223,7 @@ class ServerTest(unittest.TestCase):
...
@@ -223,6 +223,7 @@ class ServerTest(unittest.TestCase):
response
=
self
.
app
.
post
(
response
=
self
.
app
.
post
(
URL_PWONLY
,
data
=
{
URL_PWONLY
,
data
=
{
'
username
'
:
'
user
'
,
'
username
'
:
'
user
'
,
'
service
'
:
'
svc
'
,
'
password
'
:
'
pass
'
})
'
password
'
:
'
pass
'
})
self
.
assertEquals
(
protocol
.
OK
,
response
.
data
)
self
.
assertEquals
(
protocol
.
OK
,
response
.
data
)
...
@@ -230,6 +231,7 @@ class ServerTest(unittest.TestCase):
...
@@ -230,6 +231,7 @@ class ServerTest(unittest.TestCase):
response
=
self
.
app
.
post
(
response
=
self
.
app
.
post
(
URL_PWONLY
,
data
=
{
URL_PWONLY
,
data
=
{
'
username
'
:
'
otpuser
'
,
'
username
'
:
'
otpuser
'
,
'
service
'
:
'
svc
'
,
'
password
'
:
'
pass
'
})
'
password
'
:
'
pass
'
})
self
.
assertEquals
(
protocol
.
OK
,
response
.
data
)
self
.
assertEquals
(
protocol
.
OK
,
response
.
data
)
...
@@ -237,6 +239,7 @@ class ServerTest(unittest.TestCase):
...
@@ -237,6 +239,7 @@ class ServerTest(unittest.TestCase):
response
=
self
.
app
.
post
(
response
=
self
.
app
.
post
(
URL_PWONLY
,
data
=
{
URL_PWONLY
,
data
=
{
'
username
'
:
'
user
'
,
'
username
'
:
'
user
'
,
'
service
'
:
'
svc
'
,
'
password
'
:
'
badpass
'
})
'
password
'
:
'
badpass
'
})
self
.
assertEquals
(
protocol
.
ERR_AUTHENTICATION_FAILURE
,
self
.
assertEquals
(
protocol
.
ERR_AUTHENTICATION_FAILURE
,
response
.
data
)
response
.
data
)
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