Example #1
0
    def __init__(self, filepath_string):

        # split into one or more file paths
        filepaths = filepath_string.replace(' ', '').split(",")

        # internal fields
        self.filepaths = filepaths
        self.modtimes = {}  # keyed by file path
        self.idps = {}  # keyed by file spath

        # loop over whitelist files
        for filepath in self.filepaths:

            # prevent file path manipulation
            check_filepath(
                filepath,
                [IDP_WHITELIST_FILENAME, IDP_WHITELIST_STATIC_FILENAME])

            # record last modification time
            self.modtimes[filepath] = file_modification_datetime(filepath)

            # load this white list for the first time
            try:
                self._reload(filepath, force=True)
            except ParseError as e:
                print e  # print error from parsing single white-list files and continue
Example #2
0
    def __init__(self):

        # internal dictionary of known identity providers (empty by default)
        self.idps = {}  # (IdP name, IdP url)
        self.init = False

        try:

            # store filepath and its last access time
            self.filepath = str(settings.KNOWN_PROVIDERS)

            if os.path.exists(self.filepath):

                # prevent file path manipulation
                check_filepath(self.filepath, [KNOWN_PROVIDERS_FILENAME])

                self.init = True  # file of known providers is found
                self.modtime = file_modification_datetime(self.filepath)

                # load dictionary at startup
                self._reload(force=True)

        except AttributeError:
            # no entry in $COG_CONFIG_DIR/cog_settings.cfg
            pass
Example #3
0
 def __init__(self):
     
     # internal dictionary of known identity providers (empty by default)
     self.idps = {} # (IdP name, IdP url)
     self.init = False
     
     try:
         
         # store filepath and its last access time
         self.filepath = str(settings.KNOWN_PROVIDERS)
                     
         if os.path.exists(self.filepath):
             
             # prevent file path manipulation
             check_filepath(self.filepath, [KNOWN_PROVIDERS_FILENAME])
             
             self.init = True # file of known providers is found
             self.modtime = file_modification_datetime(self.filepath)
             
             # load dictionary at startup
             self._reload(force=True)
         
     except AttributeError:
         # no entry in $COG_CONFIG_DIR/cog_settings.cfg
         pass
Example #4
0
 def __init__(self, filepath):
     
     self.filepath = None
     self.endpoints = {}
     self.init = False
     
     try:
         if os.path.exists(filepath):
             self.filepath = filepath
             self.modtime = file_modification_datetime(self.filepath)
             self._reload(force=True)
             self.init = True
             
             # prevent file path manipulation
             check_filepath(self.filepath, [ENDPOINTS_FILENAME])
         
     except IOError:
         pass
Example #5
0
    def __init__(self, filepath_string):
        
        # split into one or more file paths
        filepaths = filepath_string.replace(' ','').split(",")

        # internal fields
        self.filepaths = filepaths
        self.modtimes = {}  # keyed by file path
        self.idps = {}      # keyed by file spath
        
        # loop over whitelist files
        for filepath in self.filepaths:
            
            # prevent file path manipulation
            check_filepath(filepath, [IDP_WHITELIST_FILENAME, IDP_WHITELIST_STATIC_FILENAME])
            
            # record last modification time
            self.modtimes[filepath] = file_modification_datetime(filepath)

            # load this white list for the first time
            try:
                self._reload(filepath, force=True)
            except ParseError as e:
                print e # print error from parsing single white-list files and continue
Example #6
0
    def __init__(self, filepath):

        self.filepath = filepath

        # prevent file path manipulation
        check_filepath(self.filepath, [PEER_NODES_FILENAME])
Example #7
0
 def __init__(self, filepath):
     
     self.filepath = filepath
     
     # prevent file path manipulation
     check_filepath(self.filepath, [PEER_NODES_FILENAME])