diff options
| author | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-25 10:12:13 +0000 |
|---|---|---|
| committer | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-25 10:12:13 +0000 |
| commit | 9d460cf67c3999a0ec7723c377a60df07268b5c8 (patch) | |
| tree | c385668c848d9a322a6ec45433af18d00d0f50c7 /python/tests/sample-lep.py | |
| parent | 738257f33a816017ba2edf01288f14f61ca2f21f (diff) | |
| download | lasso-9d460cf67c3999a0ec7723c377a60df07268b5c8.tar.gz lasso-9d460cf67c3999a0ec7723c377a60df07268b5c8.tar.xz lasso-9d460cf67c3999a0ec7723c377a60df07268b5c8.zip | |
Removed obsolete Python test framework.
Diffstat (limited to 'python/tests/sample-lep.py')
| -rwxr-xr-x | python/tests/sample-lep.py | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/python/tests/sample-lep.py b/python/tests/sample-lep.py deleted file mode 100755 index 89b8df27..00000000 --- a/python/tests/sample-lep.py +++ /dev/null @@ -1,152 +0,0 @@ -#! /usr/bin/env python -# -*- coding: UTF-8 -*- - - -# Lasso Simulator -# By: Emmanuel Raviart <eraviart@entrouvert.com> -# -# Copyright (C) 2004 Entr'ouvert -# http://lasso.entrouvert.org -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -import logging -from optparse import OptionParser -import sys - -if not '..' in sys.path: - sys.path.insert(0, '..') -if not '../.libs' in sys.path: - sys.path.insert(0, '../.libs') - -import lasso - -import assertions -import builtins -import http -import liberty - - -applicationCamelCaseName = 'LassoSimulator' -applicationPublicName = 'Lasso Simulator' -applicationVersion = '(Unreleased CVS Version)' -logger = None - - -class HttpRequestHandlerMixin: - realm = '%s Web Site' % applicationPublicName - server_version = '%s/%s' % (applicationCamelCaseName, applicationVersion) - - def version_string(self): - return '%s %s' % (applicationPublicName, applicationVersion) - - -class HttpRequestHandler(HttpRequestHandlerMixin, http.HttpRequestHandler): - pass - - -class HttpsRequestHandler(HttpRequestHandlerMixin, http.HttpsRequestHandler): - pass - - -def main(): - # Parse command line options. - parser = OptionParser(version = '%%prog %s' % applicationVersion) - parser.add_option( - '-c', '--config', metavar = 'FILE', dest = 'configurationFilePath', - help = 'specify an alternate configuration file', - default = '/etc/lasso-simulator/config.xml') - parser.add_option( - '-d', '--daemon', dest = 'daemonMode', help = 'run main process in background', - action = 'store_true', default = False) - parser.add_option( - '-D', '--debug', dest = 'debugMode', help = 'enable program debugging', - action = 'store_true', default = False) - parser.add_option( - '-l', '--log', metavar = 'FILE', dest = 'logFilePath', help = 'specify log file', - default = '/dev/null') - parser.add_option( - '-L', '--log-level', metavar = 'LEVEL', dest = 'logLevel', - help = 'specify log level (debug, info, warning, error, critical)', default = 'info') - (options, args) = parser.parse_args() - if options.logLevel.upper() not in logging._levelNames: - raise Exception('Unknown log level: "%s"' % options.logLevel) - - # Configure logger. - logger = logging.getLogger() - if options.debugMode and not options.daemonMode: - handler = logging.StreamHandler(sys.stderr) - else: - handler = logging.FileHandler(options.logFilePath) - formatter = logging.Formatter('%(asctime)s %(levelname)-9s %(message)s') - handler.setFormatter(formatter) - logger.addHandler(handler) - logger.setLevel(logging._levelNames[options.logLevel.upper()]) - builtins.set('logger', logger) - - site = liberty.LibertyEnabledProxy('https://lecp1:2014/') - site.providerId = 'https://lecp1/metadata' - site.idpSite = liberty.IdentityProvider('https://idp1:1998/') - site.idpSite.providerId = 'https://idp1/metadata' - - lassoServer = lasso.Server.new( - '../../tests/data/lecp1-la/metadata.xml', - None, # '../../tests/data/lecp1-la/public-key.pem' is no more used - '../../tests/data/lecp1-la/private-key-raw.pem', - '../../tests/data/lecp1-la/certificate.pem', - lasso.signatureMethodRsaSha1) - lassoServer.add_provider( - '../../tests/data/idp1-la/metadata.xml', - '../../tests/data/idp1-la/public-key.pem', - '../../tests/data/ca1-la/certificate.pem') - lassoServer.add_provider( - '../../tests/data/sp1-la/metadata.xml', - '../../tests/data/sp1-la/public-key.pem', - '../../tests/data/ca1-la/certificate.pem') - site.lassoServerDump = lassoServer.dump() - failUnless(site.lassoServerDump) - lassoServer.destroy() - - site.certificateAbsolutePath = '../../tests/data/lecp1-ssl/certificate.pem' - site.privateKeyAbsolutePath = '../../tests/data/lecp1-ssl/private-key-raw.pem' - site.peerCaCertificateAbsolutePath = '../../tests/data/ca1-ssl/certificate.pem' - - site.newUser('rc') - site.newUser('nc') - # site.newUser('vf') Valery Febvre has no account on liberty-enabled proxy. - site.newUser('cn') - site.newUser('fp') - - HttpRequestHandlerMixin.site = site # Directly a site, not a server => no virtual host. -## httpServer = http.HttpServer(('lecp1', 2013), HttpRequestHandler) -## logger.info('Serving HTTP on %s port %s...' % httpServer.socket.getsockname()) - httpServer = http.HttpsServer( - ('lecp1', 2014), - HttpsRequestHandler, - site.privateKeyAbsolutePath, # Server private key - site.certificateAbsolutePath, # Server certificate - site.peerCaCertificateAbsolutePath, # Clients certification authority certificate - None, # sslCertificateChainFile see mod_ssl, ssl_engine_init.c, line 852 - None, # sslVerifyClient http://www.modssl.org/docs/2.1/ssl_reference.html#ToC13 - ) - logger.info('Serving HTTPS on %s port %s...' % httpServer.socket.getsockname()) - try: - httpServer.serve_forever() - except KeyboardInterrupt: - pass - -if __name__ == '__main__': - main() |
