original_docstring: Validate credentials.
  
      Iterate through htpasswd credential file until user matches, extract hash
      (encrypted password) and check hash against user-given password, using the
      method specified in the Radicale config.
  
      
docstring: Validate credentials.
  Iterate through htpasswd credential file until user matches, extract hash
  (encrypted password) and check hash against user-given password, using the
  method specified in the Radicale config.
docstring_tokens: Validate credentials . Iterate through htpasswd credential file until user matches extract hash ( encrypted password ) and check hash against user - given password using the method specified in the Radicale config .
code: def is_authenticated(user, password):
      """Validate credentials.
  
      Iterate through htpasswd credential file until user matches, extract hash
      (encrypted password) and check hash against user-given password, using the
      method specified in the Radicale config.
  
      """
      with open(FILENAME) as f:
          for line in f:
              strippedline = line.strip()
              if strippedline:
                  login, hash_value = strippedline.split(":")
                  if login == user:
                      if _verifuncs[ENCRYPTION](hash_value, password):
                          # Allow encryption method to be overridden at runtime.
                          return True
      # Random timer to avoid timing oracles and simple bruteforce attacks
      time.sleep(1 + random.random())
      return False
code_tokens: def is_authenticated ( user , password ) : with open ( FILENAME ) as f : for line in f : strippedline = line . strip ( ) if strippedline : login , hash_value = strippedline . split ( ":" ) if login == user : if _verifuncs [ ENCRYPTION ] ( hash_value , password ) : return True time . sleep ( 1 + random . random ( ) ) return False
short_docstring: Validate credentials.
short_docstring_tokens: Validate credentials .
comment: """Validate credentials.
  
      Iterate through htpasswd credential file until user matches, extract hash
      (encrypted password) and check hash against user-given password, using the
      method specified in the Radicale config.
  
      """$SEP$# Allow encryption method to be overridden at runtime.$SEP$# Random timer to avoid timing oracles and simple bruteforce attacks