%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/cred/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/cred/__pycache__/portal.cpython-312.pyc

�

Ϫ�f�����dZddlmZmZmZmZmZmZmZddl	m
Z
mZddlm
Z
ddlmZddlmZddlmZddlmZmZdd	lmZmZee
Zeeeegd
ffZGd�de
�ZGd
�d�Zy
)z=
The point of integration of application and authentication.
�)�Callable�Dict�Iterable�List�Tuple�Type�Union)�	Interface�
providedBy)�error)�ICredentialsChecker)�ICredentials)�defer)�Deferred�
maybeDeferred)�failure�reflectNc
�H�eZdZdZdeeedfdededee	e
e
ffd�Zy)	�IRealmz[
    The realm connects application-specific objects to the
    authentication system.
    �avatarId��mind�
interfaces�returnc��y)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.
        Nr)rrrs   �5/usr/lib/python3/dist-packages/twisted/cred/portal.py�
requestAvatarzIRealm.requestAvatar)s��N)�__name__�
__module__�__qualname__�__doc__r	�bytesr�object�_InterfaceItselfr�_requestResultrrrrrr#sI���
���u�R�y�(�)��17��FV��	�x��'��7�	8�rrc	��eZdZUdZeeeefed<	dde	de
eddfd�Zdeeefd�Z
ded	eeddfd
�Zdeded
eedeefd�Zy)�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.
    �checkers�realmrNc�P�||_i|_|D]}|j|��y)z1
        Create a Portal to a L{IRealm}.
        N)r*r)�registerChecker)�selfr*r)�checkers    r�__init__zPortal.__init__Ps/����
���
��	*�G�� � ��)�	*rc�H�t|jj��S)zR
        Return list of credentials interfaces that can be used to login.
        )�listr)�keys)r-s r�listCredentialsInterfacesz Portal.listCredentialsInterfaces[s���D�M�M�&�&�(�)�)rr.�credentialInterfacesc�L�|s|j}|D]}||j|<�y)N)r4r))r-r.r4�credentialInterfaces    rr,zPortal.registerCheckeras2��$�#*�#?�#?� �#7�	9��18�D�M�M�-�.�	9r�credentialsrrc
��|jD]^}|j|�s�t|j|j|�j|j
j|g|���cSt|�}tjtjtjddjttj |��z���S)a�
        @param credentials: an implementor of
            L{twisted.cred.credentials.ICredentials}

        @param mind: an object which implements a client-side interface for
            your particular realm.  In many cases, this may be None, so if the
            word 'mind' confuses you, just ignore it.

        @param interfaces: list of interfaces for the perspective that the mind
            wishes to attach to. Usually, this will be only one interface, for
            example IMailAccount. For highly dynamic protocols, however, this
            may be a list like (IMailAccount, IUserChooser, IServiceInfo).  To
            expand: if we are speaking to the system over IMAP, any information
            that will be relayed to the user MUST be returned as an
            IMailAccount implementor; IMAP clients would not be able to
            understand anything else. Any information about unusual status
            would have to be relayed as a single mail message in an
            otherwise-empty mailbox. However, in a web-based mail system, or a
            PB-based client, the ``mind'' object inside the web server
            (implemented with a dynamic page-viewing mechanism such as a
            Twisted Web Resource) or on the user's client program may be
            intelligent enough to respond to several ``server''-side
            interfaces.

        @return: A deferred which will fire a tuple of (interface,
            avatarAspect, logout).  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. It must be called when the
            user has conceptually disconnected from the service. Although in
            some cases this will not be in connectionLost (such as in a
            web-based session), it will always be at the end of a user's
            interactive session.
        zNo checker for %sz, )r)rr�requestAvatarId�addCallbackr*rr�failr�Failurer�UnhandledCredentials�join�mapr�qual)r-r7rr�i�ifacs      r�loginzPortal.loginis���J���	K�A��|�|�K�(��}��M�M�!�$�4�4�k���+�d�j�j�6�6��K�?I�K�K�	K�
�+�&���z�z��O�O��*�*�'�$�)�)�C����d�4K�*L�L��
�
�	
r)r)rr r!r"rrr
r
�__annotations__rrr/rr3r,rr$rr&rCrrrr(r(As���
��4�	�?�$7�7�8�8�HJ�	*��	*�'/�0C�'D�	*�	
�	*�*�4��Y��+@�*�9�*�9�CG�	�?�9�	
�9�1
�'�1
�/5�1
�DH��O�1
�	�.�	!�1
rr()r"�typingrrrrrrr	�zope.interfacer
r�twisted.credr�twisted.cred.checkersr
�twisted.cred.credentialsr�twisted.internetr�twisted.internet.deferrr�twisted.pythonrrr%r$r&rr(rrr�<module>rMsl���
F�E�E�0��5�1�"�:�+��	�?��
�'���"�d�(�1C�C�D���Y��<Y
�Y
r

Zerion Mini Shell 1.0