Authenticate the user using admin super privileges
        :param password: User's password
        :return:
971815
def admin_authenticate(self, password):
        
        auth_params = {
                'USERNAME': self.username,
                'PASSWORD': password
            }
        self._add_secret_hash(auth_params, 'SECRET_HASH')
        tokens = self.client.admin_initiate_auth(
            UserPoolId=self.user_pool_id,
            ClientId=self.client_id,
            # AuthFlow='USER_SRP_AUTH'|'REFRESH_TOKEN_AUTH'|'REFRESH_TOKEN'|'CUSTOM_AUTH'|'ADMIN_NO_SRP_AUTH',
            AuthFlow='ADMIN_NO_SRP_AUTH',
            AuthParameters=auth_params,
        )

        self.verify_token(tokens['AuthenticationResult']['IdToken'], 'id_token','id')
        self.refresh_token = tokens['AuthenticationResult']['RefreshToken']
        self.verify_token(tokens['AuthenticationResult']['AccessToken'], 'access_token','access')
        self.token_type = tokens['AuthenticationResult']['TokenType']
655172
def login(self, user_id, password):
        

        self._session = requests.session()
        self._session.verify = self._verify_certs
        self._session.auth = (user_id, password)

        try:
            self._update_capabilities()

            url_components = parse.urlparse(self.url)
            if self._dav_endpoint_version == 1:
                self._davpath = url_components.path + 'remote.php/dav/files/' + parse.quote(user_id)
                self._webdav_url = self.url + 'remote.php/dav/files/' + parse.quote(user_id)
            else:
                self._davpath = url_components.path + 'remote.php/webdav'
                self._webdav_url = self.url + 'remote.php/webdav'

        except HTTPResponseError as e:
            self._session.close()
            self._session = None
            raise e
883550
def get_user_password (self, url):
        
        for auth in self["authentication"]:
            if auth['pattern'].match(url):
                return (auth['user'], auth['password'])
        return (None, None)
731403
def set_password(self, user, password):
        
        url = self._build_url(self.endpoint.set_password(id=user))
        return self._post(url, payload=dict(password=password))
237574
def authenticate_by_password(cls, params):
        
        def verify_password(user, password):
            return crypt.check(user.password, password)

        success = False
        user = None
        login = params['login'].lower().strip()
        key = 'email' if '@' in login else 'username'
        try:
            user = cls.get_item(**{key: login})
        except Exception as ex:
            log.error(str(ex))

        if user:
            password = params.get('password', None)
            success = (password and verify_password(user, password))
        return success, user
1363012
def authenticate_user(username, password):
    
    user_model = Query()
    user = db.get(user_model.username == username)

    if not user:
        logger.warning("User %s not found", username)
        return False

    if user['password'] == hash_password(password, user.get('salt')):
        return user['username']

    return False
1051222
def logon(self, password='admin'):
        
        r = self._basic_post(url='logon', data=password)
        return r.json()
761462
def check_credentials(self, username, password):
        
        return password is not None and self.credentials.get(username, None) == password
1047509
def get_privileges(self):
        
        url = self.url('GET_USER_PRIVILEGES')
        return self.dispatch('GET', url, auth=self.auth)
792539
def authenticate(self, password):
        
        aws = AWSSRP(username=self.username, password=password, pool_id=self.user_pool_id,
                     client_id=self.client_id, client=self.client,
                     client_secret=self.client_secret)
        tokens = aws.authenticate_user()
        self.verify_token(tokens['AuthenticationResult']['IdToken'],'id_token','id')
        self.refresh_token = tokens['AuthenticationResult']['RefreshToken']
        self.verify_token(tokens['AuthenticationResult']['AccessToken'], 'access_token','access')
        self.token_type = tokens['AuthenticationResult']['TokenType']
542200
async def set_password(self, password):
        
        await self.controller.change_user_password(self.username, password)
        self._user_info.password = password
384170
def auth(username, password):
    '''
    
    '''

    url = rest_auth_setup()

    data = {'username': username, 'password': password}

    # Post to the API endpoint. If 200 is returned then the result will be the ACLs
    # for this user
    result = salt.utils.http.query(url, method='POST', data=data, status=True,
                                   decode=True)
    if result['status'] == 200:
        log.debug('eauth REST call returned 200: %s', result)
        if result['dict'] is not None:
            return result['dict']
        return True
    else:
        log.debug('eauth REST call failed: %s', result)
        return False
145211
def authenticate_credentials(self, userid, password):
        
        credentials = {
            get_user_model().USERNAME_FIELD: userid,
            'password': password
        }
        user = authenticate(**credentials)

        if user is None:
            raise exceptions.AuthenticationFailed(_('Invalid username/password.'))

        if not user.is_active:
            raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))

        return (user, None)
42940
def set_authorization_password(self, password):
        
        self.authorization_password = password
        self.changed_event.emit(self)
84314
def authenticate_user(self, request, user):
        
        return user.check_password(request.data.get('password')) or \
               self.check_user_token(request, user)
868288
def authenticate_credentials(self, token: bytes, request=None):
        
        user = AuthToken.get_user_for_token(token)

        if user is None:
            raise AuthenticationFailed(_('Invalid auth token.'))

        if not user.is_active:
            raise AuthenticationFailed(_('User inactive or deleted.'))

        return user, token
1311112
def basic_auth(user, password, realm=None):
    
    from neobolt.security import AuthToken
    return AuthToken("basic", user, password, realm)