def get_service_public_keys(self, service_id):
        """
        Retrieves a list of Public Keys belonging to a Service
        :param service_id: Unique Service ID
        :raise: launchkey.exceptions.InvalidParameters - Input parameters were
        not correct
        :raise: launchkey.exceptions.ServiceNotFound - No Service could be
        found matching the input ID
        :raise: launchkey.exceptions.Forbidden - The Service you requested
        either does not exist or you do not have sufficient permissions.
        :return: List - launchkey.entities.shared.PublicKey
        """
        response = self._transport.post("{}/keys/list".format(
            self.__service_base_path[0:-1]),
                                        self._subject,
                                        service_id=str(service_id))

        public_keys = []

        for key in response.data:
            key_data = self._validate_response(key, PublicKeyValidator)
            public_key = PublicKey(key_data)
            public_keys.append(public_key)

        return public_keys
def add_another_public_key_to_organization_service(context):
    current_service = context.entity_manager.get_current_organization_service()
    public_key = PublicKey({
        "id": context.keys_manager.beta_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": None,
        "public_key": context.keys_manager.beta_public_key
    })
    context.organization_service_manager.add_public_key_to_service(
        public_key, current_service.id)
Exemple #3
0
def add_another_public_key_to_directory(context):
    current_directory = context.entity_manager.get_current_directory()
    public_key = PublicKey({
        "id": context.keys_manager.beta_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": None,
        "public_key": context.keys_manager.beta_public_key
    })
    context.directory_manager.add_public_key_to_directory(
        public_key, current_directory.id)
Exemple #4
0
def add_public_key_to_directory_service(context):
    current_service = context.entity_manager.get_current_directory_service()
    current_directory = context.entity_manager.get_current_directory()
    public_key = PublicKey({
        "id": context.keys_manager.alpha_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": None,
        "public_key": context.keys_manager.alpha_public_key
    })
    context.directory_service_manager.add_public_key_to_service(
        current_directory.id, public_key, current_service.id)
 def get_directory_public_keys(self, directory_id):
     """
     Retrieves a list of Public Keys belonging to a Directory
     :param directory_id: Unique Directory ID
     :raise: launchkey.exceptions.InvalidParameters - Input parameters were not correct
     :raise: launchkey.exceptions.Forbidden - The Directory you requested either does not exist or you do not have
                                              sufficient permissions.
     :return: List - launchkey.entities.shared.PublicKey
     """
     return [PublicKey(self._validate_response(key, PublicKeyValidator)) for key in
             self._transport.post("/organization/v3/directory/keys/list", self._subject,
                                  directory_id=str(directory_id)).data]
 def get_service_public_keys(self, service_id):
     """
     Retrieves a list of Public Keys belonging to a Service
     :param service_id: Unique Service ID
     :raise: launchkey.exceptions.InvalidParameters - Input parameters were not correct
     :raise: launchkey.exceptions.ServiceNotFound - No Service could be found matching the input ID
     :raise: launchkey.exceptions.Forbidden - The Service you requested either does not exist or you do not have
                                              sufficient permissions.
     :return: List - launchkey.entities.shared.PublicKey
     """
     return [PublicKey(self._validate_response(key, PublicKeyValidator)) for key in
             self._transport.post("/organization/v3/service/keys/list", self._subject,
                                  service_id=str(service_id)).data]
def attempt_to_add_public_key_to_organization_service(context, service_id):
    public_key = PublicKey({
        "id": context.keys_manager.alpha_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": None,
        "public_key": context.keys_manager.alpha_public_key
    })
    try:
        context.organization_service_manager.add_public_key_to_service(
            public_key, service_id)
    except Exception as e:
        context.current_exception = e
Exemple #8
0
def attempt_to_add_public_key_to_directory_service(context, service_id):
    current_directory = context.entity_manager.get_current_directory()
    public_key = PublicKey({
        "id": context.keys_manager.alpha_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": None,
        "public_key": context.keys_manager.alpha_public_key
    })
    try:
        context.directory_service_manager.add_public_key_to_service(
            current_directory.id, public_key, service_id)
    except Exception as e:
        context.current_exception = e
def add_public_key_to_organization_with_expiration_time_and_inactive(
        context, expiration_timestamp):
    current_service = context.entity_manager.get_current_organization_service()

    public_key = PublicKey({
        "id": context.keys_manager.beta_md5_fingerprint,
        "active": False,
        "date_created": None,
        "date_expires": parse(expiration_timestamp),
        "public_key": context.keys_manager.alpha_public_key
    })

    context.organization_service_manager.add_public_key_to_service(
        public_key, current_service.id)
Exemple #10
0
def add_public_key_to_directory_with_expiration_time_and_active(
        context, expiration_timestamp):
    current_service = context.entity_manager.get_current_directory_service()
    current_directory = context.entity_manager.get_current_directory()

    public_key = PublicKey({
        "id": context.keys_manager.beta_md5_fingerprint,
        "active": True,
        "date_created": None,
        "date_expires": parse(expiration_timestamp),
        "public_key": context.keys_manager.alpha_public_key
    })

    context.directory_service_manager.add_public_key_to_service(
        current_directory.id, public_key, current_service.id)