Example #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
Example #2
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
Example #3
0
    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
Example #4
0
    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
Example #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
Example #6
0
    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