Exemple #1
0
    def _configure_account(self, **kwargs):

        try:
            env_file = kwargs['irods_env_file']

        except KeyError:
            # For backward compatibility
            for key in ['host', 'port', 'authentication_scheme']:
                if key in kwargs:
                    kwargs['irods_{}'.format(key)] = kwargs.pop(key)

            for key in ['user', 'zone']:
                if key in kwargs:
                    kwargs['irods_{}_name'.format(key)] = kwargs.pop(key)

            return iRODSAccount(**kwargs)

        # Get credentials from irods environment file
        creds = self.get_irods_env(env_file, session_=self)

        # Update with new keywords arguments only
        creds.update(
            (key, value) for key, value in kwargs.items() if key not in creds)

        # Get auth scheme
        try:
            auth_scheme = creds['irods_authentication_scheme']
        except KeyError:
            # default
            auth_scheme = 'native'

        if auth_scheme.lower() == PAM_AUTH_SCHEME:
            if 'password' in creds:
                return iRODSAccount(**creds)
            else:
                # password will be from irodsA file therefore use native login
                creds['irods_authentication_scheme'] = NATIVE_AUTH_SCHEME
        elif auth_scheme != 'native':
            return iRODSAccount(**creds)

        # Native auth, try to unscramble password
        try:
            creds['irods_authentication_uid'] = kwargs[
                'irods_authentication_uid']
        except KeyError:
            pass

        missing_file_path = []
        error_args = []
        pw = creds['password'] = self.get_irods_password(
            session_=self, file_path_if_not_found=missing_file_path, **creds)
        if not pw and creds.get('irods_user_name') != 'anonymous':
            if missing_file_path:
                error_args += [
                    "Authentication file not found at {!r}".format(
                        missing_file_path[0])
                ]
            raise NonAnonymousLoginWithoutPassword(*error_args)

        return iRODSAccount(**creds)
Exemple #2
0
    def _configure_account(self, **kwargs):

        try:
            env_file = kwargs['irods_env_file']

        except KeyError:
            # For backward compatibility
            for key in ['host', 'port', 'authentication_scheme']:
                if key in kwargs:
                    kwargs['irods_{}'.format(key)] = kwargs.pop(key)

            for key in ['user', 'zone']:
                if key in kwargs:
                    kwargs['irods_{}_name'.format(key)] = kwargs.pop(key)

            return iRODSAccount(**kwargs)

        # Get credentials from irods environment file
        creds = self.get_irods_env(env_file)

        # Update with new keywords arguments only
        creds.update(
            (key, value) for key, value in kwargs.items() if key not in creds)

        # Get auth scheme
        try:
            auth_scheme = creds['irods_authentication_scheme']
        except KeyError:
            # default
            auth_scheme = 'native'

        if auth_scheme.lower() == PAM_AUTH_SCHEME:
            if 'password' in creds:
                return iRODSAccount(**creds)
            else:
                # password will be from irodsA file therefore use native login
                creds['irods_authentication_scheme'] = NATIVE_AUTH_SCHEME
        elif auth_scheme != 'native':
            return iRODSAccount(**creds)

        # Native auth, try to unscramble password
        try:
            creds['irods_authentication_uid'] = kwargs[
                'irods_authentication_uid']
        except KeyError:
            pass

        creds['password'] = self.get_irods_password(**creds)

        return iRODSAccount(**creds)
Exemple #3
0
 def configure(self,
               host=None, port=1247, user=None, zone=None,
               password=None, client_user=None, client_zone=None,
               server_dn=None, authentication_scheme='password'):
     account = iRODSAccount(
         host, int(port), user, zone, authentication_scheme,
         password, client_user, server_dn, client_zone)
     self.pool = Pool(account)
