Exemplo n.º 1
0
    def loadConfig(self, config, conf):
        """ loadConfig(configDict)
            The UserIdResolver could be configured
            from the pylon app config - here
            this could be the passwd file ,
            whether it is /etc/passwd or /etc/shadow
        """

        l_config, missing = self.filter_config(config, conf)

        if missing:
            log.error("missing config entries: %r", missing)
            raise ResolverLoadConfigError(" missing config entries:"
                                          " %r" % missing)

        fileName = l_config["fileName"]

        # support for relative file names

        if "%(here)s" in fileName and "linotp.root" in l_config:
            fileName = fileName.replace("%(here)s", l_config["linotp.root"])

        fileName = os.path.realpath(fileName)

        if (not os.path.isfile(fileName) or not os.access(fileName, os.R_OK)):
            raise ResolverLoadConfigError('File %r does not exist or is not '
                                          'accesible' % fileName)
        self.fileName = fileName
        self.loadFile()

        return self
Exemplo n.º 2
0
    def loadConfig(self, config, conf):
        """ loadConfig(configDict)
            The UserIdResolver could be configured
            from the pylon app config - here
            this could be the passwd file ,
            whether it is /etc/passwd or /etc/shadow
        """
        fileName = self.getConfigEntry(config,
                                        'linotp.passwdresolver.fileName', conf)

        fileName = os.path.realpath(fileName)

        if (not os.path.isfile(fileName) or not os.access(fileName, os.R_OK)):
            raise ResolverLoadConfigError('File %r does not exist or is not '
                                          'accesible' % fileName)
        self.fileName = fileName
        self.loadFile()

        return self