Get password of the username for the service
359094
def get_password(self, service, username):
        
        items = self._find_passwords(service, username)
        if not items:
            return None

        secret = items[0].secret
        return (
            secret
            if isinstance(secret, six.text_type) else
            secret.decode('utf-8')
        )
587424
@ReadOperation
    public Map<String, Object> handle(final String username,
                                      final String password,
                                      final String service) {

        val selectedService = this.serviceFactory.createService(service);
        val registeredService = this.servicesManager.findServiceBy(selectedService);

        val credential = new UsernamePasswordCredential(username, password);
        val result = this.authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(selectedService, credential);
        val authentication = result.getAuthentication();

        val principal = authentication.getPrincipal();
        val attributesToRelease = registeredService.getAttributeReleasePolicy().getAttributes(principal, selectedService, registeredService);
        val principalId = registeredService.getUsernameAttributeProvider().resolveUsername(principal, selectedService, registeredService);
        val modifiedPrincipal = this.principalFactory.createPrincipal(principalId, attributesToRelease);
        val builder = DefaultAuthenticationBuilder.newInstance(authentication);
        builder.setPrincipal(modifiedPrincipal);
        val finalAuthentication = builder.build();

        val samlResponse = this.samlResponseBuilder.createResponse(selectedService.getId(), selectedService);
        samlResponseBuilder.prepareSuccessfulResponse(samlResponse, selectedService, finalAuthentication, principal,
            finalAuthentication.getAttributes(), principal.getAttributes());

        val resValidation = new LinkedHashMap<String, Object>();
        val encoded = SamlUtils.transformSamlObject(this.openSamlConfigBean, samlResponse).toString();
        resValidation.put(CasViewConstants.MODEL_ATTRIBUTE_NAME_ASSERTION, encoded);
        resValidation.put(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE, selectedService);
        resValidation.put("registeredService", registeredService);

        return resValidation;
    }
503164
def get_uid(username)
      Etc.passwd { |u| return u.uid if u.name == username }
    end
59542
def getCredentials(self):
        """"""

        (username, password, public_key, private_key) = self.getCredentialValues()

        if public_key or private_key:
            return UserKeyCredential(username, public_key, private_key)

        if username or password:
            return UserPassCredential(username, password)

        return None
386279
def prompt_for_credentials(username):
    '''

    '''
    message = 'Enter password for user "{0}": '.format(username)
    password = getpass.getpass(message)
    if not password:
        raise ValueError(
            'No credentials provided for user "{0}"'.format(username)
        )
    return password
311759
def _check_auth(self, username: str, password: str) -> bool:
        """"""
        try:
            return self.credentials[username] == password
        except KeyError:
            return False
361471
def set_password(self, service, username, password):
        
        service = escape_for_ini(service)
        username = escape_for_ini(username)

        # ensure the file exists
        self._ensure_file_path()

        # load the keyring from the disk
        config = configparser.RawConfigParser()
        config.read(self.file_path)

        # update the keyring with the password
        if not config.has_section(service):
            config.add_section(service)
        config.set(service, username, password)

        # save the keyring back to the file
        config_file = codecs.open(self.file_path, 'w', 'utf-8')
        try:
            config.write(config_file)
        finally:
            config_file.close()
468476
def set_password(self, service, username, password):
        
        service = escape_for_ini(service)
        username = escape_for_ini(username)

        # encrypt the password
        password = password or ''
        password_encrypted = self.encrypt(password.encode('utf-8'))

        # encode with base64
        password_base64 = base64.encodestring(password_encrypted).decode()
        # write the modification
        if not self.config.has_section(service):
            self.config.add_section(service)
        self.config.set(service, username, password_base64)
        config_file = UnicodeWriterAdapter(self._open('w'))
        self.config.write(config_file)
        config_file.close()
708807
def get_password(self, username, request_url):
        
        content = "%s%s%s" % (username, self.shared_secret, request_url)
        return hashlib.sha256(content.encode('utf8')).hexdigest()
246348
def _get_passwordkey(self):
        """"""

        sha = SHA256.new()
        sha.update(self.password.encode('utf-8'))
        return sha.digest()
1210749
def get_user_by_password(self, username, password):
        
        try:
            user = self.get(username=username)
        except User.DoesNotExist:
            return None
        
        if bcrypt.hashpw(password, user.pass_hash) == user.pass_hash:
            return user
        else:
            return None
437266
def delete_password(self, service, username):
        
        try:
            key_name = self._key_for_service(service)
            hkey = winreg.OpenKey(
                winreg.HKEY_CURRENT_USER, key_name, 0,
                winreg.KEY_ALL_ACCESS)
            winreg.DeleteValue(hkey, username)
            winreg.CloseKey(hkey)
        except WindowsError:
            e = sys.exc_info()[1]
            raise PasswordDeleteError(e)
        self._delete_key_if_empty(service)
53054
def passwordLogin(self, username):
        
        self.challenge = secureRandom(16)
        self.username = username
        return {'challenge': self.challenge}
160992
def __getUsername(self):
        """"""

        if self._securityHandler is not None and \
           not self._securityHandler._username is None:
            return self._securityHandler._username
        elif self._securityHandler is not None and \
               hasattr(self._securityHandler, "org_url") and \
               self._securityHandler.org_url is not None:
            from .administration import Administration
            user = Administration(url=self._securityHandler.org_url,
                                  securityHandler=self._securityHandler,
                                  proxy_url=self._proxy_url,
                                  proxy_port=self._proxy_port).portals.portalSelf.user
            return user['username']
        else:
            from .administration import Administration
            url = self._url.lower().split('/content/')[0]
            user = Administration(url=url,
                                  securityHandler=self._securityHandler,
                                  proxy_url=self._proxy_url,
                                  proxy_port=self._proxy_port).portals.portalSelf.user
            return user['username']
27798
def get_password(self):
        
        password = self.get_as_nullable_string("password")
        password = password if password != None else self.get_as_nullable_string("pass")
        return password
414386
def username(self):
        """"""
        if len(self._inp_username.value.strip()) == 0: # if username provided by user
            if not self.hostname is None:
                config = parse_sshconfig(self.hostname)
                if 'user' in config: # if username is present in the config file
                    return config['user']
            else:
                return None
        else:
            return self._inp_username.value
1372277
def set_password(self, service, username, password):
        
        if not username:
            # https://github.com/jaraco/keyrings.alt/issues/21
            raise ValueError("Username cannot be blank.")
        if not isinstance(password, string_types):
            raise TypeError("Password should be a unicode string, not bytes.")
        assoc = self._generate_assoc(service, username)
        # encrypt the password
        password_encrypted = self.encrypt(password.encode('utf-8'), assoc)
        # encode with base64 and add line break to untangle config file
        password_base64 = '\n' + encodebytes(password_encrypted).decode()

        self._write_config_value(service, username, password_base64)