File: //lib/python3/dist-packages/twisted/cred/__pycache__/portal.cpython-310.pyc
o
�b. � @ sj d Z ddlmZmZ ddlmZ ddlmZ ddlm Z ddl
mZmZ G dd� de�Z
G d d
� d
�ZdS )z=
The point of integration of application and authentication.
� )� Interface�
providedBy)�error)�defer)�
maybeDeferred)�failure�reflectc @ s e Zd ZdZdd� ZdS )�IRealmz[
The realm connects application-specific objects to the
authentication system.
c G s dS )a�
Return avatar which provides one of the given interfaces.
@param avatarId: a string that identifies an avatar, as returned by
L{ICredentialsChecker.requestAvatarId<twisted.cred.checkers.ICredentialsChecker.requestAvatarId>}
(via a Deferred). Alternatively, it may be
C{twisted.cred.checkers.ANONYMOUS}.
@param mind: usually None. See the description of mind in
L{Portal.login}.
@param interfaces: the interface(s) the returned avatar should
implement, e.g. C{IMailAccount}. See the description of
L{Portal.login}.
@returns: a deferred which will fire a tuple of (interface,
avatarAspect, logout), or the tuple itself. The interface will be
one of the interfaces passed in the 'interfaces' argument. The
'avatarAspect' will implement that interface. The 'logout' object
is a callable which will detach the mind from the avatar.
N� )�avatarId�mind�
interfacesr
r
�5/usr/lib/python3/dist-packages/twisted/cred/portal.py�
requestAvatar s zIRealm.requestAvatarN)�__name__�
__module__�__qualname__�__doc__r r
r
r
r r s r c @ s2 e Zd ZdZddd�Zdd� Zdd� Zd d
� ZdS )
�Portala�
A mediator between clients and a realm.
A portal is associated with one Realm and zero or more credentials checkers.
When a login is attempted, the portal finds the appropriate credentials
checker for the credentials given, invokes it, and if the credentials are
valid, retrieves the appropriate avatar from the Realm.
This class is not intended to be subclassed. Customization should be done
in the realm object and in the credentials checker objects.
r
c C s$ || _ i | _|D ]}| �|� qdS )z1
Create a Portal to a L{IRealm}.
N)�realm�checkers�registerChecker)�selfr r �checkerr
r
r �__init__<