ServerObject.py :  » Network » Luma » luma-2.4 » lib » luma » base » backend » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Network » Luma 
Luma » luma 2.4 » lib » luma » base » backend » ServerObject.py
# -*- coding: utf-8 -*-

###########################################################################
#    Copyright (C) 2003 by Wido Depping                                      
#    <widod@users.sourceforge.net>                                                             
#
# Copyright: See COPYING file that comes with this distribution
#
###########################################################################

class ServerObject(object):
    """This class represents a server with all its information.
    
    self.name: The user-visible name of the server (string).
    
    self.host: The hostname of the server (string).
    
    self.port: The port of the server (integer).
    
    self.bindAnon: Indicates if the bind should be anonymously (integer).
    
    self.baseDN: The baseDNs of the server (list of strings).
    
    self.bindDN: If not bind anonymously, use this name (string).
    
    self.bindPassword: The password for the bindDN (string).
    
    self.encryptionMethod: None, TLS or SSL

    self.useCertificate: Indicates, if we should use clientside certificates

    self.clientCertFile: The Client certificate. PEM-file (string)

    self.clientCertKeyfile: The Client certificate private key. PEM-file (string)
    
    self.checkServerCertificate: Checks the validity of the server side certificate.
                Options are never, allow, try, demand.
    
    
    """
    
    authentificationMethods = [u"Simple", u"SASL Plain", u"SASL CRAM-MD5", 
        u"SASL DIGEST-MD5", u"SASL Login", u"SASL GSSAPI"]

###############################################################################

    def __init__(self):
        self.name = u""
        self.host = u""
        self.port = 389
        self.bindAnon = True
        self.autoBase = True
        self.baseDN = []
        self.bindDN = u""
        self.bindPassword = u""
        self.encryptionMethod = u"None"
        self.authMethod = u"Simple"
        self.followAliases = False
        self.useCertificate = False
        self.clientCertFile = u""
        self.clientCertKeyfile = u""
        self.checkServerCertificate = u"demand"
        
        # This value will only set during runtime
        self.currentBase = u""
        
###############################################################################

    def __repr__(self):
        finalString = []

        finalString.append(unicode("Name: "))
        finalString.append(unicode(self.name))
        finalString.append(unicode("\nHost: "))
        finalString.append(unicode(self.host))
        finalString.append(unicode("\nPort: "))
        finalString.append(unicode(self.port))
        finalString.append(unicode("\nBind anonymously: "))
        finalString.append(unicode(self.bindAnon))
        finalString.append(unicode("\nBase DN: "))
        map(lambda x: finalString.append(unicode(x) + u", "), self.baseDN)
        finalString.append(unicode("\nCurrent Base: "))
        finalString.append(unicode(self.currentBase))
        finalString.append(unicode("\nBind DN: "))
        finalString.append(unicode(self.bindDN))
        finalString.append(unicode("\nBind Password: "))
        finalString.append(unicode(self.bindPassword))
        finalString.append(unicode("\nEncryption method: "))
        finalString.append(unicode(self.encryptionMethod))
        finalString.append(unicode("\nAuthentification method: "))
        finalString.append(unicode(self.authMethod))
        finalString.append(unicode("\nUse Client certificate: "))
        finalString.append(unicode(self.useCertificate))
        finalString.append(unicode("\nClient certificate file: "))
        finalString.append(unicode(self.clientCertFile))
        finalString.append(unicode("\nClient certificate keyfile: "))
        finalString.append(unicode(self.clientCertKeyfile))
        finalString.append(unicode("\nCheck server certificate: "))
        finalString.append(unicode(self.checkServerCertificate))
        finalString.append(unicode("\n"))

        return "".join(finalString)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.