コード例 #1
0
    def get_credential(self, cm_user_id, cloud):
        # DEBUG
        try:
            _args = locals()
            if 'self' in _args:
                del (_args['self'])
            log.debug("[{0}()] called with [{1}]".format(
                sys._getframe().f_code.co_name, str(_args)))
        except:
            pass

        try:
            password = cm_config_server().get(
                "cloudmesh.server.mongo.collections.password.key")
            safe_credential = (self.userdb_passwd.find_one({
                "cm_user_id": cm_user_id,
                "cloud": cloud
            }))["credential"]

            # print "SK", safe_credential

            for cred in safe_credential:
                t = safe_credential[cred]
                n = decrypt(t, password)
                safe_credential[cred] = n

            return safe_credential
        except:
            print(traceback.format_exc())
            return None
コード例 #2
0
ファイル: cm_mongo.py プロジェクト: lee212/cloudmesh
    def get_credential(self, cm_user_id, cloud):
        # DEBUG
        try:
            _args = locals()
            if 'self' in _args:
                del (_args['self'])
            log.debug("[{0}()] called with [{1}]".format(sys._getframe().f_code.co_name,
                                                         str(_args)))
        except:
            pass

        try:
            password = cm_config_server().get(
                "cloudmesh.server.mongo.collections.password.key")
            safe_credential = (self.userdb_passwd.find_one(
                {"cm_user_id": cm_user_id, "cloud": cloud}))["credential"]

            # print "SK", safe_credential

            for cred in safe_credential:
                t = safe_credential[cred]
                n = decrypt(t, password)
                safe_credential[cred] = n

            return safe_credential
        except:
            print(traceback.format_exc())
            return None
コード例 #3
0
ファイル: cm_user.py プロジェクト: rowlandifeanyi17/cloudmesh
    def get_credential(self, username, cloud):
        try:
            safe_credential = self.userdb_passwd.find_one({"cm_user_id": username, "cloud":cloud})["credential"]

            for cred in safe_credential:
                t = safe_credential[cred]

                n = decrypt(t, self.password_key)

                safe_credential[cred] = n


            return safe_credential
        except:
            return None
コード例 #4
0
ファイル: cm_user.py プロジェクト: rahulsinghania/cloudmesh
    def get_credential(self, username, cloud, cred_type='cloud'):
        if cred_type in ('cloud', 'cm_password_local'):
            try:
                safe_credential = self.userdb_passwd.find_one(
                    {"cm_user_id": username, "%s" % cred_type: cloud})["credential"]

                for cred in safe_credential:
                    t = safe_credential[cred]

                    n = decrypt(t, self.password_key)

                    safe_credential[cred] = n

                return safe_credential
            except:
                return None
コード例 #5
0
    def get_credential(self, cm_user_id, cloud):
        try:
            password = cm_config_server().get("cloudmesh.server.mongo.collections.password.key")
            safe_credential = (self.userdb_passwd.find_one({"cm_user_id": cm_user_id, "cloud":cloud}))["credential"]


            # print "SK", safe_credential

            for cred in safe_credential:
                t = safe_credential[cred]
                n = decrypt(t, password)
                safe_credential[cred] = n

            return safe_credential
        except:
            print traceback.format_exc()
            return None
コード例 #6
0
ファイル: cm_user.py プロジェクト: mnozary/cloudmesh
    def get_credential(self, username, cloud, cred_type='cloud'):
        if cred_type in ('cloud', 'cm_password_local'):
            try:
                safe_credential = self.userdb_passwd.find_one({
                    "cm_user_id":
                    username,
                    "%s" % cred_type:
                    cloud
                })["credential"]

                for cred in safe_credential:
                    t = safe_credential[cred]

                    n = decrypt(t, self.password_key)

                    safe_credential[cred] = n

                return safe_credential
            except:
                return None