Ejemplo n.º 1
0
 def test_ctor_empty(self):
     td = TransportDetails()
     data = td.marshal()
     self.assertEqual(
         data, {
             'channel_type': None,
             'channel_framing': None,
             'channel_serializer': None,
             'own': None,
             'peer': None,
             'is_server': None,
             'own_pid': None,
             'own_tid': None,
             'own_fd': None,
             'is_secure': None,
             'channel_id': None,
             'peer_cert': None,
             'websocket_protocol': None,
             'websocket_extensions_in_use': None,
             'http_headers_received': None,
             'http_headers_sent': None,
             'http_cbtid': None,
         })
     td2 = TransportDetails.parse(td.marshal())
     self.assertEqual(td2, td)
Ejemplo n.º 2
0
    def __init__(self, pending_session_id: int,
                 transport_details: TransportDetails,
                 realm_container: IRealmContainer, config: Dict[str, Any]):
        """

        :param pending_session_id: The WAMP session ID if this authentication succeeds.
        :param transport_details: Transport details of the authenticating session.
        :param realm_container: Realm container (router or proxy) for access to configured realms and roles.
        :param config: Authentication configuration to apply for the pending auth.
        """
        # Details about the authenticating session
        self._session_details = {
            'transport': transport_details.marshal(),
            'session': pending_session_id,
            'authmethod': None,
            'authextra': None
        }

        # The router factory we are working for
        self._realm_container: IRealmContainer = realm_container

        # WAMP-Ticket configuration to apply for the pending auth
        self._config: Dict[str, Any] = config

        # The realm of the authenticating principal.
        self._realm: Optional[str] = None

        # The authentication ID of the authenticating principal.
        self._authid: Optional[str] = None

        # The role under which the principal will be authenticated when
        # the authentication succeeds.
        self._authrole: Optional[str] = None

        # Optional authentication provider (URI of procedure to call).
        self._authprovider: Optional[str] = None

        # The authentication method
        self._authmethod: str = self.AUTHMETHOD

        # Application-specific extra data forwarded to the authenticating client in WELCOME
        self._authextra: Optional[Dict[str, Any]] = None

        # The URI of the authenticator procedure to call (filled only in dynamic mode).
        self._authenticator: Optional[str] = None

        # The realm the (dynamic) authenticator itself is joined to
        self._authenticator_realm: Optional[str] = None

        # The session over which to issue the call to the authenticator (filled only in dynamic mode).
        self._authenticator_session: Optional[ISession] = None