Verifies that a password matches the stored password for that username.
        If verification passes, the matching user instance is returned
434771
def authenticate(self, username, password):
        
        PraetorianError.require_condition(
            self.user_class is not None,
            "Praetorian must be initialized before this method is available",
        )
        user = self.user_class.lookup(username)
        MissingUserError.require_condition(
            user is not None,
            'Could not find the requested user',
        )
        AuthenticationError.require_condition(
            self._verify_password(password, user.password),
            'The password is incorrect',
        )
        return user
39075
def verify_authentication_data(self, key):
        '''
        
        '''
        correct_authentication_data = self.calculate_authentication_data(key)
        return self.authentication_data == correct_authentication_data
704286
function authenticate(name, pass, fn) {
  if (!module.parent) console.log('authenticating %s:%s', name, pass);
  var user = users[name];
  // query the db for the given username
  if (!user) return fn(new Error('cannot find user'));
  // apply the same algorithm to the POSTed password, applying
  // the hash against the pass / salt, if there is a match we
  // found the user
  hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) {
    if (err) return fn(err);
    if (hash === user.hash) return fn(null, user)
    fn(new Error('invalid password'));
  });
}
124671
def validate_password_confirmation(self, value):
        
        if value != self.initial_data['password']:
            raise serializers.ValidationError(_('Password confirmation mismatch'))
        return value
605458
def verify(password, encoded):
    
    algorithm, iterations, salt, h = split(encoded)

    to_verify = encode(password, algorithm, salt, int(iterations))
    return hmac.compare_digest(to_verify.encode(), encoded.encode())
310995
def authenticate
      if username? and password?
        user = user_model.find_for_session(username)

        if user
          if user.valid_session?
            if user.authenticate(@password)
              return user
            end
          end

          user.failed_authentication!
          user = nil
        end
      end

      nil
    end
362142
def basic_register(username, password, password2):
    
    if password != password2:
        raise InvalidInput(password={'message': "Passwords do not match"},
                           username={'value': username})
    user = User.objects.create_user(username, password)
    return create_session(user.username, password)
140007
async def login_user(self, password, **kwds):
        
        # find the matching user with the given email
        user_data = (await self._get_matching_user(fields=list(kwds.keys()), **kwds))['data']
        try:
            # look for a matching entry in the local database
            passwordEntry = self.model.select().where(
                self.model.user == user_data[root_query()][0]['pk']
            )[0]
        # if we couldn't acess the id of the result
        except (KeyError, IndexError) as e:
            # yell loudly
            raise RuntimeError('Could not find matching registered user')


        # if the given password matches the stored hash
        if passwordEntry and passwordEntry.password == password:
            # the remote entry for the user
            user = user_data[root_query()][0]
            # then return a dictionary with the user and sessionToken
            return {
                'user': user,
                'sessionToken': self._user_session_token(user)
            }

        # otherwise the passwords don't match
        raise RuntimeError("Incorrect credentials")
311759
def _check_auth(self, username: str, password: str) -> bool:
        """"""
        try:
            return self.credentials[username] == password
        except KeyError:
            return False
177293
function isAuthenticated(username, password) {

    var userIndex = userdb.users.findIndex(function (user) {
        return (user.name === username && user.password === password);
    });

    return userIndex != -1;
}
1054756
def authenticated_get(username, password, url, verify=True):
    
    try:
        response = requests.get(url, auth=(username, password), verify=verify)
        if response.status_code == 401:
            raise BadCredentialsException(
                "Unable to authenticate user %s to %s with password provided!"
                % (username, url))
    except requests.exceptions.SSLError:
        raise CertificateException("Unable to verify certificate at %s!" % url)
    return response.content
157112
def compare_password(expected, actual):
    """"""
    if expected == actual:
        return True, "OK"
    msg = []
    ver_exp = expected[-8:].rstrip()
    ver_act = actual[-8:].rstrip()

    if expected[:-8] != actual[:-8]:
        msg.append("Password mismatch")
    if ver_exp != ver_act:
        msg.append("asterisk_mbox version mismatch.  Client: '" +
                   ver_act + "',  Server: '" + ver_exp + "'")
    return False, ". ".join(msg)
808999
def check_auth(self, username, password):
        """"""
        if username == self.args.username:
            from glances.password import GlancesPassword
            pwd = GlancesPassword()
            return pwd.check_password(self.args.password, pwd.sha256_hash(password))
        else:
            return False
117691
def authenticate(self, password):
        
        user = None

        try:
            self._authenticate_user_dn(password)
            self._check_requirements()
            self._get_or_create_user()

            user = self._user
        except self.AuthenticationFailed as e:
            logger.debug(u"Authentication failed for %s: %s" % (self._username, e))
        except ldap.LDAPError as e:
            results = ldap_error.send(self.backend.__class__,
                                      context='authenticate', exception=e)
            if len(results) == 0:
                logger.warning(u"Caught LDAPError while authenticating %s: %s",
                               self._username, pprint.pformat(e))
        except Exception:
            logger.exception(u"Caught Exception while authenticating %s",
                             self._username)
            raise

        return user
251028
def authenticate(self, username, password):
        

        if username is None or password is None:
            return False

        # check the username
        if not re.match("^[A-Za-z0-9_-]*$", username):
            return False

        user_dn = self.get_user_dn(username)

        server = ldap3.Server(
                self.uri,
                use_ssl=self.use_ssl
            )

        connection = ldap3.Connection(server, user=user_dn, password=password)

        return connection.bind()
681412
def user_verify_password(user_id=None, name=None, password=None,
                         profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    if 'connection_endpoint' in connection_args:
        auth_url = connection_args.get('connection_endpoint')
    else:
        auth_url_opt = 'keystone.auth_url'
        if __salt__['config.option']('keystone.token'):
            auth_url_opt = 'keystone.endpoint'

        if _OS_IDENTITY_API_VERSION > 2:
            auth_url = __salt__['config.option'](auth_url_opt,
                                                 'http://127.0.0.1:35357/v3')
        else:
            auth_url = __salt__['config.option'](auth_url_opt,
                                                 'http://127.0.0.1:35357/v2.0')

    if user_id:
        for user in kstone.users.list():
            if user.id == user_id:
                name = user.name
                break
    if not name:
        return {'Error': 'Unable to resolve user name'}
    kwargs = {'username': name,
              'password': password,
              'auth_url': auth_url}
    try:
        if _OS_IDENTITY_API_VERSION > 2:
            client3.Client(**kwargs)
        else:
            client.Client(**kwargs)
    except (keystoneclient.exceptions.Unauthorized,
            keystoneclient.exceptions.AuthorizationFailure):
        return False
    return True
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)