autobahn.asyncio.util

Attributes

Functions

create_transport_details(...)

extract_peer_certificate(→ dict[str, Any] | None)

Extract information on the TLS peer certificate (if the peer presented one) from the

get_or_create_event_loop(→ asyncio.AbstractEventLoop)

The event loop to use from code that may run before any loop exists (#1952).

get_serializers()

peer2str(→ str)

transport_channel_id(→ bytes)

Application-layer user authentication protocols are vulnerable to generic

Module Contents

__all = ('sleep', 'get_or_create_event_loop', 'peer2str', 'transport_channel_id',...[source]
create_transport_details(transport, is_server: bool) → autobahn.wamp.types.TransportDetails[source]
extract_peer_certificate(ssl_obj) → dict[str, Any] | None[source]

Extract information on the TLS peer certificate (if the peer presented one) from the SSL object of an asyncio TLS transport (see autobahn.util.peer_certificate_details()).

Parameters:

ssl_obj – The ssl.SSLObject of the TLS transport.

Returns:

The certificate information, or None if the peer presented no certificate.

get_or_create_event_loop() → asyncio.AbstractEventLoop[source]

The event loop to use from code that may run before any loop exists (#1952).

In order: the running loop; else the loop set for this thread with asyncio.set_event_loop(); else a new loop, which is then set for this thread.

asyncio.get_event_loop() used to create that last loop implicitly. Python 3.12 and 3.13 deprecate this (DeprecationWarning: There is no current event loop), and Python 3.14 removes it: there it raises RuntimeError instead. txaio’s asyncio backend handles it the same way.

get_serializers()[source]
peer2str(transport: asyncio.transports.BaseTransport) → str[source]
transport_channel_id(transport, is_server: bool, channel_id_type: str | None = None) → bytes[source]

Application-layer user authentication protocols are vulnerable to generic credential forwarding attacks, where an authentication credential sent by a client C to a server M may then be used by M to impersonate C at another server S. To prevent such credential forwarding attacks, modern authentication protocols rely on channel bindings. For example, WAMP-cryptosign can use the tls-unique channel identifier provided by the TLS layer to strongly bind authentication credentials to the underlying channel, so that a credential received on one TLS channel cannot be forwarded on another.

Parameters:
  • transport – The asyncio TLS transport to extract the TLS channel ID from.

  • is_server – Flag indicating the transport is for a server.

  • channel_id_type – TLS channel ID type, currently only “tls-unique” is supported.

Returns:

The TLS channel id (32 bytes).