Store credentials for future use.
498561
def _store_credentials(self, username, password, remember=False):
        """"""
        if username and password and remember:
            CONF.set('main', 'report_error/username', username)
            try:
                keyring.set_password('github', username, password)
            except Exception:
                if self._show_msgbox:
                    QMessageBox.warning(self.parent_widget,
                                        _('Failed to store password'),
                                        _('It was not possible to securely '
                                          'save your password. You will be '
                                          'prompted for your Github '
                                          'credentials next time you want '
                                          'to report an issue.'))
                remember = False
        CONF.set('main', 'report_error/remember_me', remember)
62687
def credentials(username, password, digest = false)
      self.username = username
      self.password = password
      self.digest = digest
    end
1222292
def get_credentials(self, **kwargs):
        """"""
        login = (
            kwargs.get("user") or os.environ.get("POLARION_USERNAME") or self.config.get("username")
        )
        pwd = (
            kwargs.get("password")
            or os.environ.get("POLARION_PASSWORD")
            or self.config.get("password")
        )

        if not all([login, pwd]):
            raise Dump2PolarionException("Failed to submit to Polarion - missing credentials")

        self.credentials = (login, pwd)
862923
private static function saveCredentials($key, $credentials)
    {
        $ttl = ($credentials->expires_in / 60) - 2;

        Core::instance()->cache()->put($key, $credentials->access_token, $ttl);
    }
1214526
def add_credential(self, url, username, password):
        
        cur = self.conn.cursor()

        cur.execute("SELECT * FROM credentials WHERE LOWER(username)=LOWER(?) AND password=?", [url, username, password])
        results = cur.fetchall()

        if not len(results):
            cur.execute("INSERT INTO credentials (username, password) VALUES (?,?)", [username, password] )

        cur.close()
430500
def refresh_oauth_credential(self):
        """"""
        credential = self.session.oauth2credential

        if credential.is_stale():
            refresh_session = refresh_access_token(credential)
            self.session = refresh_session
134543
def store(self, server, username, secret):
        
        data_input = json.dumps({
            'ServerURL': server,
            'Username': username,
            'Secret': secret
        }).encode('utf-8')
        return self._execute('store', data_input)
1352078
def _get_credentials_from_settings(self):
        """"""
        remember_me = CONF.get('main', 'report_error/remember_me')
        remember_token = CONF.get('main', 'report_error/remember_token')
        username = CONF.get('main', 'report_error/username', '')
        if not remember_me:
            username = ''

        return username, remember_me, remember_token
427893
private void save() {
    Preferences pref = Preferences
        .userNodeForPackage(ConnectionDialog.class);

    pref.put("host", getHost());
    pref.put("user", getUser());

    boolean remember = getRememberPasswordCheckBox().isSelected();
    if (remember) {
      try {
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
        random.setSeed(new byte[]{
          0x60, (byte) 0xFD, 0x28, 0x07, 0x35, 0x4A, 0x0D, 0x3B
        });
        byte[] iv = new byte[16];
        random.nextBytes(iv);
        IvParameterSpec spec = new IvParameterSpec(iv);
        keygen.init(128, random);
        cipher.init(Cipher.ENCRYPT_MODE, keygen.generateKey(), spec);
        byte[] clearText = getPassword().getBytes();
        byte[] cipherText = cipher.doFinal(clearText);
        pref.putByteArray("password", cipherText);
        pref.putBoolean("remember", true);
      } catch (Exception e) {
        logger.error("Could not encrypt password", e);
        pref.remove("password");
        pref.putBoolean("remember", false);
      }
    } else {
      pref.remove("password");
      pref.putBoolean("remember", false);
    }
  }
585900
def _create_credentials(self, n):
        
        if not n:
            return n
        elif isinstance(n, SecurityCreds):
            return n
        elif isinstance(n, dict):
            return SecurityCreds(**n)
        else:
            raise TypeError("%s is not a valid security configuration"
                            % repr(n))
34058
def RegisterCredentials(cls, credentials):
    
    if credentials.type_indicator in cls._credentials:
      raise KeyError(
          'Credentials object already set for type indicator: {0:s}.'.format(
              credentials.type_indicator))

    cls._credentials[credentials.type_indicator] = credentials
564676
def credentials=(string)
      user, pass = string.split(":")
      dcp = HtmlUnit::DefaultCredentialsProvider.new
      dcp.addCredentials(user, pass)
      @webclient.setCredentialsProvider(dcp)
    end
1166751
def setCredentials(self, user, password):
        
        self._checkUserAndPass(user, password)
        self.user = user
        self.password = password
1341162
def authenticate_credentials(self, userid, password, request=None):
        """"""

        user = auth.authenticate(username=userid, password=password)

        if user is None or (user and not user.is_active):
            raise exceptions.AuthenticationFailed("Invalid username/password.")

        return (user, None)
801654
def cli(ctx):
    """"""
    dir_path = os.path.join(os.path.expanduser('~'), '.keep', '.credentials')
    if os.path.exists(dir_path):
        if click.confirm('[CRITICAL] Reset credentials saved in ~/.keep/.credentials ?', abort=True):
            os.remove(dir_path)
    utils.register()
98594
public function storeOriginalRestApiAuthenticationObjects()
    {
        foreach ($this->getOriginalRestApiRequest()->_authClasses as $className) {
            if (array_key_exists($className, static::$instances)) {
                $this->originalRestApiAuthenticationObjects[$className] = static::$instances[$className];
            }
        }
    }
1040776
def store_stats(self):
    """"""
    stats = self._stats()

    # Write stats to user-defined json file.
    stats_json_file_name = self.get_options().stats_local_json_file
    if stats_json_file_name:
      self.write_stats_to_json(stats_json_file_name, stats)

    # Upload to remote stats db.
    stats_upload_urls = copy.copy(self.get_options().stats_upload_urls)
    timeout = self.get_options().stats_upload_timeout
    for stats_url, auth_provider in stats_upload_urls.items():
      self.post_stats(stats_url, stats, timeout=timeout, auth_provider=auth_provider)