コード例 #1
0
ファイル: __init__.py プロジェクト: retmas-dv/panda-deft
def _x509():
    voms_proxy = MyProxyClient()
    x509 = voms_proxy.get()
    if os.access(x509, os.R_OK):
        logger.debug("x509 = %s" % x509)
        return x509
    logger.warning("No valid grid proxy certificate found")
    return ""
コード例 #2
0
ファイル: tests.py プロジェクト: retmas-dv/panda-deft
class SecurityTest(TestCase):
    def setUp(self):
        self.voms_proxy = MyProxyClient()
        self.sso_test_url = 'https://espace.cern.ch/authentication/default.aspx'

    def test_cern_sso(self):
        try:
            sso_cookies = SSOCookies(self.sso_test_url, krb=True, use_cached=False)
        except Exception as ex:
            print "test_cern_sso, exception occurred (1): %s" % str(ex)
            sso_cookies = None

        self.assertNotEqual(sso_cookies, None)

        result = requests.get(self.sso_test_url, cookies=sso_cookies.get(), verify=False)

        self.assertEqual(result.status_code, 200)

        try:
            cached_sso_cookies = SSOCookies(self.sso_test_url, krb=True, use_cached=True)
        except Exception as ex:
            print "test_cern_sso, exception occurred (2): %s" % str(ex)
            cached_sso_cookies = None

        self.assertNotEqual(cached_sso_cookies, None)

        self.assertEqual(cached_sso_cookies.get(), sso_cookies.get())

        result = requests.get(self.sso_test_url, cookies=cached_sso_cookies.get(), verify=False)

        self.assertEqual(result.status_code, 200)

    def test_voms(self):
        try:
            proxy_file_path = self.voms_proxy.get()
        except Exception as ex:
            print "test_voms, exception occurred: %s" % str(ex)
            proxy_file_path = None

        self.assertNotEqual(proxy_file_path, None)

        self.voms_proxy.remove()
コード例 #3
0
ファイル: tests.py プロジェクト: retmas-dv/panda-deft
 def setUp(self):
     self.voms_proxy = MyProxyClient()
     self.sso_test_url = 'https://espace.cern.ch/authentication/default.aspx'