Esempio n. 1
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :param validate: inform program to validate or not the license info
    :return: tuple of dict with the license information and signature
             in case of an error, the dict and the signature are empty
    """
    refreshConfig()
    lic_dict = LicenseInfo()
    lic_sign = ""

    try:
        licString = getFromConfig("license", '')

        if licString:

            lic_text = binascii.unhexlify(licString.encode('utf-8')).decode()
            lic_dict, lic_sign = parseSupportLicense(lic_text)
            lic_dict['expire'] = get_expiration_date(lic_dict)

    except InvalidLicenseException as exx:
        log.info('Invalid license error: %r' % exx)

    return lic_dict, lic_sign
Esempio n. 2
0
def test_lar_case_sensitive_resolver_names(app):

    admin_realm_name = app.config["ADMIN_REALM_NAME"]
    admin_resolvers_key = f"useridresolver.group.{admin_realm_name}"
    admin_resolvers = getFromConfig(admin_resolvers_key, "")

    lar = LocalAdminResolver(app)

    # Replace the local admin resolver name in the realm with a
    # name that is the same but in uppercase. If we then try to
    # re-add the original local admin resolver using the officially
    # approved `.add_to_admin_realm()` method, it should show
    # up if names are compared case-sensitively.

    prefix, _, name = admin_resolvers.rpartition(".")
    new_name = f"{prefix}.{name.upper()}"
    set_config(
        key=admin_resolvers_key,
        value=new_name,
        typ="text",
        description="None",
        update=True,
    )
    db.session.commit()

    refreshConfig()  # force config reload
    lar.add_to_admin_realm()

    refreshConfig()  # force config reload
    new_admin_resolvers = getFromConfig(admin_resolvers_key, "")
    assert (
        new_admin_resolvers == admin_resolvers + "," +
        new_name), "local admin resolver name comparison is not case-sensitive"
Esempio n. 3
0
 def setup_class(cls):
     '''setup - create clean execution context by resetting database '''
     LOG.info("######## setup_class: %r" % cls)
     SetupCommand('setup-app').run([config['__file__']])
     from linotp.lib.config import refreshConfig
     refreshConfig()
     return
Esempio n. 4
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :return: dict with the license informstion
    """
    info = {}

    refreshConfig()
    licString = getFromConfig("license", None)
    if licString:
        try:
            lic_str = binascii.unhexlify(licString)
        except TypeError:
            lic_str = licString
        (info, _lic_sign, _lic_txt) = parseSupportLicense(lic_str)

    else:
        # if we have no licens in the config, we compose the
        # comuninity edition text
        info.update(support_info)
        version = get_version_number()
        info['version'] = 'LinOTP %s' % version

    return info
Esempio n. 5
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :return: dict with the license informstion
    """
    info = {}

    refreshConfig()
    licString = getFromConfig("license", None)
    if licString:
        try:
            lic_str = binascii.unhexlify(licString)
        except TypeError:
            lic_str = licString
        (info, _lic_sign, _lic_txt) = parseSupportLicense(lic_str)

    else:
        # if we have no licens in the config, we compose the
        # comuninity edition text
        info.update(support_info)
        version = get_version_number()
        info["version"] = "LinOTP %s" % version

    return info
Esempio n. 6
0
 def setup_class(cls):
     '''setup - create clean execution context by resetting database '''
     LOG.info("######## setup_class: %r" % cls)
     SetupCommand('setup-app').run([config['__file__']])
     from linotp.lib.config import refreshConfig
     refreshConfig()
     return
Esempio n. 7
0
    def setup_class(cls):
        """setup - create clean execution context by resetting database """
        LOG.info("######## setup_class: %r" % cls)
        SetupCommand("setup-app").run([config["__file__"]])
        from linotp.lib.config import refreshConfig

        refreshConfig()

        # provide the info of environment we are running in
        cls.env["pylons"] = LooseVersion(pkg_resources.get_distribution("pylons").version)
        return
Esempio n. 8
0
    def setup_class(cls):
        '''setup - create clean execution context by resetting database '''
        LOG.info("######## setup_class: %r" % cls)
        SetupCommand('setup-app').run([config['__file__']])
        from linotp.lib.config import refreshConfig
        refreshConfig()

        # provide the info of environment we are running in
        cls.env['pylons'] = LooseVersion(
            pkg_resources.get_distribution('pylons').version)
        TestController.run_state = 0
        return
Esempio n. 9
0
    def setup_class(cls):
        '''setup - create clean execution context by resetting database '''
        LOG.info("######## setup_class: %r" % cls)
        SetupCommand('setup-app').run([config['__file__']])
        from linotp.lib.config import refreshConfig
        refreshConfig()

        # provide the info of environment we are running in
        cls.env['pylons'] = LooseVersion(
            pkg_resources.get_distribution('pylons').version
        )
        TestController.run_state = 0
        return
Esempio n. 10
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :return: dict with the license informstion
    """
    info = {}

    refreshConfig()
    licString = getFromConfig("license", None)
    if licString:
        try:
            lic_str = binascii.unhexlify(licString)
        except TypeError:
            lic_str = licString
        (info, _lic_sign, _lic_txt) = parseSupportLicense(lic_str)

    return info
Esempio n. 11
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :return: dict with the license informstion
    """
    info = {}

    refreshConfig()
    licString = getFromConfig("license", None)
    if licString:
        try:
            lic_str = binascii.unhexlify(licString)
        except TypeError:
            lic_str = licString
        (info, _lic_sign, _lic_txt) = parseSupportLicense(lic_str)

    return info
Esempio n. 12
0
def getSupportLicenseInfo():
    """
    get the current support and subscription information

    :return: tuple of dict with the license information and signature
             in case of an error, the dict and the signature are empty
    """
    refreshConfig()
    lic_dict = LicenseInfo()
    lic_sign = ""

    try:
        licString = getFromConfig("license", '')
        if licString:
            licBin = binascii.unhexlify(licString)
            lic_dict, lic_sign = parseSupportLicense(licBin)
    except InvalidLicenseException as exx:
        log.info('invalid license error %r' % exx)

    return lic_dict, lic_sign