当前位置: 首页>>代码示例>>Python>>正文


Python Authentication类代码示例

本文整理汇总了Python中Authentication的典型用法代码示例。如果您正苦于以下问题:Python Authentication类的具体用法?Python Authentication怎么用?Python Authentication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Authentication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

class InstancePreReq:

    def __init__(self):

        self.aObj = Authentication("yess");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone= self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        self.cclient = self.aObj.getCeilometerClient();

    def getAllFlavours(self):

        obj= self.nova.flavors.list();
        flvrs=[];

        for each in obj:
            flvrs.append(each.name);

        return flvrs;

    def getAllImages(self):

        obj= self.nova.images.list();
        imgz=[];

        for each in obj:
            imgz.append(each.name);

        return imgz;

    def getAllNetworks(self):

        obj= self.nova.networks.list();
        netwrk=[];

        for each in obj:
            netwrk.append(each.label);

        return netwrk;

    def getKeypairsList(self):

        obj= self.nova.keypairs.list();
        keyz=[];

        for each in obj:
            keyz.append(each.name);

        return keyz;

    def getSecurityList(self):

        obj= self.nova.security_groups.list();
        scrty=[];

        for each in obj:
            scrty.append(each.name);

        return scrty;
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:60,代码来源:InstancePreReq.py

示例2: __init__

class createKey:

    def __init__(self):

        self.aObj = Authentication("msssg");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone = self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        self.cclient = self.aObj.getCeilometerClient();

    def createKeyPlease(self):

        keypair_name = "maKey";
        self.nova.keypairs.list();
        ts = time.time();
        st = datetime.datetime.fromtimestamp(ts).strftime('%Y%m%d%H%M%S');
        stri = keypair_name+st;
        print stri;
        self.nova.keypairs.create(name=stri)

    def getKeypairsList(self):

        obj = self.nova.keypairs.list();
        keyz = [];
        for each in obj:
            keyz.append(each.name);
        return keyz;


# obj = createKey();
# obj.createKeyPlease();
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:32,代码来源:createKey.py

示例3: saveFile

def saveFile(ID, CADFile, filedesc):
    try:
        Authentication.authUpload(ID, CADFile, filedesc)
    except Exception as e:
        logging.error("Unable to save file: %s" % e)
        return False
    return True
开发者ID:Grendus,项目名称:PCBOSS-Server,代码行数:7,代码来源:WebEventHandler.py

示例4: __init__

class BillGeneratePreReq:

    def __init__(self):

        self.aObj = Authentication("yess");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone= self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        self.cclient = self.aObj.getCeilometerClient();
        self.dbObj = MongoDatabase();

    def getAllBillsCategories(self):

    	checki = self.dbObj.getAllBillCat();
    	if(checki==False):
    		return False
    	else:
    		return checki;

    def getAllRunningInstances(self):

    	servers = self.nova.servers.list();
    	return servers;

# obj = BillGeneratePreReq();
# obj.getAllBillsCategories();
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:27,代码来源:BillGeneratePreReq.py

示例5: changePassword

 def changePassword(self, sid, safeOld, safeNew):
     session = self.sessions[sid]
     if not session:
         raise SecurityException('No such session id.')
     challenge = session.challenge
     account = self.accounts[session.login]
     oldPassword = Authentication.unwrapUserPassword(safeOld, challenge)
     newPassword = Authentication.unwrapUserPassword(safeNew, challenge)
     if not account.verifyPassword(oldPassword):
         raise SecurityException('Wrong login and/or password.')
     if len(newPassword) < ige.Const.ACCOUNT_PASSWD_MIN_LEN:
         raise SecurityException('Password is too short.')
     account.setPassword(newPassword)
     log.debug('Password of account {0} successfully changed.'.format(session.login))
     return None, None
开发者ID:ospaceteam,项目名称:outerspace,代码行数:15,代码来源:ClientMngr.py

示例6: createAccount

 def createAccount(self, sid, login, safePasswd, nick, email):
     log.message('Creating account', login, nick, email)
     session = self.getSession(sid)
     plainPassword = Authentication.unwrapUserPassword(safePasswd, session.challenge)
     login = login.strip()
     plainPassword = plainPassword.strip()
     nick = nick.strip()
     # check requirement
     if len(login) < ige.Const.ACCOUNT_LOGIN_MIN_LEN:
         raise SecurityException('Login is too short.')
     if len(plainPassword) < ige.Const.ACCOUNT_PASSWD_MIN_LEN:
         raise SecurityException('Password is too short.')
     if len(nick) < ige.Const.ACCOUNT_NICK_MIN_LEN:
         raise SecurityException('Nick is too short.')
     # check login, nick and uid
     for key in self.accounts.keys():
         account = self.accounts[key]
         if account.login == login:
             raise SecurityException('Login already used.')
         elif account.nick == nick:
             raise SecurityException('Nick already used.')
         elif account.email == email:
             raise SecurityException('E-mail already used.')
     # create account
     account = Account(login, nick, email, plainPassword)
     # update
     self.accounts.create(account, id = str(account.login))
     log.message('Account created, confirmation token:', account.confToken)
     # TODO send confirmation token to the email address
     return 1, None
开发者ID:ospaceteam,项目名称:outerspace,代码行数:30,代码来源:ClientMngr.py

示例7: __init__

 def __init__(self, database, authMethod, configDir):
     self.configDir = configDir
     self.authMethod = authMethod
     if not self.authMethod:
         self.authMethod = Authentication.defaultMethod
     if ige.igeRuntimeMode == 1:
         Authentication.init(self.authMethod, 2048)
     elif ige.igeRuntimeMode == 0:
         # it is minimum to cater for AI generated passwords
         Authentication.init(self.authMethod, 512)
     self._filename = os.path.join(self.configDir, 'accounts')
     self.sessions = {}
     #
     self.accounts = database
     self._initAdminAccount()
     self.generateAIList()
