Determines if the supplied token digests to the stored digest in the user model.
11943
def authenticated?(attribute, token)
      return false unless respond_to?("#{attribute}_digest")
      digest = send("#{attribute}_digest")
      return false if digest.blank?
      BCrypt::Password.new(digest).is_password?(token)
    end
1076616
public function hasSessionTokens()
    {
        return ($this->session->has(self::SESSION_TOKEN_KEY)
            && $this->session->has(self::SESSION_TOKEN_SECRET_KEY));
    }
1062380
protected function containsThrowToken(array $tokens, int $scopeOpener, int $scopeCloser): bool
    {
        for ($i = $scopeOpener + 1; $i < $scopeCloser; $i++) {
            if ($tokens[$i]['code'] !== T_THROW) {
                continue;
            }

            return true;
        }

        return false;
    }
311403
def save_digest(header)
      @request_count = 0

      @digest = {}
      header.split(",").each do |line|
        k, v = line.strip.split("=", 2)
        @digest[k] = (k != "algorithm" and k != "stale") && v[1..-2] || v
      end

      @digest_type = @digest["qop"] ? @digest["qop"].split(",") : []
    end
212988
def is_active(cache, token):
    
    profile = cache.get(token)
    if not profile:
        raise exceptions.NotAuthenticatedException(
            'The token is good, but you are not logged in. Please '
            'try logging in again.')
    return profile
493887
def check_digest_auth(user, passwd):
    """"""

    if request.headers.get('Authorization'):
        credentials = parse_authorization_header(request.headers.get('Authorization'))
        if not credentials:
            return
        request_uri = request.script_root + request.path
        if request.query_string:
            request_uri +=  '?' + request.query_string
        response_hash = response(credentials, passwd, dict(uri=request_uri,
                                                           body=request.data,
                                                           method=request.method))
        if credentials.get('response') == response_hash:
            return True
    return False
229906
function findUserFromAccessToken(accessToken, UserModel) {

    if (!accessToken) return null;

    return UserModel.findById(accessToken.userId).then((user) => {
        if (!user) return Promise.reject('No user with this access token was found.');
        return Promise.resolve(user);
    });
}
925263
def digest_auth(realm, auth_func):
    
    def digest_auth_decorator(func):
        def func_replacement(self, *args, **kwargs):
            # 'self' here is the RequestHandler object, which is inheriting
            # from DigestAuthMixin to get 'get_authenticated_user'
            if self.get_authenticated_user(auth_func, realm):
                return func(self, *args, **kwargs)
        return func_replacement
    return digest_auth_decorator
474960
function (digest, iterationCount) {

        var derive = function (password, salt, len) {
            var key, i, tmpBuf;
            if (len > digest.digestLength()) {
                throw "Key length larger than digest length";
            }
            digest.reset();
            digest.update(password);
            digest.update(salt);
            tmpBuf = digest.finalize();
            for (i = 1; i < iterationCount; i++) {
                tmpBuf = digest.digest(tmpBuf);
            }
            return tmpBuf.slice(0, len);
        };

        return {
            deriveKey: function (password, salt, len) {
                return derive(convertToUint8Array(password), convertToUint8Array(salt), len);
            }
        };
    }
700312
def equivalent_to(self, token):
        
        return self.filter(character_id=token.character_id).require_scopes_exact(token.scopes.all()).filter(
            models.Q(user=token.user) | models.Q(user__isnull=True)).exclude(pk=token.pk)
526660
public static function is_token_user_input($t) {
		if ($t['code'] == T_VARIABLE) {
			if (preg_match('/\$\{?_(GET|POST|REQUEST|COOKIE|SERVER|FILES|ENV)/', $t['content'])) {
				return TRUE;
			}
		} elseif ($t['code'] == T_STRING) {
			if (preg_match('/^(getenv|apache_getenv)$/', $t['content'])) {
				return TRUE;
			}
		}
		return FALSE;
	}
1171103
def create_reset_digest
      self.reset_token = Lines::User.generate_token
      update_attribute(:reset_digest,  Lines::User.digest(reset_token))
      update_attribute(:reset_sent_at, Time.zone.now)
    end
844648
private boolean check(final String _plainPassword,
                          final int _pos)
    {
        boolean ret = false;
        if (this.props.containsKey(PasswordStore.DIGEST + _pos)) {
            final ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
            this.digesterConfig.setAlgorithm(this.props.getProperty(PasswordStore.ALGORITHM + _pos));
            this.digesterConfig.setIterations(this.props.getProperty(PasswordStore.ITERATIONS + _pos));
            this.digesterConfig.setSaltSizeBytes(this.props.getProperty(PasswordStore.SALTSIZE + _pos));
            passwordEncryptor.setConfig(this.digesterConfig);
            ret = passwordEncryptor.checkPassword(_plainPassword, this.props.getProperty(PasswordStore.DIGEST + _pos));
        }
        return ret;
    }
17958
boolean checkCredentials() {


		if(!httpPut)
		{
			if (token.equals(CONFIG_TOKEN) || token.equals(""))
			{
				//Check if set in an environment variable, used with PaaS providers
				String envToken = getEnvVar( CONFIG_TOKEN);

				if (envToken == ""){
					dbg(INVALID_TOKEN);
					return false;
				}

				this.setToken(envToken);
			}

			return checkValidUUID(this.getToken());
		}else{
			if ( !checkValidUUID(this.getKey()) || this.getLocation().equals(""))
				return false;

			return true;
		}
	}
681643
protected function fill_digest_cache() {
        global $DB;

        if (empty($this->users)) {
            return;
        }
        // Get the list of forum subscriptions for per-user per-forum maildigest settings.
        list($in, $params) = $DB->get_in_or_equal(array_keys($this->users));
        $digestspreferences = $DB->get_recordset_select(
                'forum_digests', "userid $in", $params, '', 'id, userid, forum, maildigest');
        foreach ($digestspreferences as $digestpreference) {
            if (!isset($this->digestusers[$digestpreference->forum])) {
                $this->digestusers[$digestpreference->forum] = [];
            }
            $this->digestusers[$digestpreference->forum][$digestpreference->userid] = $digestpreference->maildigest;
        }
        $digestspreferences->close();
    }
28321
public function loadUserFromToken()
    {
        $token = $this->httpCookie()->get($this->getTokenName());
        if (!$token) {
            return false;
        }

        return $this->decryptUserData($token);
    }
1152963
def _check_token_cache_type(self, cache_value):
        '''
        
        '''
        def check_string_value(name):
            return (
                isinstance(cache_value[name], str) or
                isinstance(cache_value[name], unicode)
            )

        def check_refresh_token():
            if 'refresh' in cache_value:
                return check_string_value('refresh')
            else:
                return True

        return (
            isinstance(cache_value, dict) and
            'token' in cache_value and
            'expires' in cache_value and
            check_string_value('token') and
            isinstance(cache_value['expires'], float) and
            check_refresh_token()
        )