diff --git a/authserv/app_main.py b/authserv/app_main.py index 17016878c225111a411010d173d8907365962aa8..adab20a0539c074997824b644ec0636f52543c69 100644 --- a/authserv/app_main.py +++ b/authserv/app_main.py @@ -55,15 +55,16 @@ def api_auth(): @app.route('/api/1/auth_pwonly', methods=('POST',)) def api_auth_pwonly(): + service = request.form.get('service') username = request.form.get('username') password = request.form.get('password') - if not username: + if not service or not username: abort(400) try: auth_status, errmsg, unused_shard = do_auth( - username, None, None, password, None, None, + username, service, None, password, None, None, password_only=True) except Exception, e: app.logger.exception('Unexpected exception in auth_pwonly()') diff --git a/authserv/test/test_app_main.py b/authserv/test/test_app_main.py index b54ad531f6b361281b3c3ccb6bc979bff2e5bf77..f0d26993fc25a629f45362416193d3735905bb3e 100644 --- a/authserv/test/test_app_main.py +++ b/authserv/test/test_app_main.py @@ -223,6 +223,7 @@ class ServerTest(unittest.TestCase): response = self.app.post( URL_PWONLY, data={ 'username': 'user', + 'service': 'svc', 'password': 'pass'}) self.assertEquals(protocol.OK, response.data) @@ -230,6 +231,7 @@ class ServerTest(unittest.TestCase): response = self.app.post( URL_PWONLY, data={ 'username': 'otpuser', + 'service': 'svc', 'password': 'pass'}) self.assertEquals(protocol.OK, response.data) @@ -237,6 +239,7 @@ class ServerTest(unittest.TestCase): response = self.app.post( URL_PWONLY, data={ 'username': 'user', + 'service': 'svc', 'password': 'badpass'}) self.assertEquals(protocol.ERR_AUTHENTICATION_FAILURE, response.data)