开发者ID:ospaceteam,项目名称:outerspace,代码行数:16,代码来源:ClientMngr.py

示例8: __init__

    def __init__(self):

        self.aObj = Authentication("yess");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone = self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        self.cclient = self.aObj.getCeilometerClient();
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:8,代码来源:makeBillPreReq.py

示例9: __init__

    def __init__(self,arguments):

        self.aObj = Authentication("yess");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone= self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        # self.cclient = self.aObj.getCeilometerClient();
        self.args=arguments;

        for each in arguments:
            print "--->",each
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:12,代码来源:instanceCreate.py

示例10: __init__

	def __init__(self,billName,flvr,price):

		self.aObj = Authentication("yess");
		self.nova = self.aObj.getComputeClient();
		self.neutron = self.aObj.getNeutronClient();
		self.keystone= self.aObj.getKeystoneClient();
		self.glance = self.aObj.getGlanceClient();
		self.cclient = self.aObj.getCeilometerClient();
		self.price=price;
		self.billName=billName;
		self.flvrNames=flvr;
		self.dbObj = MongoDatabase();
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:12,代码来源:createBillCategory.py

示例11: __init__

class RouterPreReq:

    def __init__(self):

        self.aObj = Authentication("yess");
        self.nova = self.aObj.getComputeClient();
        self.neutron = self.aObj.getNeutronClient();
        self.keystone= self.aObj.getKeystoneClient();
        self.glance = self.aObj.getGlanceClient();
        self.cclient = self.aObj.getCeilometerClient();

    def getAllSubnets(self):
        subnets = self.neutron.list_subnets();
        subList=[];

        for each in subnets['subnets']:
            subList.append(each['name']);

        return subList;

    def getAllTenants(self):
        
        tenants = self.keystone.tenants.list();

        tenNames=[];
        
        for each in tenants:
            tenNames.append(each.name);

        return tenNames;

    def getAllNetworks(self):

        obj= self.nova.networks.list();
        netwrk=[];

        for each in obj:
            netwrk.append(each.label);

        return netwrk;
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:40,代码来源:RouterPreReq.py

示例12: hello

 def hello(self, sid, clientId):
     log.debug(clientId, 'connected. User', repr(clientId))
     # create sort of cookie
     while 1:
         sid = hashlib.sha256(str(random.random())).hexdigest()
         if not self.sessions.has_key(sid):
             break
     challenge = Authentication.getWelcomeString(self.authMethod)
     session = Session(sid)
     session.challenge = challenge
     session.clientIdent = clientId
     self.sessions[sid] = session
     return (sid, challenge), None
开发者ID:ospaceteam,项目名称:outerspace,代码行数:13,代码来源:ClientMngr.py

示例13: __init__

class InstanceBill:

	def __init__(self,instnc,catg):

		self.aObj = Authentication("yess");
		self.nova = self.aObj.getComputeClient();
		self.neutron = self.aObj.getNeutronClient();
		self.keystone= self.aObj.getKeystoneClient();
		self.glance = self.aObj.getGlanceClient();
		self.cclient = self.aObj.getCeilometerClient();
		self.inst = instnc;
		slef.catg = catg;

	def getInstanceID(self):

		instanceList = nova.servers.list(search_opts={'all_tenants': 1});

		for i in range(0,len(instanceList),1):
			if(instanceList[i].name==self.inst):
		    	return instncID = instanceList[i].id;

	def getTopSamples(self):

		
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:22,代码来源:InstanceBill.py

示例14: login

 def login(self, sid, login, cpasswd, hostID):
     login = login.strip()
     if not login:
         raise SecurityException("Specify login, please.")
     if login in ():
         raise SecurityException("Account blocked")
     log.debug(sid, 'login', repr(login), 'hostid', hostID)
     login = str(login)
     challenge = self.sessions[sid].challenge
     account = None
     # use metaserver login if metaserver is defined
     if self.metaserver:
         result = self.metaserver.verifyPassword(login, Authentication.processUserPassword(cpasswd, challenge))
         if result:
             account = Account()
             account.login = login
             account.nick = result["nick"]
             account.email = result["email"]
             log.debug("User", login, "has valid metaserver account")
         #else:
         #    raise SecurityException("Wrong login and/or password.")
     # local login
     # TBD: option to disable local login completely
     if not account:
         log.debug("Trying local login for user", login)
         if not self.accounts.has_key(login):
             raise SecurityException('Wrong login and/or password.')
         account = self.accounts[login]
         if not Authentication.verify(cpasswd, account.passwd, challenge):
             raise SecurityException('Wrong login and/or password.')
     # setup session
     self.sessions[sid].setAttrs(account.login, account.nick, account.email)
     account.lastLogin = time.time()
     account.addHostID(hostID)
     self.tokens[sid] = hashlib.md5(str(random.random())).hexdigest()
     return 1, None
开发者ID:,项目名称:,代码行数:36,代码来源:

示例15: __init__

	def __init__(self,cat,instName):

		inst = str(instName);
		cat = str(cat);
		print 'INST ->', inst;
		print 'CATG ->', cat;
		
		self.aObj = Authentication("yess");
		self.nova = self.aObj.getComputeClient();
		self.neutron = self.aObj.getNeutronClient();
		self.keystone= self.aObj.getKeystoneClient();
		self.glance = self.aObj.getGlanceClient();
		self.cclient = self.aObj.getCeilometerClient();

		self.dbObj = MongoDatabase();
		self.cat = cat;
		self.instName = inst;
开发者ID:zaibi099,项目名称:InspectorCloud,代码行数:17,代码来源:GenerateBill.py


注:本文中的Authentication类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。