diff options
author | Isaac Boukris <iboukris@gmail.com> | 2015-07-27 01:26:41 +0300 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-08-06 19:06:13 -0400 |
commit | 09104abbab05f92bf1f489fb8e4ee5ab3c2bec1a (patch) | |
tree | fd4562ebf3f8072024135bcc5fee1c91c4dbd3e6 /tests/magtests.py | |
parent | c8ac2a462bf649711707cf09c789f27892a05837 (diff) | |
download | mod_auth_gssapi-09104abbab05f92bf1f489fb8e4ee5ab3c2bec1a.tar.gz mod_auth_gssapi-09104abbab05f92bf1f489fb8e4ee5ab3c2bec1a.tar.xz mod_auth_gssapi-09104abbab05f92bf1f489fb8e4ee5ab3c2bec1a.zip |
Add test for basic auth with two different users over the same connection
Make sure each request is authenticated according to given credentials
even when GssapiConnectionBound is set.
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'tests/magtests.py')
-rwxr-xr-x | tests/magtests.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/magtests.py b/tests/magtests.py index 27f55f2..e144e83 100755 --- a/tests/magtests.py +++ b/tests/magtests.py @@ -73,8 +73,8 @@ KRB5_CONF_TEMPLATE = ''' } [domain_realm] - .mag.dev = MAG.DEV - mag.dev = MAG.DEV + .mag.dev = ${TESTREALM} + mag.dev = ${TESTREALM} [dbmodules] ${TESTREALM} = { @@ -167,6 +167,8 @@ def kadmin_local(cmd, env, logfile): USR_NAME = "maguser" USR_PWD = "magpwd" +USR_NAME_2 = "maguser2" +USR_PWD_2 = "magpwd2" SVC_KTNAME = "httpd/http.keytab" KEY_TYPE = "aes256-cts-hmac-sha1-96:normal" @@ -188,6 +190,10 @@ def setup_keys(tesdir, env): with (open(testlog, 'a')) as logfile: kadmin_local(cmd, env, logfile) + cmd = "addprinc -pw %s -e %s %s" % (USR_PWD_2, KEY_TYPE, USR_NAME_2) + with (open(testlog, 'a')) as logfile: + kadmin_local(cmd, env, logfile) + keys_env = { "KRB5_KTNAME": svc_keytab } keys_env.update(env) @@ -280,6 +286,16 @@ def test_basic_auth_krb5(testdir, testenv, testlog): else: sys.stderr.write('BASIC-AUTH: SUCCESS\n') + with (open(testlog, 'a')) as logfile: + basick5 = subprocess.Popen(["tests/t_basic_k5_two_users.py"], + stdout=logfile, stderr=logfile, + env=testenv, preexec_fn=os.setsid) + basick5.wait() + if basick5.returncode != 0: + sys.stderr.write('BASIC-AUTH Two Users: FAILED\n') + else: + sys.stderr.write('BASIC-AUTH Two Users: SUCCESS\n') + if __name__ == '__main__': @@ -310,7 +326,9 @@ if __name__ == '__main__': testenv = {'MAG_USER_NAME': USR_NAME, - 'MAG_USER_PASSWORD': USR_PWD} + 'MAG_USER_PASSWORD': USR_PWD, + 'MAG_USER_NAME_2': USR_NAME_2, + 'MAG_USER_PASSWORD_2': USR_PWD_2} testenv.update(kdcenv) test_basic_auth_krb5(testdir, testenv, testlog) |