示例#1
0
def create_linked_authentication_service(role, service_type, unique_service_id,
                                         configuration):
    linked_service_controller = LinkedServiceController(role)
    linked_service_wrapper = linked_service_controller.create_linked_service(
        service_type, unique_service_id, configuration,
        AuthenticationServiceBase.RoleWrapperByEntityType(service_type))
    return linked_service_wrapper
示例#2
0
def create_linked_authentication_service(role, service_type, unique_service_id, configuration):
    linked_service_controller = LinkedServiceController(role)
    linked_service_wrapper = linked_service_controller.create_linked_service(
        service_type,
        unique_service_id,
        configuration,
        AuthenticationServiceBase.RoleWrapperByEntityType(service_type))
    return linked_service_wrapper
示例#3
0
def select_authentication_services_for_role(role):
    """
    Selects all the linked authentication services for a given role

    :param role: An instance of RoleBase of one of its subclasses
    :return: Collection of subclasses of LinkedServiceBase
    """
    linked_service_controller = LinkedServiceController(role)
    return [
        AuthenticationServiceBase.RoleWrapperByEntityType(linked_service.service_type)(linked_service)
        for linked_service in linked_service_controller.linked_services(
            type_filtes=AuthenticationServiceBase.AUTHENTICATION_SERVICE_TYPES)]
示例#4
0
def select_authentication_services_for_role(role):
    """
    Selects all the linked authentication services for a given role

    :param role: An instance of RoleBase of one of its subclasses
    :return: Collection of subclasses of LinkedServiceBase
    """
    linked_service_controller = LinkedServiceController(role)
    return [
        AuthenticationServiceBase.RoleWrapperByEntityType(
            linked_service.service_type)(linked_service)
        for linked_service in linked_service_controller.linked_services(
            type_filtes=AuthenticationServiceBase.AUTHENTICATION_SERVICE_TYPES)
    ]
示例#5
0
def get_authentication_wrapper(role, service_type, unique_service_id):
    if service_type != LinkedServiceController.SERVICE_AMAZON:
        raise NotImplementedError(
            "the service type %s is not yet supported by this method" %
            service_type)
    return LinkedServiceController.LinkedServiceByTypeAndID(
        service_type, unique_service_id,
        AuthenticationServiceBase.RoleWrapperByEntityType(service_type))
示例#6
0
def select_role_by_authentication_service(service_type, unique_service_id):
    service_wrapper = LinkedServiceController.LinkedServiceByTypeAndID(
        service_type, unique_service_id,
        AuthenticationServiceBase.RoleWrapperByEntityType(service_type))
    if not service_wrapper:
        return None
    return RoleController.GetRoleForEntityTypeAndID(
        service_wrapper.linked_service.role_type,
        service_wrapper.linked_service.role_id,
        RoleBase.RoleWrapperByEntityType(
            service_wrapper.linked_service.role_type))