Exemple #4
0
    def configure(self,
                  host=None, port=1247, user=None, zone=None,
                  password=None, client_user=None, client_zone=None,
                  server_dn=None, authentication_scheme='password',
                  irods_env_file=None, numThreads=0):

        if irods_env_file:
            creds = self.get_irods_env(irods_env_file)
            creds['password']=self.get_irods_auth(creds)
            account = iRODSAccount(**creds)
        else:
            account = iRODSAccount(
                host, int(port), user, zone, authentication_scheme,
                password, client_user, server_dn, client_zone)

        self.pool = Pool(account)
        self.numThreads = numThreads
 def configure(self,
               host=None,
               port=1247,
               user=None,
               zone=None,
               password=None,
               client_user=None,
               client_zone=None):
     account = iRODSAccount(host, int(port), user, zone, password,
                            client_user, client_zone)
     self.pool = Pool(account)
    def _configure_account(self, **kwargs):
        try:
            env_file = kwargs['irods_env_file']

        except KeyError:
            # For backward compatibility
            for key in ['host', 'port', 'authentication_scheme']:
                if key in kwargs:
                    kwargs['irods_{}'.format(key)] = kwargs.pop(key)

            for key in ['user', 'zone']:
                if key in kwargs:
                    kwargs['irods_{}_name'.format(key)] = kwargs.pop(key)

            return iRODSAccount(**kwargs)

        # Get credentials from irods environment file
        creds = self.get_irods_env(env_file)

        # Update with new keywords arguments only
        creds.update((key, value) for key, value in kwargs.items() if key not in creds)

        # Get auth scheme
        try:
            auth_scheme = creds['irods_authentication_scheme']
        except KeyError:
            # default
            auth_scheme = 'native'

        if auth_scheme != 'native':
            return iRODSAccount(**creds)

        # Native auth, try to unscramble password
        try:
            creds['irods_authentication_uid'] = kwargs['irods_authentication_uid']
        except KeyError:
            pass

        creds['password'] = self.get_irods_password(**creds)

        return iRODSAccount(**creds)
Exemple #7
0
    def _configure_account(self, **kwargs):
        try:
            env_file = kwargs['irods_env_file']

        except KeyError:
            # For backward compatibility
            for key in ['host', 'port', 'authentication_scheme']:
                if key in kwargs:
                    kwargs['irods_{}'.format(key)] = kwargs.pop(key)

            for key in ['user', 'zone']:
                if key in kwargs:
                    kwargs['irods_{}_name'.format(key)] = kwargs.pop(key)

            return iRODSAccount(**kwargs)

        # Get credentials from irods environment file
        creds = self.get_irods_env(env_file)

        # Get auth scheme
        try:
            auth_scheme = creds['irods_authentication_scheme']
        except KeyError:
            # default
            auth_scheme = 'native'

        if auth_scheme != 'native':
            return iRODSAccount(**creds)

        # Native auth, try to unscramble password
        try:
            creds['irods_authentication_uid'] = kwargs[
                'irods_authentication_uid']
        except KeyError:
            pass

        creds['password'] = self.get_irods_password(**creds)

        return iRODSAccount(**creds)
    def configure(self,
                  host=None,
                  port=1247,
                  user=None,
                  zone=None,
                  password=None,
                  client_user=None,
                  client_zone=None,
                  server_dn=None,
                  authentication_scheme='password',
                  irods_env_file=None,
                  numThreads=0):

        if irods_env_file:
            creds = self.get_irods_env(irods_env_file)
            creds['password'] = self.get_irods_auth(creds)
            account = iRODSAccount(**creds)
        else:
            account = iRODSAccount(host, int(port), user, zone,
                                   authentication_scheme, password,
                                   client_user, server_dn, client_zone)

        self.pool = Pool(account)
        self.numThreads = numThreads
Exemple #9
0
 def configure(self, host=None, port=1247, user=None, zone=None,
               password=None, client_user=None, client_zone=None):
     account = iRODSAccount(
         host, int(port), user, zone, password, client_user,
         client_zone)
     self.pool = Pool(account)