"Fossies" - the Fresh Open Source Software Archive

Member "mod_auth_gssapi-1.6.3/tests/t_spnego_no_auth.py" (15 May 2020, 662 Bytes) of package /linux/www/apache_httpd_modules/mod_auth_gssapi-1.6.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "t_spnego_no_auth.py": 1.6.2_vs_1.6.3.

    1 #!/usr/bin/env python
    2 # Copyright (C) 2015 - mod_auth_gssapi contributors, see COPYING for license.
    3 
    4 import os
    5 
    6 import requests
    7 from requests_gssapi import HTTPKerberosAuth, OPTIONAL # noqa
    8 
    9 
   10 if __name__ == '__main__':
   11     sess = requests.Session()
   12     url = 'http://%s/spnego/' % os.environ['NSS_WRAPPER_HOSTNAME']
   13 
   14     r = sess.get(url)
   15     if r.status_code != 401:
   16         raise ValueError('Spnego failed - 401 expected')
   17 
   18     if not (r.headers.get("WWW-Authenticate") and
   19             r.headers.get("WWW-Authenticate").startswith("Negotiate")):
   20         raise ValueError('Spnego failed - WWW-Authenticate Negotiate header '
   21                          'missing')