File: //lib/python3/dist-packages/twisted/cred/__pycache__/credentials.cpython-38.pyc
U
W[\? � @ s� d Z ddlmZmZ ddlmZmZ ddlZddlZddl Z ddl
Z
ddlZddlm
Z
ddlmZ ddlmZ ddlmZmZ dd lmZmZ dd
lmZmZmZ ddlmZ G dd
� d
e�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de�Z!eee�G dd� de"��Z#G dd� de"�Z$ee�G dd� de"��Z%ee�G dd� d��Z&ee �G dd� d��Z'ee!�G d d!� d!��Z(G d"d#� d#e�Z)ee)�G d$d%� d%��Z*dS )&z�
This module defines L{ICredentials}, an interface for objects that represent
authentication credentials to provide, and also includes a number of useful
implementations of that interface.
� )�division�absolute_import)�implementer� InterfaceN)�hexlify)�md5)�secureRandom)�
networkString�nativeString)�
intToBytes�unicode)�calcResponse�calcHA1�calcHA2)�errorc @ s e Zd ZdZdS )�ICredentialsz�
I check credentials.
Implementors _must_ specify which sub-interfaces of ICredentials
to which it conforms, using L{zope.interface.declarations.implementer}.
N��__name__�
__module__�__qualname__�__doc__� r r �:/usr/lib/python3/dist-packages/twisted/cred/credentials.pyr s r c @ s e Zd ZdZdd� ZdS )�IUsernameDigestHashz�
This credential is used when a CredentialChecker has access to the hash
of the username:realm:password as in an Apache .htdigest file.
c C s dS )a-
@param digestHash: The hashed username:realm:password to check against.
@return: C{True} if the credentials represented by this object match
the given hash, C{False} if they do not, or a L{Deferred} which
will be called back with one of these values.
Nr )�
digestHashr r r � checkHash/ s zIUsernameDigestHash.checkHashN)r r r r r r r r r r * s r c @ s e Zd ZdZdd� ZdS )�IUsernameHashedPassworda�
I encapsulate a username and a hashed password.
This credential is used when a hashed password is received from the
party requesting authentication. CredentialCheckers which check this
kind of credential must store the passwords in plaintext (or as
password-equivalent hashes) form so that they can be hashed in a manner
appropriate for the particular credentials class.
@type username: L{bytes}
@ivar username: The username associated with these credentials.
c C s dS �a�
Validate these credentials against the correct password.
@type password: L{bytes}
@param password: The correct, plaintext password against which to
check.
@rtype: C{bool} or L{Deferred}
@return: C{True} if the credentials represented by this object match the
given password, C{False} if they do not, or a L{Deferred} which will
be called back with one of these values.
Nr ��passwordr r r �
checkPasswordH s z%IUsernameHashedPassword.checkPasswordN�r r r r r r r r r r : s
r c @ s e Zd ZdZdd� ZdS )�IUsernamePasswordaK
I encapsulate a username and a plaintext password.
This encapsulates the case where the password received over the network
has been hashed with the identity function (That is, not at all). The
CredentialsChecker may store the password in whatever format it desires,
it need only transform the stored password in a similar way before
performing the comparison.
@type username: L{bytes}
@ivar username: The username associated with these credentials.
@type password: L{bytes}
@ivar password: The password associated with these credentials.
c C s dS r r r r r r r i s zIUsernamePassword.checkPasswordNr! r r r r r"